This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/51770] New: dump gimple lineno when dumping bb
- From: "nash11228 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 05 Jan 2012 20:07:15 +0000
- Subject: [Bug middle-end/51770] New: dump gimple lineno when dumping bb
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: nash11228@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);