This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Question regarding setting breakpoints on 'C' labels and the handling of DW_TAG_label in new_symbol() in dwarf2read.c.


Hello,

I was trying to set a breakpoint on a 'C' label in gdb and when I could
not do it I tried to find out why.  I noticed a few things and had a few
questions.

My compiler generates DWARF debug information.  In new_symbol() in
dwarf2read.c, it looks like the symbol created for a label (specified
with
DW_TAG_label) is never entered into the symbol table.  Was this
intentional or is there just a missing call to add_symbol_to_list() for
this case?

I got past that problem by making the call to add_symbol_to_list(), but
again, when I tried to set the breakpoint on the label, I got the error 
"<label-name> is not a function".  Looking at the gdb 6.2 sources, it
looks like this error is coming from symbol_found() in linespec.c.  The
code that is producing the error is the following:

  if (SYMBOL_CLASS (sym) == LOC_BLOCK)
    { ... }
  else
   {
     if (funfirstline)
       error ("\"%s\" is not a function", copy);
     ...

It looks like the intention of funfirstline is to specify that the
breakpoint should be set at the first real line of the function, but for
labels, this probably does not make sense.  

Would it be possible to make a check for (SYMBOL_CLASS (sym) !=
LOC_LABEL) in addition to checking funfirstline before issuing the error
or is there a better way to handle labels?

Thanks so much!

Reva Cuthbertson
reva.cuthbertson@hp.com




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]