From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3668 invoked by alias); 1 Nov 2013 13:37:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3653 invoked by uid 89); 1 Nov 2013 13:37:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,T_FRT_BELOW2 autolearn=ham version=3.3.2 X-HELO: e24smtp05.br.ibm.com Received: from e24smtp05.br.ibm.com (HELO e24smtp05.br.ibm.com) (32.104.18.26) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 01 Nov 2013 13:37:10 +0000 Received: from /spool/local by e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Nov 2013 11:37:06 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp05.br.ibm.com (10.172.0.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 1 Nov 2013 11:37:05 -0200 Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.13.184.26]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 794241DC005D for ; Fri, 1 Nov 2013 09:37:04 -0400 (EDT) Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by d24relay02.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rA1Dax5U51314764 for ; Fri, 1 Nov 2013 11:37:00 -0200 Received: from d24av03.br.ibm.com (localhost [127.0.0.1]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rA1Db36n020020 for ; Fri, 1 Nov 2013 11:37:03 -0200 Received: from [9.78.137.118] ([9.78.137.118]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id rA1Db3OX020003 for ; Fri, 1 Nov 2013 11:37:03 -0200 Message-ID: <1383313023.5925.150.camel@localhost.localdomain> Subject: [PATCH] Fix loading libc longjmp probes when no custom get_longjmp_target exists From: Tiago =?ISO-8859-1?Q?St=FCrmer?= Daitx To: gdb-patches Date: Fri, 01 Nov 2013 13:37:00 -0000 Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13110113-2362-0000-0000-00000C399DC2 X-IsSubscribed: yes X-SW-Source: 2013-11/txt/msg00011.txt.bz2 As discussed on the GDB ML[1], libc probes for longjmp were not being loaded if a custom _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 * 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;