public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: "Dave Korn" <dave.korn@artimi.com>
To: "'Jingzhao Ou'" <jingzhao.ou@gmail.com>
Cc: <insight@sources.redhat.com>
Subject: RE: Compiling the latest GDB on cygwin
Date: Wed, 17 Aug 2005 15:48:00 -0000	[thread overview]
Message-ID: <SERRANObWIAdcLBxGcu000000c9@SERRANO.CAM.ARTIMI.COM> (raw)
In-Reply-To: <43025127.7020407@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2844 bytes --]

----Original Message----
>From: Jingzhao Ou
>Sent: 16 August 2005 21:49

> Hi, Dave,
> 
> I downloaded the following version of Insight from the ftp website:
> 
>
ftp://sources.redhat.com:/pub/insight/snapshots/current/insight-weekly-6.30.
50.20050808.tar.bz2
> 
> When I tried to compile the source in cygwin on a WinXP box, I got the
> following error message:

> tclWin32Dll.o: In function `TclpCheckStackSpace':
> /cygdrive/d/src/tcl/win/tclWin32Dll.c:364: undefined reference to
> `__except_checkstackspace_handler'
      [ ... snip several similar ... ]
> collect2: ld returned 1 exit status

> I changed tcl/win/Makefile and undefined "-DHAVE_NO_SEH=1". Then I got
> errors reporting that "__try" are undefined, etc. I commented out all
> the "__try" and "__except" and get tcl compiled without further
> complaints. 

  This is a known problem, but the solution isn't to change the HAVE_NO_SEH
flag.  The functions are being compiled but they're only referenced from asm
(...) statements and the optimiser thinks they're unused.  (The optimiser
has become more aggressive in more recent versions of gcc, which is why this
problem didn't show up before; it's only started happening recently because
cygwin went from a 3.3.x series compiler to a 3.4.x series compiler a few
months back).  It's fixed in CVS, or you could apply the patch at

http://sourceware.org/ml/insight/2005-q3/msg00021.html

> After that, I still encountered the following errors in the "gdb"
> directory: 
> 
> libgdb.a(solib.o): In function `solib_address':
> /cygdrive/d/src/gdb/solib.c:771: multiple definition of `_solib_address'
> libgdb.a(win32-nat.o):/cygdrive/d/src/gdb/win32-nat.c:728: first defined
> here

  Ah, this is a new one on me too.  It seems that the win32 native version
of solib_address is now clashing with the generic version from solib.c; I
don't know why this shouldn't have always been the case, perhaps the
visibility of one of the symbols has changed recently, maybe it's a
side-effect of some of the multi-arch work.  ISTM that the correct thing to
do is use the win32 native version of the functions, which seems to override
the generic solib functionality with dll-related functionality.  Which makes
sense.

> I got lost here and don't know how I should proceed. Can any one kindly
> tell me what I am missing in the compilation process? I am only
> interested in using gdb to debug C/C++ code. I don't need the Java or
> Fortran stuffs if they are giving me trouble.

  You're doing fine so far.  Attached is my current patchset; this fixes
both problems and results in a working gdb, but I've not looked to
thoroughly at it for correctness.  Apply it to the snapshout you're working
with and have another go, and let me know if it works/doesn't work for you.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

[-- Attachment #2: gdb-cygwin-patches.diff --]
[-- Type: application/octet-stream, Size: 6576 bytes --]

Index: gdb/win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.112
diff -p -u -r1.112 win32-nat.c
--- gdb/win32-nat.c	6 Jul 2005 14:54:34 -0000	1.112
+++ gdb/win32-nat.c	17 Aug 2005 15:21:12 -0000
@@ -724,7 +724,7 @@ handle_unload_dll (void *dummy)
 }
 
 char *
-solib_address (CORE_ADDR address)
+win32_nat_solib_address (CORE_ADDR address)
 {
   struct so_stuff *so;
   for (so = &solib_start; so->next != NULL; so = so->next)
@@ -735,14 +735,14 @@ solib_address (CORE_ADDR address)
 
 /* Return name of last loaded DLL. */
 char *
-child_solib_loaded_library_pathname (int pid)
+win32_nat_child_solib_loaded_library_pathname (int pid)
 {
   return !solib_end || !solib_end->name[0] ? NULL : solib_end->name;
 }
 
 /* Clear list of loaded DLLs. */
 void
-child_clear_solibs (void)
+win32_nat_child_clear_solibs (void)
 {
   struct so_stuff *so, *so1 = solib_start.next;
 
@@ -868,7 +868,7 @@ solib_symbols_add (char *name, int from_
 
 /* Load DLL symbol info. */
 void
-dll_symbol_command (char *args, int from_tty)
+win32_nat_dll_symbol_command (char *args, int from_tty)
 {
   int n;
   dont_repeat ();
@@ -1453,7 +1453,7 @@ do_initial_child_stuff (DWORD pid)
   memset (&current_event, 0, sizeof (current_event));
   push_target (&deprecated_child_ops);
   disable_breakpoints_in_shlibs (1);
-  child_clear_solibs ();
+  win32_nat_child_clear_solibs ();
   clear_proceed_status ();
   init_wait_for_inferior ();
 
@@ -2129,7 +2129,7 @@ _initialize_win32_nat (void)
 
   init_child_ops ();
 
-  c = add_com ("dll-symbols", class_files, dll_symbol_command,
+  c = add_com ("dll-symbols", class_files, win32_nat_dll_symbol_command,
 	       _("Load dll library symbols from FILE."));
   set_cmd_completer (c, filename_completer);
 
@@ -2429,14 +2429,14 @@ out:
 }
 
 void
-child_solib_add (char *filename, int from_tty, struct target_ops *target,
+win32_nat_child_solib_add (char *filename, int from_tty, struct target_ops *target,
 		 int readsyms)
 {
   if (!readsyms)
     return;
   if (core_bfd)
     {
-      child_clear_solibs ();
+      win32_nat_child_clear_solibs ();
       bfd_map_over_sections (core_bfd, &core_section_load_dll_symbols, target);
     }
   else
Index: gdb/config/i386/tm-cygwin.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-cygwin.h,v
retrieving revision 1.18
diff -p -u -r1.18 tm-cygwin.h
--- gdb/config/i386/tm-cygwin.h	6 Apr 2004 01:53:51 -0000	1.18
+++ gdb/config/i386/tm-cygwin.h	17 Aug 2005 15:21:12 -0000
@@ -21,16 +21,16 @@
    Boston, MA 02111-1307, USA.  */
 
 #define ATTACH_NO_WAIT
-#define SOLIB_ADD(filename, from_tty, targ, readsyms) child_solib_add(filename, from_tty, targ, readsyms)
-#define PC_SOLIB(addr) solib_address (addr)
-#define SOLIB_LOADED_LIBRARY_PATHNAME(pid) child_solib_loaded_library_pathname(pid)
-#define CLEAR_SOLIB child_clear_solibs
-#define ADD_SHARED_SYMBOL_FILES dll_symbol_command
+#define SOLIB_ADD(filename, from_tty, targ, readsyms) win32_nat_child_solib_add(filename, from_tty, targ, readsyms)
+#define PC_SOLIB(addr) win32_nat_solib_address (addr)
+#define SOLIB_LOADED_LIBRARY_PATHNAME(pid) win32_nat_child_solib_loaded_library_pathname(pid)
+#define CLEAR_SOLIB win32_nat_child_clear_solibs
+#define ADD_SHARED_SYMBOL_FILES win32_nat_dll_symbol_command
 
 struct target_ops;
 char *cygwin_pid_to_str (ptid_t ptid);
-void child_solib_add (char *, int, struct target_ops *, int);
-char *solib_address (CORE_ADDR);
-char *child_solib_loaded_library_pathname(int);
-void child_clear_solibs (void);
-void dll_symbol_command (char *, int);
+void win32_nat_child_solib_add (char *, int, struct target_ops *, int);
+char *win32_nat_solib_address (CORE_ADDR);
+char *win32_nat_child_solib_loaded_library_pathname(int);
+void win32_nat_child_clear_solibs (void);
+void win32_nat_dll_symbol_command (char *, int);
Index: tcl/win/tclWin32Dll.c
===================================================================
RCS file: /cvs/src/src/tcl/win/tclWin32Dll.c,v
retrieving revision 1.9
diff -p -u -r1.9 tclWin32Dll.c
--- tcl/win/tclWin32Dll.c	21 Jan 2003 19:40:22 -0000	1.9
+++ tcl/win/tclWin32Dll.c	17 Aug 2005 15:21:16 -0000
@@ -38,8 +38,8 @@ static HINSTANCE hInstance;	/* HINSTANCE
 static int platformId;		/* Running under NT, or 95/98? */
 
 #ifdef HAVE_NO_SEH
-static void *ESP;
-static void *EBP;
+static void *ESP __attribute__ ((used));
+static void *EBP __attribute__ ((used));
 #endif /* HAVE_NO_SEH */
 
 /*
@@ -393,7 +393,7 @@ TclpCheckStackSpace()
 }
 #ifdef HAVE_NO_SEH
 static
-__attribute__ ((cdecl))
+__attribute__ ((cdecl)) __attribute__ ((used))
 EXCEPTION_DISPOSITION
 _except_checkstackspace_handler(
     struct _EXCEPTION_RECORD *ExceptionRecord,
Index: tcl/win/tclWinChan.c
===================================================================
RCS file: /cvs/src/src/tcl/win/tclWinChan.c,v
retrieving revision 1.5
diff -p -u -r1.5 tclWinChan.c
--- tcl/win/tclWinChan.c	21 Jan 2003 19:40:22 -0000	1.5
+++ tcl/win/tclWinChan.c	17 Aug 2005 15:21:18 -0000
@@ -122,8 +122,8 @@ static Tcl_ChannelType fileChannelType =
 };
 
 #ifdef HAVE_NO_SEH
-static void *ESP;
-static void *EBP;
+static void *ESP __attribute__ ((used));
+static void *EBP __attribute__ ((used));
 #endif /* HAVE_NO_SEH */
 
 \f
@@ -1106,7 +1106,7 @@ Tcl_MakeFileChannel(rawHandle, mode)
 }
 #ifdef HAVE_NO_SEH
 static
-__attribute__ ((cdecl))
+__attribute__ ((cdecl)) __attribute__ ((used))
 EXCEPTION_DISPOSITION
 _except_makefilechannel_handler(
     struct _EXCEPTION_RECORD *ExceptionRecord,
Index: tcl/win/tclWinFCmd.c
===================================================================
RCS file: /cvs/src/src/tcl/win/tclWinFCmd.c,v
retrieving revision 1.6
diff -p -u -r1.6 tclWinFCmd.c
--- tcl/win/tclWinFCmd.c	7 Feb 2003 19:52:00 -0000	1.6
+++ tcl/win/tclWinFCmd.c	17 Aug 2005 15:21:19 -0000
@@ -469,7 +469,7 @@ DoRenameFile(
 }
 #ifdef HAVE_NO_SEH
 static
-__attribute__ ((cdecl))
+__attribute__ ((cdecl)) __attribute__ ((used))
 EXCEPTION_DISPOSITION
 _except_dorenamefile_handler(
     struct _EXCEPTION_RECORD *ExceptionRecord,
@@ -651,7 +651,7 @@ DoCopyFile(
 }
 #ifdef HAVE_NO_SEH
 static
-__attribute__ ((cdecl))
+__attribute__ ((cdecl)) __attribute__ ((used))
 EXCEPTION_DISPOSITION
 _except_docopyfile_handler(
     struct _EXCEPTION_RECORD *ExceptionRecord,

  reply	other threads:[~2005-08-17 15:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-16  6:39 Jingzhao Ou
2005-08-16 12:03 ` Dave Korn
2005-08-16 20:48   ` Jingzhao Ou
2005-08-17 15:48     ` Dave Korn [this message]
2005-08-17 22:21       ` Jingzhao Ou
2005-08-17 23:34         ` Jingzhao Ou
2005-08-17 23:43           ` Keith Seitz
2005-08-18  5:35             ` Jingzhao Ou
2005-08-18 17:41               ` Keith Seitz
2005-08-18 18:04                 ` Jingzhao Ou
2005-08-19  9:22                   ` Dave Korn

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=SERRANObWIAdcLBxGcu000000c9@SERRANO.CAM.ARTIMI.COM \
    --to=dave.korn@artimi.com \
    --cc=insight@sources.redhat.com \
    --cc=jingzhao.ou@gmail.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).