Mathieu Lacage - Re: dwarf2 basic block start information (original) (raw)

This is the mail archive of the gcc@gcc.gnu.orgmailing list for the GCC 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]

Here is an updated version with a few bugs fixed (How I managed to introduce bugs in a 20-liner patch still eludes me).

On Mon, 2005-11-14 at 21:26 -0500, Daniel Jacobowitz wrote:

On Mon, Nov 14, 2005 at 06:24:47PM -0800, Jim Wilson wrote:

mathieu lacage wrote:

Clearly, 0x11 is not a bb boundary so we have a bug.

Looks like it could be the prologue end, but I don't see any obvious reason why this patch could do that. I suggest you try debugging your patch to see why you are getting the extra call with LINE_FLAG_BASIC_BLOCK set in this case.

Using -p would make the diff more readable.

svn diff -x -p does not work here. Is there a magic incantation I should run to produce such a diff ?

We get complaints every time the debug info size increases. Since this is apparently only helpful to an optional utility, this extra debug info should not be emitted by default. There should be an option to emit it.

Any suggestion on a name ?

I'd like to know what the size impact of including basic block information would be, first; a lot of tools, including GDB, could make use of it if it were available.

linux-2.6.14 stock default config. size of dw2 .debug_line section: without patch: 1433756 with patch: 1557345

Out of curiosity, I wonder what gdb would use it for.

regards, Mathieu

Index: gcc/final.c

--- gcc/final.c (revision 106485) +++ gcc/final.c (working copy) @@ -129,6 +129,8 @@ static rtx debug_insn; rtx current_output_insn; +int current_start_basic_block = 0; + /* Line number of last NOTE. */ static int last_linenum; @@ -1744,6 +1746,7 @@ else seen |= SEEN_BB; + current_start_basic_block = 1; break; case NOTE_INSN_EH_REGION_BEG: @@ -2067,11 +2070,26 @@ break; } + + / Output this line note if it is the first or the last line note in a row. */ if (notice_source_line (insn)) { - (*debug_hooks->source_line) (last_linenum, last_filename); + if (current_start_basic_block) + { + current_start_basic_block = 0; + (*debug_hooks->source_line) (last_linenum, last_filename, LINE_FLAG_BASIC_BLOCK); + } + else + { + (*debug_hooks->source_line) (last_linenum, last_filename, 0); + } + } + else if (current_start_basic_block) + { + current_start_basic_block = 0; + (*debug_hooks->source_line) (insn_line (insn), insn_file (insn), LINE_FLAG_BASIC_BLOCK); } if (GET_CODE (body) == ASM_INPUT) @@ -2498,6 +2516,7 @@ current_output_insn = debug_insn = 0; } } + return NEXT_INSN (insn); } Index: gcc/debug.c

--- gcc/debug.c (revision 106485) +++ gcc/debug.c (working copy) @@ -33,7 +33,7 @@ debug_nothing_int_int, /* begin_block / debug_nothing_int_int, / end_block / debug_true_tree, / ignore_block / - debug_nothing_int_charstar, / source_line / + debug_nothing_int_charstar_int, / source_line / debug_nothing_int_charstar, / begin_prologue / debug_nothing_int_charstar, / end_prologue / debug_nothing_int_charstar, / end_epilogue */ @@ -94,6 +94,13 @@ } void +debug_nothing_int_charstar_int (unsigned int line ATTRIBUTE_UNUSED, + const char *text ATTRIBUTE_UNUSED, + unsigned int flags ATTRIBUTE_UNUSED) +{ +} + +void debug_nothing_int (unsigned int line ATTRIBUTE_UNUSED) { } Index: gcc/debug.h

--- gcc/debug.h (revision 106485) +++ gcc/debug.h (working copy) @@ -59,7 +59,7 @@ bool (* ignore_block) (tree); /* Record a source file location at (FILE, LINE). / - void ( source_line) (unsigned int line, const char file); + void ( source_line) (unsigned int line, const char file, unsigned int flags); / Called at start of prologue code. LINE is the first line in the function. This has been given the same prototype as source_line, @@ -129,12 +129,16 @@ int start_end_main_source_file; }; + +#define LINE_FLAG_BASIC_BLOCK ((unsigned int)1) + extern const struct gcc_debug_hooks debug_hooks; / The do-nothing hooks. */ extern void debug_nothing_void (void); extern void debug_nothing_charstar (const char *); extern void debug_nothing_int_charstar (unsigned int, const char *); +extern void debug_nothing_int_charstar_int (unsigned int, const char *, unsigned int flags); extern void debug_nothing_int (unsigned int); extern void debug_nothing_int_int (unsigned int, unsigned int); extern void debug_nothing_tree (tree); Index: gcc/dwarf2out.c

--- gcc/dwarf2out.c (revision 106485) +++ gcc/dwarf2out.c (working copy) @@ -69,7 +69,7 @@ #include "input.h"

#ifdef DWARF2_DEBUGGING_INFO -static void dwarf2out_source_line (unsigned int, const char *); +static void dwarf2out_source_line (unsigned int, const char *, unsigned int flags); #endif

/* DWARF2 Abbreviation Glossary: @@ -2510,7 +2510,7 @@ prologue case, not the eh frame case. */ #ifdef DWARF2_DEBUGGING_INFO if (file)

#endif }

@@ -13534,7 +13534,7 @@ 'line_info_table' for later output of the .debug_line section. */

static void -dwarf2out_source_line (unsigned int line, const char *filename) +dwarf2out_source_line (unsigned int line, const char *filename, unsigned int flags) { if (debug_info_level >= DINFO_LEVEL_NORMAL && line != 0) @@ -13553,7 +13553,14 @@ file_num = maybe_emit_file (file_num);

   /* Emit the .loc directive understood by GNU as.  */

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