This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[gdbserver] compiling latest server.c (rev. 1.76) with MinGW for running on win32
- From: "Dr. Rolf Jansen" <rj at surtec dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 18 Jul 2008 14:32:32 -0300
- Subject: [gdbserver] compiling latest server.c (rev. 1.76) with MinGW for running on win32
The latest server.c rev 1.76 does produce warnings when compiled with
the MinGW tools:
server.c: In function 'start_inferior':
server.c:107: warning: implicit declaration of function 'alloca'
server.c:107: warning: incompatible implicit declaration of built-in
function 'alloca'
server.c: In function 'handle_search_memory_1':
server.c:356: warning: implicit declaration of function 'memmem'
server.c:356: warning: assignment makes pointer from integer without a
cast
In addition, linking of gdbserver.exe fails because of undefined
references:
remote-utils.o:remote-utils.c:(.text+0x1057): undefined reference to
`_disable_packet_Tthread'
server.o:server.c:(.text+0x9c6): undefined reference to
`_disable_packet_qC'
server.o:server.c:(.text+0xa6f): undefined reference to
`_disable_packet_qfThreadInfo'
server.o:server.c:(.text+0x20b4): undefined reference to
`_disable_packet_vCont'
server.o:server.c:(.text+0x264a): undefined reference to
`_disable_packet_vCont'
server.o:server.c:(.text+0x2670): undefined reference to
`_disable_packet_Tthread'
server.o:server.c:(.text+0x2696): undefined reference to
`_disable_packet_qC'
server.o:server.c:(.text+0x26bc): undefined reference to
`_disable_packet_qfThreadInfo'
server.o:server.c:(.text+0x26df): undefined reference to
`_disable_packet_vCont'
server.o:server.c:(.text+0x26e9): undefined reference to
`_disable_packet_Tthread'
server.o:server.c:(.text+0x26f3): undefined reference to
`_disable_packet_qC'
server.o:server.c:(.text+0x26fd): undefined reference to
`_disable_packet_qfThreadInfo'
collect2: ld returned 1 exit status
MinGW defines alloca() in <malloc.h> and memmem() is not built-in. I
think this should eventually be addressed in the configure script,
however, as a quick fix, I added at the top of server.c:
#if USE_WIN32API
#include <malloc.h>
void *memmem (const void *haystack_start, size_t haystack_len, const
void *needle_start, size_t needle_len);
#endif
In order to resolve the linking errors, the definition of the
respective variables must be moved out of the conditional block
(#ifdef SIGTTOU ... #endif), because they are used also within non-
conditional code in remote-utils.c and in server.c.
I attached a .diff to this message, wich addresses both issues,
although, there might be better ways to address 'em.
Best regards
Rolf Jansen
Attachment:
server.diff
Description: Binary data