This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug runtime/18083] listing_mode.exp fails on rhel6
- From: "jlebon at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Thu, 05 Mar 2015 17:05:35 +0000
- Subject: [Bug runtime/18083] listing_mode.exp fails on rhel6
- Auto-submitted: auto-generated
- References: <bug-18083-6586 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=18083
Jonathan Lebon <jlebon at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jlebon at redhat dot com
--- Comment #2 from Jonathan Lebon <jlebon at redhat dot com> ---
Looks like it might be an old GCC bug that commit e93efe2 made apparent by
adding that goto statement. Here's an example:
$ nl main.c
1 void main(void) {
2 int x = 2;
3 my_label:
4 x += 2;
5 printf("x = %d\n", x);
6 }
$ gcc --version | head -n 1
gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)
$ gcc -w -g main.c -o main.f20
$ readelf -w main.f20 | grep DW_TAG_label -A 4
<2><56>: Abbrev Number: 4 (DW_TAG_label)
<57> DW_AT_name : (indirect string, offset: 0x0): my_label
<5b> DW_AT_decl_file : 1
<5c> DW_AT_decl_line : 3
<5d> DW_AT_low_pc : 0x40053f
<...snip...>
Switching over to el5:
$ gcc --version | head -n 1
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
$ gcc -w -g main.c -o main.el5
$ readelf -w main.el5 | grep DW_TAG_label -A 4
<2><8f>: Abbrev Number: 4 (DW_TAG_label)
<90> DW_AT_name : my_label
<99> DW_AT_decl_file : 1
<9a> DW_AT_decl_line : 3
<9b> DW_AT_low_pc : 0x4004a7
<...snip...>
So it seems like all looks OK (in both GCCs, the DW_AT_decl_line is 3, which is
correct). Now let's add a goto statement:
$ nl main.c
1 void main(void) {
2 int x = 2;
3 my_label:
4 x += 2;
5 printf("x = %d\n", x);
6 goto my_label;
7 }
$ readelf -w main.f20 | grep DW_TAG_label -A 4
<2><56>: Abbrev Number: 4 (DW_TAG_label)
<57> DW_AT_name : (indirect string, offset: 0x0): my_label
<5b> DW_AT_decl_file : 1
<5c> DW_AT_decl_line : 3
<5d> DW_AT_low_pc : 0x40053f
<...snip...>
$ readelf -w main.el5 | grep DW_TAG_label -A 4
<2><8f>: Abbrev Number: 4 (DW_TAG_label)
<90> DW_AT_name : my_label
<99> DW_AT_decl_file : 1
<9a> DW_AT_decl_line : 6
<9b> DW_AT_low_pc : 0x4004a7
<...snip...>
The f20 GCC is good, but the el5 GCC shows decl_line at 6 (where the goto
statement is) instead of 3. Note however that the low_pc is still correct. So
I'm thinking we could ignore decl_line for older GCCs and instead do a reverse
lookup to find the lineno corresponding to the low_pc. The only discrepancy is
that the lineno will be of the next statement, not where the label was defined
(e.g. in the above, 0x4004a7 corresponds to lineno 4, not 3). But it's still
much better than the wrong output.
--
You are receiving this mail because:
You are the assignee for the bug.