Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: Bernd Edlinger <bernd.edlinger@hotmail.de>, gdb-patches@sourceware.org
Cc: Kevin Buettner <kevinb@redhat.com>
Subject: Re: [PATCHv2] gdb: handle DW_AT_entry_pc pointing at an empty sub-range
Date: Mon, 02 Dec 2024 10:53:35 +0000	[thread overview]
Message-ID: <87wmgijqz4.fsf@redhat.com> (raw)
In-Reply-To: <DU2PR08MB10263D6A34C892987493BC83BE42A2@DU2PR08MB10263.eurprd08.prod.outlook.com>

Bernd Edlinger <bernd.edlinger@hotmail.de> writes:

> Hi Andrew,
>
> On 11/28/24 18:44, Andrew Burgess wrote:
>> Bernd,
>> 
>> Here's a v2 with an extended DWARF assembler test that now includes a
>> line table in some cases.  Specifically, when I test with label foo_6,
>> the address which is the end of a sub-range, which is also the end of
>> the entire block range, then I add a line table which indicates that
>> this address is the transition back from an inline function to the
>> outer function.
>> 
>
> Respect!
>
>
>> I've tested this with your series merge on top of this patch, and,
>> with your modified block lookup logic in place, and with the 'addr <
>> block->end ()' changed to 'addr <= block->end ()' in
>> dwarf2_addr_in_block_ranges (as well as in block::set_entry_pc) GDB is
>> able to stop at the foo_6 label.
>> 
>> I think you were OK with the v1 patch being merged, but I'll give you
>> some time to comment on the updated test.  If you're happy with this
>> then I'll get this merged.
>> 
>
> Yes, I am OK with the v1 patch to be merged now.

Great.  I pushed this patch.

>
>> Thanks,
>> Andrew
>> 
>
> P.S: As I was pretty busy the last days, I have not been able to
> give the requested data earlier, so here I have the line table of the
> step-and-next-inline-no-header, compiled with gcc-9.4.0:
>
> $ readelf -w step-and-next-inline-no-header
> [...]
>  <2><8d6>: Abbrev Number: 38 (DW_TAG_inlined_subroutine)
>     <8d7>   DW_AT_abstract_origin: <0x9c7>
>     <8db>   DW_AT_entry_pc    : 0x1189
>     <8e3>   DW_AT_GNU_entry_view: 0
>     <8e4>   DW_AT_ranges      : 0x30
> [...]
>     00000030 0000000000001189 0000000000001189 (start == end)
>     00000030 000000000000118d 0000000000001197
>     00000030 0000000000001060 0000000000001065
>     00000030 <End of list>
> [...]
>
> so the intersting end pc values are 0x1189 0x1197 and 0x1065.
>
> $ readelf -wL step-and-next-inline-no-header
> File name                        Line number    Starting address    View    Stmt
> [...]
> step-and-next-inline.cc                   54              0x1184       1
> step-and-next-inline.cc                   38              0x1189               x  -->+
> step-and-next-inline.cc                   40              0x1189       1       x     |
> step-and-next-inline.cc                   50              0x1189       2          <--+
> step-and-next-inline.cc                   40              0x118d        
> step-and-next-inline.cc                   40              0x118f        
> step-and-next-inline.cc                   42              0x1197               x  -->+
> step-and-next-inline.cc                   43              0x1197       1       x     |
> step-and-next-inline.cc                   43              0x1197       2             |
> step-and-next-inline.cc                   52              0x1197       3          <--+
> step-and-next-inline.cc                   52              0x119a        
> [...]
> step-and-next-inline.cc                   41              0x1060       1
> step-and-next-inline.cc                   41              0x1065        
> step-and-next-inline.cc                    -              0x1065        
>
> So we have most of the time one or two statement lines,
> followed by one or more non-statement lines at the end_pc, these
> statement lines are considered to be weak.  When we have a breakpoint
> there it should show the program stepping out of the inline to the
> calling function.
>
> Then we have the third line, which is a non-statement line followed
> by an end marker at the same pc, we usually ignore those, because they
> are unreachable, in this case after the abort(), and could easily be
> the beginning of the next function.  If we happen to have a breakpoint
> at this pc value, we should never consider any sub-range from the
> function before.  And a breakpoint there should show that we just
> entered the function.

Thanks for the details, and the analysis.

Thanks,
Andrew


      reply	other threads:[~2024-12-02 10:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-20 15:01 [PATCH] " Andrew Burgess
2024-11-20 21:00 ` Kevin Buettner
2024-11-21 13:21 ` Bernd Edlinger
2024-11-22 16:53   ` Andrew Burgess
2024-11-22 22:57     ` Bernd Edlinger
2024-11-25 14:30       ` Andrew Burgess
2024-11-26 12:35         ` Bernd Edlinger
2024-11-26 17:48           ` Andrew Burgess
2024-11-27 20:12             ` Bernd Edlinger
2024-11-28 10:10               ` Andrew Burgess
2024-11-28 17:44 ` [PATCHv2] " Andrew Burgess
2024-11-29 14:19   ` Bernd Edlinger
2024-12-02 10:53     ` Andrew Burgess [this message]

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=87wmgijqz4.fsf@redhat.com \
    --to=aburgess@redhat.com \
    --cc=bernd.edlinger@hotmail.de \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.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