From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101255 invoked by alias); 25 May 2018 17:18:26 -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 100753 invoked by uid 89); 25 May 2018 17:18:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=brobecker, brobeckeradacorecom, U*brobecker, Brobecker X-HELO: mail-qk0-f177.google.com Received: from mail-qk0-f177.google.com (HELO mail-qk0-f177.google.com) (209.85.220.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 25 May 2018 17:18:24 +0000 Received: by mail-qk0-f177.google.com with SMTP id c23-v6so4617418qkb.5 for ; Fri, 25 May 2018 10:18:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QrWaHT4lhOprx2731zglVbGAvf+9uZdqIYa+deBNsYI=; b=NLVd481n/f5KcQqbhdg0VB9SgsG9uFgnmHVKlW+SFJG2xSsDWwbT2GRChJ5eP67ir9 w5cBpRMs/zx6wocOpR7wDprE8HBV+C8nvPdcQ2FuQDyPX93AImRHgN4JUFmzl7cLt6VN OfvNbjpYCBcgq69ebOMBFweC5F3tiu/H0OG/jWF5oORiGEZTzu1iN2Q9d0H0wVVthbCk tZ4EL76IejzHpb9LLUY2x9DCSlIhXd185l0M8+peyzQbRaCcDmJVLZhFDpHHcsaWaR17 GaZD9STwcNMELxpEUf8dEwzBR9S6PEpP+u/vbf84gavHaZT/u0QqJ1ddtLn0aGdSmNkG miwA== X-Gm-Message-State: ALKqPweAU8TRFEfDV6BzAEJ18mnvlUdw41ij3cPqwKCSjrFY7Gb1KyOp C1lJfox00wQ6NVlIWCXT7RjmXt5rTqB++gEu/Rf3UEWT X-Google-Smtp-Source: ADUXVKKRN2/2im9oZKry0yjUtay7XEFea64xybyktWMRDaqPXyI08p81B40s5Zhdmh/z6zx2bxf2neQ6kOP63yqv53w= X-Received: by 2002:a37:7082:: with SMTP id l124-v6mr2981956qkc.193.1527268702274; Fri, 25 May 2018 10:18:22 -0700 (PDT) MIME-Version: 1.0 References: <1527023088-10837-1-git-send-email-omair.javaid@linaro.org> <20180523103244.2e6tseom5tsll3kf@adacore.com> In-Reply-To: <20180523103244.2e6tseom5tsll3kf@adacore.com> From: Omair Javaid Date: Fri, 25 May 2018 17:29:00 -0000 Message-ID: Subject: Re: [PATCH] [PR gdb/23210] Unset gdbarch significant_addr_bit by default To: Joel Brobecker Cc: GDB Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-05/txt/msg00681.txt.bz2 On Wed, 23 May 2018, 3:32 PM Joel Brobecker, wrote: > Hi Omair, > > > > This patch fixes a bug introduced by fix to AArch64 pointer tagging. > > > > In our fix for tagged pointer support our agreed approach was to sign > > extend user-space address after clearing tag bits. This is not same > > for all architectures and this patch allows sign extension for > > addresses on targets which specifically set significant_addr_bit. > > > > More information about patch that caused the issues and discussion > > around tagged pointer support can be found in links below: > > > > https://sourceware.org/ml/gdb-patches/2018-05/msg00000.html > > https://sourceware.org/ml/gdb-patches/2017-12/msg00159.html > > > > gdb/ChangeLog: > > > > 2018-05-23 Omair Javaid > > > > * gdbarch.c (verify_gdbarch): Update. > > * utils.c (address_significant): Update. > > I haven't delved into the actual patch and whether the approach > used is correct, but skimming it, I did notice a couple of things. > > The first one is that gdbarch.c is a generated file, so you should > adjust gdbarch.sh instead so that executing gdbarch.sh gives you > the gdbarch.c file with the behavior you want. In particular, I think > you probably need to remove the default value for significant_addr_bit. > I will update gdbarch as suggested. Are there any other issues in the fix I should address.? > > > --- > > gdb/gdbarch.c | 3 +-- > > gdb/utils.c | 5 +++-- > > 2 files changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c > > index c430ebe..5593911 100644 > > --- a/gdb/gdbarch.c > > +++ b/gdb/gdbarch.c > > @@ -615,8 +615,7 @@ verify_gdbarch (struct gdbarch *gdbarch) > > /* Skip verify of stabs_argument_has_addr, invalid_p == 0 */ > > /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */ > > /* Skip verify of addr_bits_remove, invalid_p == 0 */ > > - if (gdbarch->significant_addr_bit == 0) > > - gdbarch->significant_addr_bit = gdbarch_addr_bit (gdbarch); > > + /* Skip verify of significant_addr_bit, invalid_p == 0 */ > > /* Skip verify of software_single_step, has predicate. */ > > /* Skip verify of single_step_through_delay, has predicate. */ > > /* Skip verify of print_insn, invalid_p == 0 */ > > diff --git a/gdb/utils.c b/gdb/utils.c > > index 9c5bf68..91c0f2b 100644 > > --- a/gdb/utils.c > > +++ b/gdb/utils.c > > @@ -2708,10 +2708,11 @@ address_significant (gdbarch *gdbarch, CORE_ADDR > addr) > > /* Clear insignificant bits of a target address and sign extend > resulting > > address, avoiding shifts larger or equal than the width of a > CORE_ADDR. > > The local variable ADDR_BIT stops the compiler reporting a shift > overflow > > - when it won't occur. */ > > + when it won't occur. Skip updating of target address if current > target has > > + not set gdbarch significant_addr_bit. */ > > Small nit (GNU Coding Style): Two spaces after the period. > > > int addr_bit = gdbarch_significant_addr_bit (gdbarch); > > > > - if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) > > + if (addr_bit && (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))) > > { > > CORE_ADDR sign = (CORE_ADDR) 1 << (addr_bit - 1); > > addr &= ((CORE_ADDR) 1 << addr_bit) - 1; > > -- > > 2.7.4 > > -- > Joel >