http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51770
Bug #: 51770 Summary: dump gimple lineno when dumping bb Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassig...@gcc.gnu.org ReportedBy: nash11...@gmail.com Hi all, I know gcc can dump lineno information before each gimple statement. [filename : line:col] gimple statement. But it's not convenient to look, too much lineno's and no alignment again. how about dump lineno at bb level just before gimple statement when lineno changes ? # line 11 gs1 gs2 ... # line 12 ... just like dwarf debugging information format. here is example code --- gimple-pretty-print.c (revision 182877) +++ gimple-pretty-print.c (working copy) @@ -2284,6 +2284,7 @@ gimple_stmt_iterator gsi; gimple stmt; int label_indent = indent - 2; + int lineno = 0; if (label_indent < 0) label_indent = 0; @@ -2299,6 +2300,15 @@ curr_indent = gimple_code (stmt) == GIMPLE_LABEL ? label_indent : indent; + if (gimple_lineno (stmt) != lineno) + { + lineno = gimple_lineno (stmt); + + INDENT (curr_indent); + pp_printf (buffer, "# line %d", lineno); + pp_newline (buffer); + } + INDENT (curr_indent); dump_gimple_stmt (buffer, stmt, curr_indent, flags); pp_newline (buffer);