This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

[PATCH] Fix loading libc longjmp probes when no custom get_longjmp_target exists


As discussed on the GDB ML[1], libc probes for longjmp were not being
loaded if a custom <arch>_get_longjmp_target function was not
implemented.

This is trivially fixed by moving the 'if (!gdbarch_get_longjmp_target_p
(gdbarch))' down, just bellow libc probe code and above the per-objfile
cache lookup.

While the condition could also be removed altogether with no
side-effects, it is in fact an optimization to avoid searching for
symbols if the arch doesn't provide support for get_longjmp_target().

This has been tested on PPC and PPC64. The following testcases in the
testsuite are fixed:

[snip]
-FAIL: gdb.base/longjmp.exp: next over longjmp(1)
+PASS: gdb.base/longjmp.exp: next over longjmp(1)
+PASS: gdb.base/longjmp.exp: next into else block (1)
+PASS: gdb.base/longjmp.exp: next into safety net (1)
 PASS: gdb.base/longjmp.exp: breakpoint at pattern 2 start
 PASS: gdb.base/longjmp.exp: continue to breakpoint at pattern 2 start
 PASS: gdb.base/longjmp.exp: breakpoint at miss_step_2
 PASS: gdb.base/longjmp.exp: next over setjmp (2)
-FAIL: gdb.base/longjmp.exp: next over call_longjmp (2)
+PASS: gdb.base/longjmp.exp: next over call_longjmp (2)
+PASS: gdb.base/longjmp.exp: next into else block (2)
+PASS: gdb.base/longjmp.exp: next into safety net (2)
[snip]
-XFAIL: gdb.base/stale-infcall.exp: test system longjmp tracking support
-UNTESTED: gdb.base/stale-infcall.exp: System lacks support for tracking
longjmps
+PASS: gdb.base/stale-infcall.exp: test system longjmp tracking support
+PASS: gdb.base/stale-infcall.exp: delete $test_fail_bpnum
+PASS: gdb.base/stale-infcall.exp: continue to breakpoint: break-run1
+PASS: gdb.base/stale-infcall.exp: print infcall ()
+PASS: gdb.base/stale-infcall.exp: stack corrupted
+PASS: gdb.base/stale-infcall.exp: bt
+PASS: gdb.base/stale-infcall.exp: maintenance print dummy-frames
+PASS: gdb.base/stale-infcall.exp: maintenance info breakpoints


[1] https://sourceware.org/ml/gdb/2013-10/msg00191.html


- Tiago

gdb/
2013-11-01  Tiago StÃrmer Daitx  <tdaitx@linux.vnet.ibm.com>

	* breakpoint.c (create_longjmp_master_breakpoint): Allow libc
	probe scan even when the arch provides no get_longjmp_target.


diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 1782c99..ffe73fd 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3226,8 +3226,6 @@ create_longjmp_master_breakpoint (void)
       struct breakpoint_objfile_data *bp_objfile_data;
 
       gdbarch = get_objfile_arch (objfile);
-      if (!gdbarch_get_longjmp_target_p (gdbarch))
-	continue;
 
       bp_objfile_data = get_breakpoint_objfile_data (objfile);
 
@@ -3277,6 +3275,9 @@ create_longjmp_master_breakpoint (void)
 	  continue;
 	}
 
+      if (!gdbarch_get_longjmp_target_p (gdbarch))
+	continue;
+
       for (i = 0; i < NUM_LONGJMP_NAMES; i++)
 	{
 	  struct breakpoint *b;



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