This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Clarifications regarding BDM GDB Insight for M68k


Prasanna - Khanapur wrote:
> 
> But the few other error still persists as fallows:
> 
> *****************************************************
> gcc -g -O2       -Wl,--subsystem,console -o gdb.exe main.o
> libgdb.a    ../bfd/libbfd.a ../readline/libreadl
> libgdb.a(gdbtk.o): In function `initialize_gdbtk':
> /home/taxi/insight-5.0/insight-5.0/gdb/./gdbtk/generic/gdbtk.c:603:
> undefined reference to `FreeConsole'
> /home/taxi/insight-5.0/insight-5.0/gdb/./gdbtk/generic/gdbtk.c:609:
> undefined reference to `GetStdHandle'
> 
> I searched for the function "FreeConsole()" and could find it in
> the /cygwin/lib/w32api/  in the libkernel32.a.
> The following was output after nm.exe:
> 
> *****************************************************
> 
> $ nm libkernel32.a |grep FreeConsole
> 00000000 T _FreeConsole@0
> 00000000 I __imp__FreeConsole@0
> 
> ****************************************************

 As you can see the symbol name is not 'FreeConsole', but instead
'FreeConsole@0' !!!  So here should be your clue and asking why
the '@0' is there would give you a sane answer from anyone familiar
with the Cygwin or Mingw target...

> So I guess that the definition of the unreferenced function is
> present in the libkernel32.a.
> I added the libkernel32.a to the final linking of gdb.exe.
> But still the error persist , what could be the problem?

 The answer is that the function prototype should declare this being
a 'WINAPI'-function :

    E:\usr\local\i386-mingw32msvc\sys-include>grep FreeConsole *.h
    wincon.h:BOOL WINAPI FreeConsole(void);

 The 'w32api'-headers (should be common for Cygwin and Mingw) should
declare this function as seen previously... So the 'gdbtk.c' doesn't
include the needed 'wincon.h' directly or via some other header, and
this causes the symbol name not being 'mangled' this way...

 I don't know whether '#include <windows.h>' should include <wincon.h>
too, or not, or what could be the 'right' fix... It can be to add the
'#include <wincon.h>' into some w32api-header which should now include
it, or to add this into the 'gdbtk.c' itself. But as an local workaround
the last choice could be the best...

Cheers, Kai


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]