public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Getting a global static char
@ 2008-11-10  8:33 Tim Beaulen
  2008-11-10 14:18 ` Frank Ch. Eigler
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Beaulen @ 2008-11-10  8:33 UTC (permalink / raw)
  To: systemtap

Hello,

I'm trying to learn Systemtap and while playing around I got to a problem.
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.

Here's the relevant part of the source code:

static const char qt_meta_stringdata_
KDERebuildDialog[] = {
    "KDERebuildDialog\0\0slotStartButtonClicked()\0"
    "slotStopButtonClicked()\0"
    "slotCloseButtonClicked()\0slotProcessFinished()\0"
    "slotProcessStarted()\0message\0"
    "slotProcessError(QString)\0"
    "slotProcessWarning(QString)\0value\0"
    "slotProgress(int)\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) }

Which I then call like this:
sudo stap -vvvvvv ./debug.stp
/home/kde4/projects/kderebuild/kderebuild -c
'/home/kde4/projects/kderebuild/kderebuild'

This gives the following error:
Resolution problem with probe probe_1384
printf("%s %s (%s)\\n", pp(), sprint("this=%#x _clname=%#x ",
_dwarf_tvar_get_this_3(), _dwarf_tvar_get__clname_4()),
$qt_meta_stringdata_KDERebuildDialog)
semantic error: unable to find local
'qt_meta_stringdata_KDERebuildDialog' near pc 0x8053f4c (alternatives:
this _clname): identifier '$qt_meta_stringdata_KDERebuildDialog' at
./debug.stp:4:85
        source: probe process(@1).function("qt_metacast").call {
printf("%s %s (%s)\n",pp(),$$parms,$qt_meta_stringdata_KDERebuildDialog)
}

                             ^


Is there a way to get to the qt_meta_stringdata_KDERebuildDialog string?







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
process("/home/kde4/projects/kderebuild/kderebuild").function("qt_metacast").call
this=0x7b _clname=0x0
process("/home/kde4/projects/kderebuild/kderebuild").function("qt_metacast").call
this=0x7b _clname=0x0
process("/home/kde4/projects/kderebuild/kderebuild").function("qt_metacast").call
this=0x7b _clname=0x0
process("/home/kde4/projects/kderebuild/kderebuild").function("qt_metacast").call
this=0x7b _clname=0x0

The idea is to print the name string which corresponds to _clname, like this:
process("/home/kde4/projects/kderebuild/kderebuild").function("qt_metacast").call
this=0x7b _clname=0x0 (KDERebuildDialog)


Thanks

I attached the complete source file which contains the
qt_meta_stringdata_KDERebuildDialog variable en the qt_metacast
function.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Getting a global static char
  2008-11-10  8:33 Getting a global static char Tim Beaulen
@ 2008-11-10 14:18 ` Frank Ch. Eigler
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Ch. Eigler @ 2008-11-10 14:18 UTC (permalink / raw)
  To: Tim Beaulen; +Cc: systemtap

"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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-10 14:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-10  8:33 Getting a global static char Tim Beaulen
2008-11-10 14:18 ` Frank Ch. Eigler

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).