Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Tiago Stürmer Daitx" <tdaitx@linux.vnet.ibm.com>
To: gdb-patches <gdb-patches@sourceware.org>
Subject: [PATCH] Fix loading libc longjmp probes when no custom get_longjmp_target exists
Date: Fri, 01 Nov 2013 13:37:00 -0000	[thread overview]
Message-ID: <1383313023.5925.150.camel@localhost.localdomain> (raw)

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;



             reply	other threads:[~2013-11-01 13:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01 13:37 Tiago Stürmer Daitx [this message]
2013-11-01 16:16 ` Tom Tromey
2013-11-01 16:50   ` Tiago Stürmer Daitx

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=1383313023.5925.150.camel@localhost.localdomain \
    --to=tdaitx@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /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