[Bug translator/13784] New: Cannot find a defining variable location in different CU
mjw at redhat dot com
sourceware-bugzilla@sourceware.org
Wed Feb 29 19:35:00 GMT 2012
http://sourceware.org/bugzilla/show_bug.cgi?id=13784
Bug #: 13784
Summary: Cannot find a defining variable location in different
CU
Product: systemtap
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: translator
AssignedTo: systemtap@sourceware.org
ReportedBy: mjw@redhat.com
Classification: Unclassified
Take the following code:
::::::::::::::
distance.c
::::::::::::::
static int value;
void setdistance(int v) { value = v; }
int getdistance() { return value; }
::::::::::::::
speed.c
::::::::::::::
static int value;
void setspeed(int v) { value = v; }
int getspeed() { return value; }
::::::::::::::
main.c
::::::::::::::
#include <stdio.h>
void setspeed(int v);
int getspeed();
void setdistance(int v);
int getdistance();
static print_value (int value)
{
printf("value: %d\n", value);
}
static int calculate_value ()
{
return getdistance () / getspeed ();
}
int main (int argc, char **argv)
{
int value;
setspeed (6);
setdistance (60);
value = calculate_value ();
print_value (value);
return 0;
}
Note that there are various variables "value" in play here. The example above
is deliberately setup to show all the pitfalls. But the issue is the same for
having a global variable in one CU/file and wanting to use/probe it in another
CU. A simple $value will not find it.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Systemtap
mailing list