From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13441 invoked by alias); 22 Oct 2014 09:31:23 -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 13422 invoked by uid 89); 22 Oct 2014 09:31:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Oct 2014 09:31:21 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1XgsGD-0005qT-U6 from Yao_Qi@mentor.com ; Wed, 22 Oct 2014 02:31:17 -0700 Received: from GreenOnly (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.181.6; Wed, 22 Oct 2014 02:31:17 -0700 From: Yao Qi To: Victor Kamensky CC: Subject: Re: [PATCH 4/5] ARM: read_pieced_value do big endian processing only in case of valid gdb_regnum References: <1413853021-4393-1-git-send-email-victor.kamensky@linaro.org> <1413853021-4393-5-git-send-email-victor.kamensky@linaro.org> Date: Wed, 22 Oct 2014 09:31:00 -0000 In-Reply-To: <1413853021-4393-5-git-send-email-victor.kamensky@linaro.org> (Victor Kamensky's message of "Mon, 20 Oct 2014 17:57:00 -0700") Message-ID: <877fzsihdr.fsf@codesourcery.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00570.txt.bz2 Victor Kamensky writes: Hi Victor, Could you please add more details in the commit message? for example.... > During armv7b testing gdb.base/store.exp test was failling with > 'GDB internal error'. It turns out that compiler generated DWARF What is the 'GDB internal error'? Is it like this? (gdb) PASS: gdb.base/store.exp: continue to wack_double print l^M gdb/regcache.c:178: internal-error: register_size: Assertion `regnum >=3D 0= && regnum < (gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch= ))' failed.^M A problem internal to GDB has been detected, We've seen this internal error on (armv5te big-endian) for a while. > with non-existent register numbers. The compiler issue is present > in both little endian (armv7) and big endian (armv7b) (it is > separate issue). In both case gdbarch_dwarf2_reg_to_regnum returns Is there any PR opened for the compiler issue? If there is, please mention it in the commit message, otherwise, please describe the mistakes in the compiler generated debug info, the snippet of 'readelf -wi' output, which shows the wrong register number, should be fine. > -1 which is stored into gdb_regnum. But it cause severe problem > only in big endian case because in read_pieced_value and > write_pieced_value functions BFD_ENDIAN_BIG related processing > happen regardless of gdb_regnum value, and in case of gdb_regnum=3D-1, > it cause 'GDB internal error' and crash. > > Solution is to move BFD_ENDIAN_BIG related processing under > (gdb_regnum !=3D -1) branch of processing. With your patch applied, the internal error is fixed. How does GDB behave now? What is the output for 'print l'? In my case, it becomes: print l^M Unable to access DWARF register number 80^M (gdb) FAIL: gdb.base/store.exp: upvar float l; print old l, expecting -1 > --- > gdb/ChangeLog | 6 ++++++ > gdb/dwarf2loc.c | 30 +++++++++++++++--------------- > 2 files changed, 21 insertions(+), 15 deletions(-) > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > index c32fb3f..6a735b8 100644 > --- a/gdb/ChangeLog > +++ b/gdb/ChangeLog > @@ -1,5 +1,11 @@ > 2014-10-13 Victor Kamensky >=20=20 > + * dwarf2loc.c (read_pieced_value): do BE processing only if > + gdb_regnum is not -1. s/do/Do. Looks you've fixed it in V2. s/BE/big endian/ because BE isn't very clear here. > + (write_pieced_value): Ditto. > + > +2014-10-13 Victor Kamensky > + > * arm-tdep.c: (extract_arm_insn): use dbarch_byte_order_for_code > to read arm instruction. >=20=20 > diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c > index e347e59..fbe99bb 100644 > --- a/gdb/dwarf2loc.c > +++ b/gdb/dwarf2loc.c > @@ -1686,20 +1686,20 @@ read_pieced_value (struct value *v) > int gdb_regnum =3D gdbarch_dwarf2_reg_to_regnum (arch, p->v.regno); > int reg_offset =3D source_offset; >=20=20 > - if (gdbarch_byte_order (arch) =3D=3D BFD_ENDIAN_BIG > - && this_size < register_size (arch, gdb_regnum)) > - { > - /* Big-endian, and we want less than full size. */ > - reg_offset =3D register_size (arch, gdb_regnum) - this_size; > - /* We want the lower-order THIS_SIZE_BITS of the bytes > - we extract from the register. */ > - source_offset_bits +=3D 8 * this_size - this_size_bits; > - } > - > if (gdb_regnum !=3D -1) > { > int optim, unavail; >=20=20 > + if (gdbarch_byte_order (arch) =3D=3D BFD_ENDIAN_BIG > + && this_size < register_size (arch, gdb_regnum)) > + { > + /* Big-endian, and we want less than full size. */ > + reg_offset =3D register_size (arch, gdb_regnum) - this_size; > + /* We want the lower-order THIS_SIZE_BITS of the bytes > + we extract from the register. */ > + source_offset_bits +=3D 8 * this_size - this_size_bits; > + } > + Nit: after the change, local variable 'reg_offset' is only used in the "if (gdb_regnum !=3D -1) {}" block, so we can move 'reg_offset' into that block. --=20 Yao (=E9=BD=90=E5=B0=A7)