From patchwork Thu Oct 9 11:46:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 3169 Received: (qmail 32300 invoked by alias); 9 Oct 2014 11:46:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 32291 invoked by uid 89); 9 Oct 2014 11:46:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp17.uk.ibm.com Received: from e06smtp17.uk.ibm.com (HELO e06smtp17.uk.ibm.com) (195.75.94.113) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 09 Oct 2014 11:46:40 +0000 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Oct 2014 12:46:37 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp17.uk.ibm.com (192.168.101.147) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 9 Oct 2014 12:46:35 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 74F091B0805F for ; Thu, 9 Oct 2014 12:47:50 +0100 (BST) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s99BkYuU15794488 for ; Thu, 9 Oct 2014 11:46:34 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s99BkYks022447 for ; Thu, 9 Oct 2014 05:46:34 -0600 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-196.boeblingen.de.ibm.com [9.152.212.196]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s99BkXZ7022417; Thu, 9 Oct 2014 05:46:33 -0600 From: Andreas Arnez To: gdb-patches@sourceware.org Cc: Stefan Liebler , Ulrich Weigand Subject: [PATCH] Remove non-address bits for longjmp resume breakpoint Date: Thu, 09 Oct 2014 13:46:32 +0200 Message-ID: <87tx3dihye.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14100911-0029-0000-0000-0000012077E4 X-IsSubscribed: yes On 32-bit S390 targets the longjmp target address "naturally" has the most significant bit set. That bit indicates the addressing mode and is not part of the address itself. Thus, in analogy with similar cases (like when computing the caller PC in insert_step_resume_breakpoint_at_caller), this change removes non-address bits from the longjmp target address before using it as a breakpoint address. Note that there are two ways for determining the longjmp target address: via a probe or via a gdbarch method. This change only affects the probe method, because it is assumed that the address returned by the gdbarch method is usable as-is. This change was tested together with a patch that enables longjmp probes in glibc for S/390: https://sourceware.org/ml/libc-alpha/2014-10/msg00277.html gdb/ChangeLog: * gdb/infrun.c (process_event_stop_test): Apply gdbarch_addr_bits_remove to longjmp resume address. --- gdb/infrun.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 4681175..42c40c4 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4596,7 +4596,10 @@ process_event_stop_test (struct execution_control_state *ecs) is the third argument to the probe. */ arg_value = probe_safe_evaluate_at_pc (frame, 2); if (arg_value) - jmp_buf_pc = value_as_address (arg_value); + { + jmp_buf_pc = value_as_address (arg_value); + jmp_buf_pc = gdbarch_addr_bits_remove (gdbarch, jmp_buf_pc); + } else if (!gdbarch_get_longjmp_target_p (gdbarch) || !gdbarch_get_longjmp_target (gdbarch, frame, &jmp_buf_pc))