From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23960 invoked by alias); 18 Jul 2008 17:33:11 -0000 Received: (qmail 23873 invoked by uid 22791); 18 Jul 2008 17:33:00 -0000 X-Spam-Check-By: sourceware.org Received: from ns.surtec.com (HELO SurTec.com) (62.157.175.70) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 18 Jul 2008 17:32:40 +0000 Received: from [192.168.1.5] (br.surtec.com [200.161.1.30]) by SurTec.com (Postfix) with ESMTP id 20E0F779CED for ; Fri, 18 Jul 2008 19:32:35 +0200 (CEST) Message-Id: From: "Dr. Rolf Jansen" To: gdb-patches@sourceware.org Content-Type: multipart/mixed; boundary=Apple-Mail-11--275532577 Mime-Version: 1.0 (Apple Message framework v928.1) Subject: [gdbserver] compiling latest server.c (rev. 1.76) with MinGW for running on win32 Date: Fri, 18 Jul 2008 17:33:00 -0000 X-Mailer: Apple Mail (2.928.1) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-07/txt/msg00365.txt.bz2 --Apple-Mail-11--275532577 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Content-length: 2373 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 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 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 --Apple-Mail-11--275532577 Content-Disposition: attachment; filename=server.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="server.diff" Content-Transfer-Encoding: 7bit Content-length: 1878 *** 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 #endif + #if USE_WIN32API + #include + 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); --Apple-Mail-11--275532577 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Content-length: 3 --Apple-Mail-11--275532577--