From: "Dr. Rolf Jansen" <rj@surtec.com>
To: gdb-patches@sourceware.org
Subject: [gdbserver] compiling latest server.c (rev. 1.76) with MinGW for running on win32
Date: Fri, 18 Jul 2008 17:33:00 -0000 [thread overview]
Message-ID: <CA429CE7-12AD-4308-B44A-23D2F5E416EF@surtec.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]
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 #2: server.diff --]
[-- Type: application/octet-stream, Size: 1878 bytes --]
*** HEAD/src/gdb/gdbserver/server.c Fri Jul 18 14:07:19 2008
--- LOCAL/src/gdb/gdbserver/server.c Fri Jul 18 14:07:01 2008
***************
*** 28,33 ****
--- 28,37 ----
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
+ #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
unsigned long cont_thread;
unsigned long general_thread;
*************** int terminal_fd;
*** 67,80 ****
/* TERMINAL_FD's original foreground group. */
pid_t old_foreground_pgrp;
- /* Set if you want to disable optional thread related packets support
- in gdbserver, for the sake of testing GDB against stubs that don't
- support them. */
- int disable_packet_vCont;
- int disable_packet_Tthread;
- int disable_packet_qC;
- int disable_packet_qfThreadInfo;
-
/* Hand back terminal ownership to the original foreground group. */
static void
--- 71,76 ----
*************** restore_old_foreground_pgrp (void)
*** 84,89 ****
--- 80,93 ----
}
#endif
+ /* Set if you want to disable optional thread related packets support
+ in gdbserver, for the sake of testing GDB against stubs that don't
+ support them. */
+ int disable_packet_vCont = 0;
+ int disable_packet_Tthread = 0;
+ int disable_packet_qC = 0;
+ int disable_packet_qfThreadInfo = 0;
+
static int
target_running (void)
{
*************** main (int argc, char *argv[])
*** 1299,1304 ****
--- 1303,1309 ----
gdbserver_show_disableable (stdout);
exit (0);
}
+ #ifdef SIGTTOU
else if (strncmp (*next_arg,
"--disable-packet=",
sizeof ("--disable-packet=") - 1) == 0)
*************** main (int argc, char *argv[])
*** 1334,1339 ****
--- 1339,1345 ----
}
}
}
+ #endif
else
{
fprintf (stderr, "Unknown argument: %s\n", *next_arg);
[-- Attachment #3: Type: text/plain, Size: 3 bytes --]
next reply other threads:[~2008-07-18 17:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-18 17:33 Dr. Rolf Jansen [this message]
2008-07-18 19:32 ` Pedro Alves
2008-07-18 20:17 ` Dr. Rolf Jansen
2008-07-31 16:19 ` Pedro Alves
2008-07-31 16:48 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA429CE7-12AD-4308-B44A-23D2F5E416EF@surtec.com \
--to=rj@surtec.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox