This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tapsets/23506] New: tapset function usymname() cannot translate the addresses of C static/global variables


https://sourceware.org/bugzilla/show_bug.cgi?id=23506

            Bug ID: 23506
           Summary: tapset function usymname() cannot translate the
                    addresses of C static/global variables
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tapsets
          Assignee: systemtap at sourceware dot org
          Reporter: agentzh at gmail dot com
  Target Milestone: ---

Consider the following C program:

```C
int a = 3;
void *p = &a;

int main(void) {
    return 0;
}
```

Compile it:

```
gcc -Wall -g a.c
```

Then run it with stap:

```
$ stap -e 'probe process.function("main") { p = @var("p");
println(usymname(p)); exit() }' -c ./a.out
0x601020
```

It fails to return the string "a", which is the global C variable name in the
target program.

GDB does support resolving global C variables by default. For this example:

```
(gdb) p p
$3 = (void *) 0x601020 <a>
```

We've got the variable symbol name `a` in the `p` command output here.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]