This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug tapsets/23506] New: tapset function usymname() cannot translate the addresses of C static/global variables
- From: "agentzh at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Fri, 10 Aug 2018 12:43:42 +0000
- Subject: [Bug tapsets/23506] New: tapset function usymname() cannot translate the addresses of C static/global variables
- Auto-submitted: auto-generated
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.