This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix BZ15121 -- x/a broken for addresses in shared libraries
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: palves at redhat dot com
- Cc: ppluzhnikov at gmail dot com, gdb-patches at sourceware dot org, ppluzhnikov at google dot com, macro at linux-mips dot org
- Date: Thu, 10 Sep 2015 16:33:05 +0200 (CEST)
- Subject: Re: [patch] Fix BZ15121 -- x/a broken for addresses in shared libraries
- Authentication-results: sourceware.org; auth=none
- References: <CALoOobP+FH-rRO-HYOFgu0QrfHwgteeu_ufawVDL9zeyef7h7g at mail dot gmail dot com> <55F19100 dot 30600 at redhat dot com>
> Date: Thu, 10 Sep 2015 15:17:36 +0100
> From: Pedro Alves <palves@redhat.com>
>
> On 09/06/2015 09:03 PM, Paul Pluzhnikov wrote:
>
> > index 91bf49e..0624b90 100644
> > --- a/gdb/value.c
> > +++ b/gdb/value.c
> > @@ -2927,7 +2927,13 @@ unpack_pointer (struct type *type, const gdb_byte *valaddr)
> > {
> > /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
> > whether we want this to be true eventually. */
> > - return unpack_long (type, valaddr);
> > + LONGEST ret = unpack_long (type, valaddr);
> > + int len = TYPE_LENGTH (type);
> > + if (sizeof (CORE_ADDR) > len && ret < 0) {
> > + /* Don't sign-extend 32-bit pointer. BZ 15121. */
> > + return ret & ((1UL << (8 * len)) - 1);
> > + }
> > + return ret;
> > }
>
> Do we need to keep sign-extending on MIPS? Adding Maciej.
I'm pretty sure you do.