From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92934 invoked by alias); 15 Mar 2018 13:46:10 -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 92911 invoked by uid 89); 15 Mar 2018 13:46:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS,T_RP_MATCHES_RCVD,URIBL_SBL autolearn=ham version=3.3.2 spammy=D*ru X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 15 Mar 2018 13:46:04 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3A5AEAE75; Thu, 15 Mar 2018 13:46:02 +0000 (UTC) From: Andreas Schwab To: Vlad Ivanov Cc: "gdb-patches\@sourceware.org" Subject: Re: [PATCH] gdbarch: Add pc_signed field and use it when adjusting BP addresses References: <20180315112111.15247-1-vlad.ivanov@lab-systems.ru> <830441521113797@web37j.yandex.ru> X-Yow: Look! A ladder! Maybe it leads to heaven, or a sandwich! Date: Thu, 15 Mar 2018 13:46:00 -0000 In-Reply-To: <830441521113797@web37j.yandex.ru> (Vlad Ivanov's message of "Thu, 15 Mar 2018 14:36:37 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2018-03/txt/msg00298.txt.bz2 On Mär 15 2018, Vlad Ivanov wrote: > 15.03.2018, 14:33, "Andreas Schwab" : >> On Mär 15 2018, vlad.ivanov@lab-systems.ru wrote: >> >>>  diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c >>>  index 454fda7684..247ec34857 100644 >>>  --- a/gdb/breakpoint.c >>>  +++ b/gdb/breakpoint.c >>>  @@ -6999,7 +6999,10 @@ adjust_breakpoint_address (struct gdbarch *gdbarch, >>>             adjusted_bpaddr = gdbarch_adjust_breakpoint_address (gdbarch, bpaddr); >>>           } >>> >>>  - adjusted_bpaddr = address_significant (gdbarch, adjusted_bpaddr); >>>  + /* Don't cut out "insignificant" address bits on targets with >>>  + signed PC. */ >>>  + if (!gdbarch_pc_signed (gdbarch)) >>>  + adjusted_bpaddr = address_significant (gdbarch, adjusted_bpaddr); >> >> Shouldn't it be sign-extended instead? >> >> Andreas. >> > > MIPS backend already returns a sign-extended value, and address_significant > cuts out bits 63 to 32. This makes breakpoint address comparison in step > routines to misbehave. What happens if you start with a non-canonical address? The call to address_significant wouldn't be needed if adjusted_bpaddr were always canonical to begin with. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."