Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Fix "break foo" when `foo's prologue ends before line	table
Date: Mon, 11 May 2009 18:21:00 -0000	[thread overview]
Message-ID: <83zldjxzzr.fsf@gnu.org> (raw)
In-Reply-To: <20090511125644.GD14773@adacore.com>

> Date: Mon, 11 May 2009 14:56:44 +0200
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb-patches@sourceware.org
> 
> Regardless of that, however, we should really look at what
> "break FUNCTION" is supposed to be doing. And looking at the doc,
> it says: ``Specifies the line that begins the body of the function''
> (this matches what I thought it should be doing intuitively).
> So, regardless of what GDB should be doing in terms of prologue
> analysis, I think we should still try to find the first line
> as you're doing in your patch.

Thanks for the feedback.  That's two in favor, none against. ;-)

> > +  ALL_PSYMTABS (objfile, p)
> > +    {
> > +      if (FILENAME_CMP (symtab->filename, p->filename) != 0)
> > +	continue;
> > +      PSYMTAB_TO_SYMTAB (p);
> > +    }
> > +
> > +  /* Loop over all symtabs for the function's file, looking for an
> > +     entry in a lineinfo table whose PC is in the range
> > +     [FUNC_START..FUNC_END] and whose line number is the smallest.  */
> > +  ALL_SYMTABS (objfile, s)
> 
> I am wondering if this looping over all PSYMTAB and SYMTABs is really
> necessary. Is the symtab associated to your symbol not sufficient?

I must admit that I have only a very basic knowledge of symbol tables.
In particular, I'm only vaguely familiar with the possible intricacies
of symtabs in the presence of included files and such likes.  I simply
saw that find_line_symtab, which does a similar job, loops like that,
so I used the same paradigm.

> Also, instead of returning the line whose number is the smallest,
> I would return the smallest PC, as we're trying to skip the minimum
> before inserting the breakpoint.

But the smallest PC could come from some source line that is further
down in the function's body, source-wise, if the compiler rearranged
code, couldn't it?  What I'm trying to do is find the first source
line of the body of the function, not the first PC of the body.  I
think the former is more in line with the semantics of "break FOO".

> This means that your iteration on the line table can stop as soon as
> you've found a non-zero line that's inside your function address
> range.

Is it guaranteed that the line table is always sorted by PC?


  reply	other threads:[~2009-05-11 18:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-09 14:26 Eli Zaretskii
2009-05-11 12:56 ` Joel Brobecker
2009-05-11 18:21   ` Eli Zaretskii [this message]
2009-05-11 19:27     ` Joel Brobecker
2009-05-11 20:49       ` Eli Zaretskii
2009-05-11 21:20         ` Daniel Jacobowitz
2009-05-12  3:13           ` Eli Zaretskii
2009-05-11 21:28         ` Joel Brobecker
2009-05-16 11:18         ` Eli Zaretskii
2009-05-20 23:07           ` Joel Brobecker
2009-05-23 10:20             ` Eli Zaretskii
2009-05-25  7:26               ` Joel Brobecker
2009-05-11 19:42 ` Daniel Jacobowitz
2009-05-11 20:40   ` Eli Zaretskii
2009-05-11 21:19     ` Joel Brobecker
2009-05-12  3:09       ` Eli Zaretskii

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=83zldjxzzr.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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