This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
accessing kernel global variables?
- From: Om Narasimhan <om dot turyx at gmail dot com>
- To: systemtap at sourceware dot org
- Date: Sun, 07 Sep 2008 19:49:34 -0700
- Subject: accessing kernel global variables?
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=6RZJdGBX2YmXCGYuetkXGsPZvD+YwJjJkLbw9VqLjfs=; b=qBzGB0NPd93cnE1aZfHIkFXRW7NqtNVz6PLAx52w1hG5C1vHwaXlB6RwT+Fobdi7dW cReVtrTxjbluIVCh4z0tUE2Y43sJmlRyazqlAUNpi2euyMY8FAJZn775vshVOdmRqnn8 Afx1OIAvaT7POzTSoI5i503t0OFcz0TOENviI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=ZCMed+P/vq8vqp3hjsX4fRhYXgbuUWqCRCKXX4284mx4oLkLwfCoz0o1yXu25IERNm icHPKMZpqQe3dtRnxC+Ka2lyrgiN//u0mDRZ6H6rTgbIiD13V7gfc2amLWmn3MLnlXBi Mi2V6tDELrRX/Z6Iqef6bO4yWm9CztjTZU2WQ=
Can a system tap script access kernel global variables (which are
independent of the context it runs in?)
For example, kernel/pid.c:38 in my tree defines pid_max as,
int pid_max = PID_MAX_DEFAULT;
When I try printing this value using the below scriptlet I get errors.
$ sudo stap -g -u -vv -e 'probe begin { printf("pid_max = %d\n",
$pid_max) ; exit() }'
SystemTap translator/driver (version 0.6.2/0.127 built 2008-03-27)
Copyright (C) 2005-2008 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
Created temporary directory "/tmp/stappkNTb2"
Searched '/usr/share/system tap/tapset/x86_64/*.stp', found 1
Searched '/usr/share/system tap/tapset/*.stp', found 37
Pass 1: parsed user script and 38 library script(s) in
120usr/10sys/163real ms.
semantic error: unresolved target-symbol expression: identifier
'$pid_max' at <input>:1:40
Pass 2: analyzed script: 1 probe(s), 5 function(s), 0 embed(s), 0
global(s) in 0usr/0sys/2real ms.
Pass 2: analysis failed. Try again with more '-v' (verbose) options.
Running rm -rf /tmp/stappkNTb2
Is it expected? Or am I doing something wrong?
Thanks,
Om.