public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "jlebon at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug runtime/18083] listing_mode.exp fails on rhel6
Date: Thu, 05 Mar 2015 17:05:00 -0000	[thread overview]
Message-ID: <bug-18083-6586-6aLdv9YTP8@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-18083-6586@http.sourceware.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.

  parent reply	other threads:[~2015-03-05 17:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05 10:28 [Bug runtime/18083] New: " mcermak at redhat dot com
2015-03-05 10:35 ` [Bug runtime/18083] " mcermak at redhat dot com
2015-03-05 17:05 ` jlebon at redhat dot com [this message]
2023-12-06 20:33 ` wcohen at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-18083-6586-6aLdv9YTP8@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).