Commit 2f22d404 by Jason Merrill Committed by Jason Merrill

dwarf2out.c (output_line_info): Don't emit redundant info.

	* dwarf2out.c (output_line_info): Don't emit redundant info.
	Do start a new row if the file changes and the line # doesn't.

From-SVN: r26061
parent 9af3a23b
Tue Mar 30 00:26:34 1999 Jason Merrill <jason@yorick.cygnus.com>
* dwarf2out.c (output_line_info): Don't emit redundant info.
Do start a new row if the file changes and the line # doesn't.
Mon Mar 29 15:48:39 1999 Jason Merrill <jason@yorick.cygnus.com> Mon Mar 29 15:48:39 1999 Jason Merrill <jason@yorick.cygnus.com>
* invoke.texi (Invoking G++, C++ Dialect Options): Update. * invoke.texi (Invoking G++, C++ Dialect Options): Update.
......
...@@ -4826,14 +4826,15 @@ size_of_line_info () ...@@ -4826,14 +4826,15 @@ size_of_line_info ()
/* Prolog. */ /* Prolog. */
size += size_of_line_prolog (); size += size_of_line_prolog ();
/* Set address register instruction. */
size += size_of_set_address;
current_file = 1; current_file = 1;
current_line = 1; current_line = 1;
for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index) for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index)
{ {
register dw_line_info_ref line_info; register dw_line_info_ref line_info = &line_info_table[lt_index];
if (line_info->dw_line_num == current_line
&& line_info->dw_file_num == current_file)
continue;
/* Advance pc instruction. */ /* Advance pc instruction. */
/* ??? See the DW_LNS_advance_pc comment in output_line_info. */ /* ??? See the DW_LNS_advance_pc comment in output_line_info. */
...@@ -4842,7 +4843,6 @@ size_of_line_info () ...@@ -4842,7 +4843,6 @@ size_of_line_info ()
else else
size += size_of_set_address; size += size_of_set_address;
line_info = &line_info_table[lt_index];
if (line_info->dw_file_num != current_file) if (line_info->dw_file_num != current_file)
{ {
/* Set file number instruction. */ /* Set file number instruction. */
...@@ -4886,6 +4886,12 @@ size_of_line_info () ...@@ -4886,6 +4886,12 @@ size_of_line_info ()
{ {
register dw_separate_line_info_ref line_info register dw_separate_line_info_ref line_info
= &separate_line_info_table[lt_index]; = &separate_line_info_table[lt_index];
if (line_info->dw_line_num == current_line
&& line_info->dw_file_num == current_file
&& line_info->function == function)
goto cont;
if (function != line_info->function) if (function != line_info->function)
{ {
function = line_info->function; function = line_info->function;
...@@ -4928,6 +4934,7 @@ size_of_line_info () ...@@ -4928,6 +4934,7 @@ size_of_line_info ()
} }
} }
cont:
++lt_index; ++lt_index;
/* If we're done with a function, end its sequence. */ /* If we're done with a function, end its sequence. */
...@@ -5834,18 +5841,9 @@ output_line_info () ...@@ -5834,18 +5841,9 @@ output_line_info ()
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0); ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0);
fputc ('\n', asm_out_file); fputc ('\n', asm_out_file);
/* Set the address register to the first location in the text section */ /* We used to set the address register to the first location in the text
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0); section here, but that didn't accomplish anything since we already
if (flag_debug_asm) have a line note for the opening brace of the first function. */
fprintf (asm_out_file, "\t%s DW_LNE_set_address", ASM_COMMENT_START);
fputc ('\n', asm_out_file);
output_uleb128 (1 + PTR_SIZE);
fputc ('\n', asm_out_file);
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNE_set_address);
fputc ('\n', asm_out_file);
ASM_OUTPUT_DWARF_ADDR (asm_out_file, text_section_label);
fputc ('\n', asm_out_file);
/* Generate the line number to PC correspondence table, encoded as /* Generate the line number to PC correspondence table, encoded as
a series of state machine operations. */ a series of state machine operations. */
...@@ -5854,7 +5852,14 @@ output_line_info () ...@@ -5854,7 +5852,14 @@ output_line_info ()
strcpy (prev_line_label, text_section_label); strcpy (prev_line_label, text_section_label);
for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index) for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index)
{ {
register dw_line_info_ref line_info; register dw_line_info_ref line_info = &line_info_table[lt_index];
/* Don't emit anything for redundant notes. Just updating the
address doesn't accomplish anything, because we already assume
that anything after the last address is this line. */
if (line_info->dw_line_num == current_line
&& line_info->dw_file_num == current_file)
continue;
/* Emit debug info for the address of the current line, choosing /* Emit debug info for the address of the current line, choosing
the encoding that uses the least amount of space. */ the encoding that uses the least amount of space. */
...@@ -5898,7 +5903,6 @@ output_line_info () ...@@ -5898,7 +5903,6 @@ output_line_info ()
/* Emit debug info for the source file of the current line, if /* Emit debug info for the source file of the current line, if
different from the previous line. */ different from the previous line. */
line_info = &line_info_table[lt_index];
if (line_info->dw_file_num != current_file) if (line_info->dw_file_num != current_file)
{ {
current_file = line_info->dw_file_num; current_file = line_info->dw_file_num;
...@@ -5916,35 +5920,48 @@ output_line_info () ...@@ -5916,35 +5920,48 @@ output_line_info ()
/* Emit debug info for the current line number, choosing the encoding /* Emit debug info for the current line number, choosing the encoding
that uses the least amount of space. */ that uses the least amount of space. */
line_offset = line_info->dw_line_num - current_line; if (line_info->dw_line_num != current_line)
line_delta = line_offset - DWARF_LINE_BASE;
current_line = line_info->dw_line_num;
if (line_delta >= 0 && line_delta < (DWARF_LINE_RANGE - 1))
{ {
/* This can handle deltas from -10 to 234, using the current line_offset = line_info->dw_line_num - current_line;
definitions of DWARF_LINE_BASE and DWARF_LINE_RANGE. This line_delta = line_offset - DWARF_LINE_BASE;
takes 1 byte. */ current_line = line_info->dw_line_num;
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, if (line_delta >= 0 && line_delta < (DWARF_LINE_RANGE - 1))
DWARF_LINE_OPCODE_BASE + line_delta); {
if (flag_debug_asm) /* This can handle deltas from -10 to 234, using the current
fprintf (asm_out_file, definitions of DWARF_LINE_BASE and DWARF_LINE_RANGE. This
"\t%s line %ld", ASM_COMMENT_START, current_line); takes 1 byte. */
ASM_OUTPUT_DWARF_DATA1 (asm_out_file,
DWARF_LINE_OPCODE_BASE + line_delta);
if (flag_debug_asm)
fprintf (asm_out_file,
"\t%s line %ld", ASM_COMMENT_START, current_line);
fputc ('\n', asm_out_file); fputc ('\n', asm_out_file);
}
else
{
/* This can handle any delta. This takes at least 4 bytes,
depending on the value being encoded. */
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_advance_line);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s advance to line %ld",
ASM_COMMENT_START, current_line);
fputc ('\n', asm_out_file);
output_sleb128 (line_offset);
fputc ('\n', asm_out_file);
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
fputc ('\n', asm_out_file);
}
} }
else else
{ {
/* This can handle any delta. This takes at least 4 bytes, depending /* We still need to start a new row, so output a copy insn. */
on the value being encoded. */
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_advance_line);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s advance to line %ld",
ASM_COMMENT_START, current_line);
fputc ('\n', asm_out_file);
output_sleb128 (line_offset);
fputc ('\n', asm_out_file);
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy); ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
fputc ('\n', asm_out_file); fputc ('\n', asm_out_file);
} }
} }
...@@ -5994,6 +6011,12 @@ output_line_info () ...@@ -5994,6 +6011,12 @@ output_line_info ()
register dw_separate_line_info_ref line_info register dw_separate_line_info_ref line_info
= &separate_line_info_table[lt_index]; = &separate_line_info_table[lt_index];
/* Don't emit anything for redundant notes. */
if (line_info->dw_line_num == current_line
&& line_info->dw_file_num == current_file
&& line_info->function == function)
goto cont;
/* Emit debug info for the address of the current line. If this is /* Emit debug info for the address of the current line. If this is
a new function, or the first line of a function, then we need a new function, or the first line of a function, then we need
to handle it differently. */ to handle it differently. */
...@@ -6094,10 +6117,21 @@ output_line_info () ...@@ -6094,10 +6117,21 @@ output_line_info ()
output_sleb128 (line_offset); output_sleb128 (line_offset);
fputc ('\n', asm_out_file); fputc ('\n', asm_out_file);
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy); ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
fputc ('\n', asm_out_file); fputc ('\n', asm_out_file);
} }
} }
else
{
/* We still need to start a new row, so output a copy insn. */
ASM_OUTPUT_DWARF_DATA1 (asm_out_file, DW_LNS_copy);
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s DW_LNS_copy", ASM_COMMENT_START);
fputc ('\n', asm_out_file);
}
cont:
++lt_index; ++lt_index;
/* If we're done with a function, end its sequence. */ /* If we're done with a function, end its sequence. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment