Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: Xavier Roirand <roirand@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [RFA/DWARF v2] Fix breakpoint add on inlined function using function name.
Date: Fri, 22 Dec 2017 02:59:00 -0000	[thread overview]
Message-ID: <20171222025853.emffsrqu5sdt5bw2@adacore.com> (raw)
In-Reply-To: <749a54992d7a966c56f7f79c939394b8@polymtl.ca>

> Why doesn't the same happen in the Ada case?  The debug info in the Ada
> program looks similar, so a partial symbol should be created for this DIE:
> 
>  <1><77b>: Abbrev Number: 2 (DW_TAG_subprogram)
>     <77c>   DW_AT_external    : 1
>     <77c>   DW_AT_name        : (indirect string, offset: 0xae3):
> b__read_small
>     <780>   DW_AT_decl_file   : 2
>     <781>   DW_AT_decl_line   : 3
>     <782>   DW_AT_inline      : 3       (declared as inline and inlined)
> 
> Then, when we set the breakpoint, I would expect GDB to find the partial
> symbol for read_small in this objfile, expand it to full symbols, and then
> find the inlined instance, just as it does for C.  That's the difference I
> don't get.

That's the abstract instance of the inlined subprogram. You might
notice that it has a DW_AT_inline attribute, and nothing else.
This DIE is there as the parent for the DIE(s) that represent
the instance(s) where the function was actually inlined:

 <2><1547>: Abbrev Number: 4 (DW_TAG_inlined_subroutine)
    <1548>   DW_AT_abstract_origin: <0x1526>
    <154c>   DW_AT_low_pc      : 0x402552
    <1554>   DW_AT_high_pc     : 0x2b
    <155c>   DW_AT_call_file   : 1
    <155d>   DW_AT_call_line   : 5

This DIE is the one that represents one concrete instance
of the inlined function. You can see that it has a
DW_AT_abstract_origin attribute which points to the abstract
instance (so we can "inherit" some of the attributes that
are common to all concrete instances), and then the attributes
specific to this inlined instance, such as location, and
more important of all, the low/high_pc.

-- 
Joel


  reply	other threads:[~2017-12-22  2:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20 13:23 Xavier Roirand
2017-12-21  2:35 ` Simon Marchi
2017-12-21 11:03   ` Joel Brobecker
2017-12-21 22:52     ` Simon Marchi
2017-12-22  2:59       ` Joel Brobecker [this message]
2018-01-03  4:44 ` Joel Brobecker

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=20171222025853.emffsrqu5sdt5bw2@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=roirand@adacore.com \
    --cc=simon.marchi@polymtl.ca \
    /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