Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Doug Evans <xdje42@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: Handle multiple base address in debug_ranges data.
Date: Mon, 26 Oct 2015 12:55:00 -0000	[thread overview]
Message-ID: <20151026100317.GC23628@embecosm.com> (raw)
In-Reply-To: <86d1w2cryj.fsf@sspiff.org>

* Doug Evans <xdje42@gmail.com> [2015-10-26 01:57:08 +0000]:

> Andrew Burgess <andrew.burgess@embecosm.com> writes:
> > It is possible to use multiple base addresses within a single address
> > range series, within the .debug_ranges section.  The following is a
> > simplified example for 32-bit addresses:
> >
> >   .section ".debug_ranges"
> >   .4byte	0xffffffff
> >   .4byte        BASE_1
> >   .4byte	START_OFFSET_1
> >   .4byte	END_OFFSET_1
> >   .4byte	START_OFFSET_2
> >   .4byte	END_OFFSET_2
> >   .4byte	0xffffffff
> >   .4byte        BASE_2
> >   .4byte	START_OFFSET_3
> >   .4byte	END_OFFSET_3
> >   .4byte	0
> >   .4byte	0
> >
> > In this example START/END 1 and 2 are relative to BASE_1, while
> > START/END 3 are relative to BASE_2.
> >
> > Currently gdb does not correctly parse this DWARF, resulting in
> > corrupted address range information.  This commit fixes this issue, and
> > adds a new test to cover this case.
> >
> > gdb/ChangeLog:
> >
> > 	* dwarf2read.c (dwarf2_ranges_read): Unify and fix base address
> > 	reading code.
> >
> > gdb/testsuite/ChangeLog:
> >
> > 	* gdb.arch/amd64-debug-ranges-base.c: New file.
> > 	* gdb.arch/amd64-debug-ranges-base.exp: New file.
> > 	* gdb.arch/amd64-debug-ranges-base.s: New file.
> 
> Hi.
> 
> The code patch is fine with me, nice find.
> 
> IWBN to enhance the dwarf assembler (testsuite/lib/dwarf.exp)
> to handle .debug_ranges. The more we get away from checking in
> generated assembler the better.
> Can do?
> If not, I'll volunteer to take that on, but I can't promise to
> get to it this week. .debug_ranges is pretty simple so I think(!)
> this will be easy.

This was absolutely my first thought too, and I even stated working on
exactly this feature.

I got the .debug_ranges table generation to a reasonable state, but
then I needed more features from the .debug_line table generator, but
I ran out of time....

Anyway, you can find the initial work I did here:
  https://github.com/T-J-Teru/binutils-gdb/commits/gdb-dwarf-ranges

that branch doesn't contain the fix, just the initial work on writing
a test to expose the bug.  Feel free to take any code out of that
branch if it is useful to you.

> [Though if we go with the generated assembler, take out the 3 in -g3.
> I mention this more for completeness sake though, as I'd really like
> to see if we can do this with the dwarf assembler first.]

I'd rather not push the fix without a test, and I don't think you're
approving the current test, so...

I'll hopefully get more time to work on this next month, if I don't
get approval for the current patch before then I'll return to working
on the dwarf assembler style testing.

Thanks for the review,
Andrew


  reply	other threads:[~2015-10-26 10:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16 12:54 Andrew Burgess
2015-10-26  3:49 ` Doug Evans
2015-10-26 12:55   ` Andrew Burgess [this message]
2015-11-03 10:35 ` [PATCH v2] " Andrew Burgess
2015-11-25 10:54   ` PING: " Andrew Burgess
2015-12-09 12:42   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151026100317.GC23628@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=xdje42@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox