From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33751 invoked by alias); 5 Mar 2015 17:05:39 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 33713 invoked by uid 48); 5 Mar 2015 17:05:35 -0000 From: "jlebon at redhat dot com" To: systemtap@sourceware.org Subject: [Bug runtime/18083] listing_mode.exp fails on rhel6 Date: Thu, 05 Mar 2015 17:05:00 -0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: runtime X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jlebon at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-q1/txt/msg00211.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=18083 Jonathan Lebon changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jlebon at redhat dot com --- Comment #2 from Jonathan Lebon --- 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.