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: "Maciej W. Rozycki" <macro at linux-mips dot org>
- To: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: Pedro Alves <palves at redhat dot com>, ppluzhnikov at gmail dot com, gdb-patches at sourceware dot org, ppluzhnikov at google dot com
- Date: Thu, 10 Sep 2015 16:02:40 +0100 (BST)
- 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> <201509101433 dot t8AEX5Cw008716 at glazunov dot sibelius dot xs4all dot nl>
On Thu, 10 Sep 2015, Mark Kettenis 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.
Thanks for the heads-up!
> I'm pretty sure you do.
Indeed. Use `bfd_get_sign_extend_vma' to determine.
Maciej