Getting a global static char

Frank Ch. Eigler fche@redhat.com
Mon Nov 10 14:18:00 GMT 2008


"Tim Beaulen" <tbscope@gmail.com> writes:

> I'm trying to learn Systemtap and while playing around I got to a problem.

You seem to have quite some way, good job.

> I want to read a global static char so I can display the actual
> strings instead of numbers.  But Systemtap doesn't seem to find the
> global static char.
> [...]
> static const char qt_meta_stringdata_
> KDERebuildDialog[] = {
>     "KDERebuildDialog\0\0slotStartButtonClicked()\0"
> [...]

> At the moment, all I want to do is read that string and display it. I
> created a .stp file with the following code:
> probe process(@1).function("qt_metacast").call { printf("%s %s
> (%s)\n",pp(),$$parms,$qt_meta_stringdata_KDERebuildDialog) }

That should almost work (even though your string has those funky
embedded \0's).  You'd need a user_string($qt_meta_...) to extract the
value as a string.  But I believe our bug #4906 and another one is
impacting resolution of some global variables.  Sorry about that,
we'll try to fix it soon.


> If I leave out that string, I get output like this:
> process("/home/kde4/projects/kderebuild/kderebuild").function("qt_metacast").call
> this=0x7b _clname=0x0

Do those 0x7b/0x0 values look correct, by the way?  We're finding
gcc's current debugging info limitations more severely impact
userspace probing than kernel.  (bug #6941, #1155, and may gcc GCC VTA
be ready soon).


- FChE



More information about the Systemtap mailing list