This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

Re: allow gas to emit duplicate line numbers


Hi,

In version 1.45 of dwarf2dbg.c, the function dwarf2_gen_line_info has the
following code:
  if (debug_type == DEBUG_DWARF2
      && line == loc->line && filenum == loc->filenum)
    return;

This use to be:
  if (line == loc->line && filenum == loc->filenum)
    return;

I see from the emails and cvs that this change was done so that duplicate
line symbols are emitted for GDB to determine the end of the prolog.

On HPUX on IPF, duplicate line symbols will confuse GDB unless they are
flagged as not statements, i.e. DW_LNS_negate_stmt is emitted for the
duplicate lines.  When these duplicate lines are flagged as statements, GDB
thinks that the prolog ends before it actually does.

I could bypass this change by setting the debug_type to equal DEBUG_DWARF2,
by passing --gdwarf2 to the assembler.  However after doing this, when I set
a breakpoint, gdb uses the line numbers in the assembler file (*.s) instead
of the source file (*.c).  This is due to code in dwarf2_where (or line 263
of dwarf2dbg.c), where instead of *line = current the other code is
executed.  This occurs in Linux on IPF as well.

Another problem with passing --gdwarf to the assembler on HPUX on IPF is the
offsets into some sections are calculated incorrectly.  The code is in
dwarf2_finish (or line 1273 of dwarf2dbg.c).  Again code within the if
(all_segs != NULL && debug_type == DEBUG_DWARF2) is executed.  Some of the
errors that I'm seeing when using gdb on the executable are:
a. Dwarf Error: bad offset (0xa8) in compilation unit header (offset 0x65 +
6)
b. the offset in DW_FORM_strp is past the end of the .debug_str section.

Note: The code in dwarf2_where and dwarf2_finish were added in version 1.20
of dwarf2dbg.c.

My questions are:
1. Can the code change in version 1.45 be done differently so that when
debug_type == DEBUG_UNSPECIFIED, the return will occur, as it does for
DEBUG_DWARF2?

If not, can the following be done:

2. Can DW_LNS_negate_stmt be generated for the duplicate lines allowed in
the prolog when debug_type != DEBUG_DWARF2?

3. Code in dwarf2_where be modified so that *line = current even when
debug_type == DEBUG_DWARF2?  Otherwise the line information is based on the
assembler file and not the source file.

4. If we are not putting in the line generated by the assembler in the line
table when debug_type == DEBUG_DWARF2, why are we putting in assembler
generated information in the .debug_info and .debug_abbrev sections in
dwarf2_finish?

Regards,
Sue Ludwig


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