This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: allow gas to emit duplicate line numbers
- From: Geoff Keating <geoffk at geoffk dot org>
- To: sue_ludwig at hp dot com
- Cc: binutils at sources dot redhat dot com, ipdl-tools-gnu at cup dot hp dot com, msnyder at redhat dot com, nickc at cambridge dot redhat dot com
- Date: Fri, 16 Aug 2002 17:17:44 -0700
- Subject: Re: allow gas to emit duplicate line numbers
- References: <000801c24580$661fdd90$ce60000f@HPPDL632>
- Reply-to: Geoff Keating <geoffk at redhat dot com>
> From: "Sue Ludwig" <sue_ludwig@hp.com>
> Cc: <ipdl-tools-gnu@cup.hp.com>, <geoffk@redhat.com>, <msnyder@redhat.com>,
> <nickc@cambridge.redhat.com>
> Date: Fri, 16 Aug 2002 16:55:27 -0700
> Hi,
>
> I have discovered another problem with using --gdwarf2. Take the test case:
> #include <stdio.h>
> int main() {
> return 0;
> }
>
> Using the compile command on Linux/IPF or HPUX/IPF:
> gcc -g -Wa,--gdwarf2 main.c
> Produces the error:
> /tmp/cc0rD6Kk.s: Assembler messages:
> /tmp/cc0rD6Kk.s:30: Error: file number 2 already allocated
This is because you're trying to generate line numbers from both the C
sources and from the assembler intermediate code. This of course
causes conflicts.
> > 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.
Yes. When GCC emits duplicate line numbers, GAS must output them.
> > 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?
No. That would effectively revert the previous patch, and
re-introduce the problem it fixed.
> > 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?
That would be a GCC issue. The question of whether a particular line
number does or doesn't correspond to a statement is known only to the
compiler.
However, it's not clear that it's correct to say that the duplicate
line number doesn't correspond to a statement.
> > 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.
The point of DEBUG_DWARF2 is exactly that the line information is
based on the assembler 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?
See answer to (3).
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>