Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <Michael.Snyder@palmsource.com>
To: Jim Blandy <jimb@codesourcery.com>
Cc: Joel Brobecker <brobecker@adacore.com>, gdb@sourceware.org
Subject: Re: Breaking on C labels?
Date: Fri, 26 Jan 2007 00:05:00 -0000	[thread overview]
Message-ID: <1169767203.22601.128.camel@localhost.localdomain> (raw)
In-Reply-To: <m3zm86yfc1.fsf@codesourcery.com>

On Thu, 2007-01-25 at 13:19 -0800, Jim Blandy wrote:
> Joel Brobecker <brobecker@adacore.com> writes:
> > A customer asked us a question about the ability of breaking on labels
> > inside C code. Consider for instance:
> >
> >         void
> >         procedure foo (void)
> >         {
> >            [...]
> >         error_handler:
> >            [...]
> >         }
> >
> > The customer asked if it was possible to break at the error_handler
> > label. We are helping them with finding alternative solutions, but
> > I still did a bit of researching...
> >
> > I discovered without much surprise that DWARF does indeed have provision
> > for labels (DW_TAG_label). However, I also noticed that GCC already
> > generates the associated DIEs. We actually even process them. However,
> > all my attempts in trying to reference them from the debugger failed.
> > I tried "break error_handler", or more simply "p error_handler", etc.
> >
> > Did we ever make any attempt in implementing this sort of functionality
> > in the past?
> >
> > Looking at the source code, I found in new_symbol ():
> >
> >         case DW_TAG_label:
> >           attr = dwarf2_attr (die, DW_AT_low_pc, cu);
> >           if (attr)
> >             {
> >               SYMBOL_VALUE_ADDRESS (sym) = DW_ADDR (attr) + baseaddr;
> >             }
> >           SYMBOL_CLASS (sym) = LOC_LABEL;
> >           break;
> >
> > So we setup the symbol, but we don't add to any of our symbol lists...
> > I am left wondering what it is that we'll be doing with this symbol.
> 
> You're right, it looks to me as if we just throw the symbol away, too.
> 
> The logical thing would be to put it in the block of the function it's
> in, since goto labels are block-scoped.  It would go in LABEL_DOMAIN,
> since that's a separate namespace.  And then you'd need to teach
> linespec.[ch] about them.

There's a risk that some symbol-lookup function would then select that
label instead of the function entry label when you tried to look up the
nearest label preceeding a given address.



  reply	other threads:[~2007-01-26  0:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-25 19:48 Joel Brobecker
2007-01-25 21:19 ` Jim Blandy
2007-01-26  0:05   ` Michael Snyder [this message]
2007-01-26  1:01     ` Joel Brobecker
2007-01-26 18:55     ` Jim Blandy
2007-01-26 19:41       ` Michael Snyder
2007-01-26 21:04         ` Jim Blandy

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=1169767203.22601.128.camel@localhost.localdomain \
    --to=michael.snyder@palmsource.com \
    --cc=brobecker@adacore.com \
    --cc=gdb@sourceware.org \
    --cc=jimb@codesourcery.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