Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix loading libc longjmp probes when no custom get_longjmp_target exists
@ 2013-11-01 13:37 Tiago Stürmer Daitx
  2013-11-01 16:16 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Tiago Stürmer Daitx @ 2013-11-01 13:37 UTC (permalink / raw)
  To: gdb-patches

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;



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-01 16:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-01 13:37 [PATCH] Fix loading libc longjmp probes when no custom get_longjmp_target exists Tiago Stürmer Daitx
2013-11-01 16:16 ` Tom Tromey
2013-11-01 16:50   ` Tiago Stürmer Daitx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox