This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: systemtap question..
- From: Mark Wielaard <mjw at redhat dot com>
- To: Peter Teoh <htmldeveloper at gmail dot com>
- Cc: systemtap at sources dot redhat dot com, Om Narasimhan <om dot turyx at gmail dot com>
- Date: Sat, 23 Aug 2008 14:50:21 +0200
- Subject: Re: systemtap question..
- References: <48ACFC02.3080002@gmail.com> <804dabb00808222127t3606302ds94056e7da6b0f30d@mail.gmail.com>
Hi Peter,
On Sat, 2008-08-23 at 12:27 +0800, Peter Teoh wrote:
> as discovered by narasimhan, the following script will lead to kernel
> freezing and hanged for me:
>
> I execute via "stap -kvvv script.stp" command.
The kernel freezing is worrying. That should not happen. And it doesn't
for me. Do you have some more information? Kernel version, any
backtraces on the console when this happens, etc.
> Question is: why does he get a compilation error when using the -u
> option? (same for me as well, which goes away when removed?)
When you use -u stap doesn't remove unused parts of the script.
Without -u stap is "smart" and sees that you never actually use any of
the variables in your script:
WARNING: eliding unused variable identifier 'inode' at script.stp:3:7
WARNING: eliding unused variable identifier 'dev_nr' at script.stp:4:7
WARNING: eliding unused variable identifier 'inode' at script.stp:3:7
WARNING: eliding unused variable identifier 'dev_nr' at script.stp:4:7
If you add something like the following to your probe it will actually
use these variables and give an error about the code that assigns values
to them:
printf("%s inode: %d, dev_nr: %d\n", probefunc(), inode, dev_nr);
semantic error: field 'f_dentry' not found (alternatives: f_u f_path
f_op f_count f_flags f_mode f_pos f_owner f_uid f_gid f_ra f_version
f_security private_data f_ep_links f_ep_lock f_mapping): identifier
'$file' at script.stp:3:15
And indeed you need to replace f_dentry with f_path->dentry for newer
kernels.
Cheers,
Mark
This is the full version of the script that works for me against
2.6.25.14:
probe kernel.function ("vfs_read"), kernel.function("vfs_write")
{
inode = $file->f_path->dentry->d_inode->i_ino
dev_nr = $file->f_path->dentry->d_inode->i_sb->s_dev
printf("%s inode: %d, dev_nr: %d\n", probefunc(), inode, dev_nr);
}