This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi, Here is a patch to handle correctly the GET_LONGJMP_TARGET for GNU/Linux i386. I tested that the next command entering a *longjmp() will stop at the first instruction after the *longjmp() has completed. Best regards, -Eric P.S. This patch file assumes that you have already included my latest patch for signal handling in GNU/Linux. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ Eric PAIRE Email : e.paire@gr.opengroup.org | THE Open GROUP - Research Institute Phone : +33 (0) 476 63 48 71 | 2, avenue de Vignate Fax : +33 (0) 476 51 05 32 | F-38610 Gieres FRANCE ------ ChangeLog here ------ ChangeLog here ------ ChangeLog here ------ Tue May 5 18:21:11 1998 Eric Paire <paire@alice.gr.osf.org> Support of GET_LONGJMP_TARGET for GNU/Linux i386: * breakpoint.c (create_longjmp_breakpoint): Don't insert twice a bp_longjmp breakpoint at the same address or bpstat_what() will return an error. (breakpoint_re_set): add __longjmp to the list of longjmp breakpoints. ----- diffs here ----- diffs here ----- diffs here ----- diffs here ----- diff -ru gdb-4.17-JMP/gdb/breakpoint.c gdb-4.17/gdb/breakpoint.c --- gdb-4.17-JMP/gdb/breakpoint.c Thu Apr 9 01:51:56 1998 +++ gdb-4.17/gdb/breakpoint.c Tue May 5 17:25:30 1998 @@ -2165,12 +2165,19 @@ struct minimal_symbol *m; m = lookup_minimal_symbol_text (func_name, NULL, (struct objfile *)NULL); - if (m) - sal.pc = SYMBOL_VALUE_ADDRESS (m); - else + if (!m) return; + + sal.pc = SYMBOL_VALUE_ADDRESS (m); + sal.section = find_pc_overlay (sal.pc); + + /* Don't insert twice a bp_longjmp breakpoint at the same address */ + ALL_BREAKPOINTS (b) + if (b->type == bp_longjmp + && b->address == sal.pc + && (overlay_debugging == 0 || b->section == sal.section)) + return; } - sal.section = find_pc_overlay (sal.pc); b = set_raw_breakpoint (sal); if (!b) return; @@ -3675,6 +3682,7 @@ #ifdef GET_LONGJMP_TARGET create_longjmp_breakpoint ("longjmp"); create_longjmp_breakpoint ("_longjmp"); + create_longjmp_breakpoint ("__longjmp"); create_longjmp_breakpoint ("siglongjmp"); create_longjmp_breakpoint ("_siglongjmp"); create_longjmp_breakpoint (NULL); diff -ru gdb-4.17-JMP/gdb/config/i386/linux.mt gdb-4.17/gdb/config/i386/linux.mt --- gdb-4.17-JMP/gdb/config/i386/linux.mt Wed Apr 22 03:23:15 1998 +++ gdb-4.17/gdb/config/i386/linux.mt Thu Apr 30 19:53:53 1998 @@ -2,4 +2,7 @@ TDEPFILES= i386-tdep.o i387-tdep.o TM_FILE= tm-linux.h +# The following define is used to get the JB_PC #define from <jmp_buf.h> +MT_CFLAGS= -D__USE_MISC + GDBSERVER_DEPFILES= low-linux.o diff -ru gdb-4.17-JMP/gdb/config/i386/tm-linux.h gdb-4.17/gdb/config/i386/tm-linux.h --- gdb-4.17-JMP/gdb/config/i386/tm-linux.h Thu Apr 30 18:01:51 1998 +++ gdb-4.17/gdb/config/i386/tm-linux.h Tue May 5 16:38:28 1998 @@ -25,6 +25,19 @@ #include "i386/tm-i386.h" +/* Size of an element of the jmp_buf. */ + +#define JB_ELEMENT_SIZE sizeof (int) + +/* Figure out where the longjmp will land. Slurp the args out of the stack. + We expect the first arg to be a pointer to the jmp_buf structure from which + we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. + This routine returns true on success */ + +extern int +get_longjmp_target PARAMS ((CORE_ADDR *)); +#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) + /* Offset to saved PC and EFLAGS in sigcontext, from <linux/signal.h>. */ #define SIGCONTEXT_PC_OFFSET (14 * 4) #define SIGCONTEXT_EFLAGS_OFFSET (16 * 4) diff -ru gdb-4.17-JMP/gdb/i386-tdep.c gdb-4.17/gdb/i386-tdep.c --- gdb-4.17-JMP/gdb/i386-tdep.c Thu Apr 30 18:27:06 1998 +++ gdb-4.17/gdb/i386-tdep.c Thu Apr 30 19:55:46 1998 @@ -575,6 +575,7 @@ } #ifdef GET_LONGJMP_TARGET +#include <setjmp.h> /* Figure out where the longjmp will land. Slurp the args out of the stack. We expect the first arg to be a pointer to the jmp_buf structure from which