This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


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

longjmp handling on i386 GNU/Linux


These patches add longjmp handling to the i386 GNU/Linux target.

These patches get the value of JB_PC from the native <setjmp.h>.
Therefore, I put the code in nm-linux.h rather than tm-linux.h.  It
could be moved to tm-linux.h; in this case, for current versions of
glibc, it should be

#define JB_ELEMENT_SIZE (4)
#define JB_PC (5)

However, I do not know if that is correct for all versions of
GNU/Linux.

Ian


1999-07-02  Ian Lance Taylor  <ian@zembu.com>

	* config/i386/nm-linux.h: Include <setjmp.h>.
	(JM_ELEMENT_SIZE): Define.
	(get_longjmp_target): Declare.
	(GET_LONGJMP_TARGET): Define.
	* breakpoint.c (create_longjmp_breakpoint): Avoid inserting
	multiple longjmp breakpoints at the same address.


Index: breakpoint.c
===================================================================
RCS file: /zembu/cvsfiles/tools/gdb/gdb/breakpoint.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 breakpoint.c
--- breakpoint.c	1999/07/02 19:07:39	1.1.1.2
+++ breakpoint.c	1999/07/02 23:53:44
@@ -3109,6 +3109,16 @@ create_longjmp_breakpoint (func_name)
 	sal.pc = SYMBOL_VALUE_ADDRESS (m);
       else
 	return;
+
+      /* Avoid inserting multiple longjmp breakpoints at the same
+         address.  This case arises when using glibc, which makes
+         _longjmp and siglongjmp weak aliases for longjmp.  */
+      ALL_BREAKPOINTS (b)
+	if (b->type == bp_longjmp
+	    && b->address == sal.pc
+	    && (overlay_debugging == 0
+		|| b->section == find_pc_overlay (sal.pc)))
+	  return;
     }
   sal.section = find_pc_overlay (sal.pc);
   b = set_raw_breakpoint (sal);
Index: config/i386/nm-linux.h
===================================================================
RCS file: /zembu/cvsfiles/tools/gdb/gdb/config/i386/nm-linux.h,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 nm-linux.h
--- nm-linux.h	1999/07/02 19:08:36	1.1.1.2
+++ nm-linux.h	1999/07/02 23:53:44
@@ -70,4 +70,15 @@ i386_insert_watchpoint PARAMS ((int pid,
 extern int
 i386_remove_watchpoint PARAMS ((int pid, CORE_ADDR addr, int len));
 
+/* Figure out where a longjmp will wind up.  JB_PC is defined by
+   <setjmp.h>.  */
+
+#include <setjmp.h>
+
+#define JB_ELEMENT_SIZE (sizeof (int))
+
+extern int get_longjmp_target PARAMS ((CORE_ADDR *));
+
+#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target (ADDR)
+
 #endif /* #ifndef NM_LINUX_H */

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