This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
mainline dwarf2 line number tweeks
- To: gcc-patches at gcc dot gnu dot org
- Subject: mainline dwarf2 line number tweeks
- From: Richard Henderson <rth at redhat dot com>
- Date: Sat, 17 Mar 2001 10:20:16 -0800
(1) If the assembler is supposed to respect the file numbers
we give it, then testing .file 0 is bogus.
(2) Oops, actually emit the .file.
(3) Tweek the order of files so that we elide a change-file directive.
r~
* dwarf2out.c (lookup_filename): Emit .file if the assembler
is generating .debug_line.
(dwarf2out_init): Add main_input_filename to the file table first.
* configure.in (as_dwarf2_debug_line): Test with file number 1
instead of file number 0.
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.501
diff -c -p -d -r1.501 configure.in
*** configure.in 2001/03/16 20:09:34 1.501
--- configure.in 2001/03/17 18:14:38
*************** then
*** 1491,1498 ****
gcc_cv_as_dwarf2_debug_line="yes"
fi
elif test x$gcc_cv_as != x -a x"$insn" != x ; then
! echo ' .file 0 "conftest.s"' > conftest.s
! echo ' .loc 0 3 0' >> conftest.s
echo " $insn" >> conftest.s
# ??? This fails with non-gnu grep.
if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
--- 1491,1498 ----
gcc_cv_as_dwarf2_debug_line="yes"
fi
elif test x$gcc_cv_as != x -a x"$insn" != x ; then
! echo ' .file 1 "conftest.s"' > conftest.s
! echo ' .loc 1 3 0' >> conftest.s
echo " $insn" >> conftest.s
# ??? This fails with non-gnu grep.
if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.253
diff -c -p -d -r1.253 dwarf2out.c
*** dwarf2out.c 2001/03/16 19:31:19 1.253
--- dwarf2out.c 2001/03/17 18:14:55
*************** lookup_filename (file_name)
*** 10723,10728 ****
--- 10723,10731 ----
file_table.in_use = i + 1;
file_table.last_lookup_index = i;
+ if (DWARF2_ASM_LINE_DEBUG_INFO)
+ fprintf (asm_out_file, "\t.file %u \"%s\"\n", i, file_name);
+
return i;
}
*************** dwarf2out_init (asm_out_file, main_input
*** 10885,10894 ****
register FILE *asm_out_file;
register const char *main_input_filename;
{
/* Remember the name of the primary input file. */
primary_filename = main_input_filename;
! init_file_table ();
/* Allocate the initial hunk of the decl_die_table. */
decl_die_table
--- 10888,10902 ----
register FILE *asm_out_file;
register const char *main_input_filename;
{
+ init_file_table ();
+
/* Remember the name of the primary input file. */
primary_filename = main_input_filename;
! /* Add it to the file table first, under the assumption that we'll
! be emitting line number data for it first, which avoids having
! to add an initial DW_LNS_set_file. */
! lookup_filename (main_input_filename);
/* Allocate the initial hunk of the decl_die_table. */
decl_die_table