Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <xdje42@gmail.com>
To: Pierre-Marie de Rodat <derodat@adacore.com>
Cc: Kevin Buettner <kevinb@redhat.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH] Add proper handling for non-local references in nested functions
Date: Sun, 26 Jul 2015 17:39:00 -0000	[thread overview]
Message-ID: <m37fpmzumt.fsf@sspiff.org> (raw)
In-Reply-To: <55B215A8.1000609@adacore.com> (Pierre-Marie de Rodat's message	of "Fri, 24 Jul 2015 12:38:32 +0200")

Pierre-Marie de Rodat <derodat@adacore.com> writes:
> On 07/23/2015 08:22 PM, Kevin Buettner wrote:
>> I came across something else (for someone) to ponder while playing with
>> the above code.  I don't necessarily expect your current patch to handle
>> this case, but since you've been looking at nested subprograms, you may
>> have some insight into what's happening.
>>
>> The situation is that I want to place a breakpoint on the function p().
>> How do I do this?
>
>> 1) Placing a breakpoint on p without qualification does not work:
>>
>> (gdb) b p
>> Function "p" not defined.
>> Make breakpoint pending on future shared library load? (y or [n]) n
>
> For the record, this works in Ada:
>
> --  foo.adb
> procedure Foo is
>    procedure Nested is
>    begin
>       null;
>    end Nested;
> begin
>    Nested;
> end Foo;
>
> # Program isn't even started.
> (gdb) b nested
> Breakpoint 1 at 0x401cca: file foo.adb, line 4.
>
> Bottom line is: the difference between the C and the Ada examples
> resides in the partial symbols lookup: in the C example, only the
> outer function has a partial symbol while in the Ada example, Nested
> has one too. Why? Well, in dwarf2read.c:add_partial_subprogram there's
> a special case for Ada that recurses over the child DIE. Stopping
> investigation here. ;-)

Yeah, I can imagine that this is at least part of the reason.
We need to be as lazy as possible when reading partial syms
as it's a serious perf issue. OTOH sometimes we're too lazy
and then some things don't work.

Requiring hyperfast reading of partial syms is becoming
less important now that we have .gdb_index and soon something
in the DWARF standard. So I'm working on being more complete
in the partial sym reader.

>> 4) Perhaps p will be visible if we run to a breakpoint in main?  (Nope.)
>>
>> (gdb) b main
>> Breakpoint 1 at 0x400525: file nested.c, line 5.
>> (gdb) run
>> Starting program: /mesquite2/.ironwood2/1158876/nested
>
> I had a quick look at how breakpoints resolution works: it sems that
> lookups don't take into account the block corresponding to the
> selected frame. So trying to put the breakpoint during execution looks
> pointless.

Yeah. We could probably do better here.


  reply	other threads:[~2015-07-26 17:39 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02 14:36 [PATCH] Add proper handling for non-local references in nested subprograms Pierre-Marie de Rodat
2015-03-10 15:26 ` Pedro Alves
2015-03-20 12:24   ` [PATCH] Add proper handling for non-local references in nested functions Pierre-Marie de Rodat
2015-05-29 12:28     ` Pedro Alves
2015-06-09 21:46       ` Pierre-Marie de Rodat
2015-07-22  9:16         ` Pierre-Marie de Rodat
2015-07-22 14:26           ` Doug Evans
2015-07-22 15:14             ` Pierre-Marie de Rodat
2015-07-26 17:28               ` Doug Evans
2015-07-22 17:58             ` Kevin Buettner
2015-07-23  1:36           ` Kevin Buettner
2015-07-23 10:44             ` Pierre-Marie de Rodat
2015-07-23 13:44               ` Kevin Buettner
2015-07-23 16:14                 ` Pierre-Marie de Rodat
2015-07-23 17:22                   ` Kevin Buettner
2015-07-23 17:33                     ` Pierre-Marie de Rodat
2015-07-23 17:51                       ` Kevin Buettner
2015-07-23 18:06                   ` Kevin Buettner
2015-07-23 18:23                     ` Kevin Buettner
2015-07-24 10:38                       ` Pierre-Marie de Rodat
2015-07-26 17:39                         ` Doug Evans [this message]
2015-07-24  9:26                     ` Pierre-Marie de Rodat
2015-07-26 20:35               ` Doug Evans
2015-07-31 10:53                 ` Pierre-Marie de Rodat
2015-08-10  8:34                   ` Pierre-Marie de Rodat
2015-08-13 15:03                     ` Doug Evans
2015-08-14  6:31                       ` Pierre-Marie de Rodat
2015-08-15  5:12                   ` Doug Evans
2015-08-15  6:21                     ` Doug Evans
2015-08-17 13:27                       ` Pierre-Marie de Rodat
2015-08-17 13:33                     ` Pierre-Marie de Rodat
2015-08-22 17:30                       ` Doug Evans
2015-08-25 12:14                         ` Pierre-Marie de Rodat
2015-09-02 23:50                       ` Joel Brobecker
2015-09-03  7:31                         ` Pierre-Marie de Rodat
2015-09-03 12:40                           ` Joel Brobecker
2015-09-03 14:03                             ` Pierre-Marie de Rodat
2015-09-16 16:16                         ` Doug Evans
2015-09-20 18:20                           ` pushed: " Joel Brobecker
2015-08-15  5:13                   ` Doug Evans

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=m37fpmzumt.fsf@sspiff.org \
    --to=xdje42@gmail.com \
    --cc=derodat@adacore.com \
    --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