Why can't I call a (Embedded C) function from another (Embedded C) function?
Om Narasimhan
om.turyx@gmail.com
Sun Sep 7 00:05:00 GMT 2008
I have this script.
$cat test.stp
function traverse_pid_chain : long(pidnr:long)
%{ /*PURE*/
long pid = (long)THIS->pidnr;
printk("param = %06ld\n", pid);
THIS->__retvalue = 0;
%}
function task_analysis : long()
%{
long traverse_pid_chain(long); /* If I take this out, stap complains
"implicit function declaration" */
traverse_pid_chain(0);
printk("done\n");
THIS->__retvalue = 0;
%}
probe syscall.kill
{
task_analysis()
printf("Called...\n")
}
Errors I get are,
$ sudo stap -vvkug ./test.stp
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/stap94fdRf"
Searched '/usr/share/systemtap/tapset/x86_64/*.stp', found 1
Searched '/usr/share/systemtap/tapset/*.stp', found 37
Pass 1: parsed user script and 38 library script(s) in
120usr/10sys/233real ms.
probe sys_kill@kernel/signal.c:2073 kernel section=.text
pc=0xffffffff8104065f
Pass 2: analyzed script: 1 probe(s), 87 function(s), 14 embed(s), 0
global(s) in 230usr/50sys/282real ms.
probe_1064 locks nothing
Pass 3: translated to C into
"/tmp/stap94fdRf/stap_deeb7b36c0c1651a22410b18c2a13340_55326.c" in
0usr/10sys/12real ms.
Running make -C "/lib/modules/2.6.23.17-88.fc7/build"
M="/tmp/stap94fdRf" modules >/dev/null
WARNING: "traverse_pid_chain"
[/tmp/stap94fdRf/stap_deeb7b36c0c1651a22410b18c2a13340_55326.ko] undefined!
Pass 4: compiled C into "stap_deeb7b36c0c1651a22410b18c2a13340_55326.ko"
in 2030usr/340sys/2401real ms.
Copying /tmp/stap94fdRf/stap_deeb7b36c0c1651a22410b18c2a13340_55326.ko
to
/home/om/.systemtap/cache/de/stap_deeb7b36c0c1651a22410b18c2a13340_55326.ko
Copying /tmp/stap94fdRf/stap_deeb7b36c0c1651a22410b18c2a13340_55326.c to
/home/om/.systemtap/cache/de/stap_deeb7b36c0c1651a22410b18c2a13340_55326.c
Pass 5: starting run.
Running /usr/bin/staprun -v -d 20295
/tmp/stap94fdRf/stap_deeb7b36c0c1651a22410b18c2a13340_55326.ko
Error inserting module
'/tmp/stap94fdRf/stap_deeb7b36c0c1651a22410b18c2a13340_55326.ko':
Unknown symbol in module
Pass 5: run completed in 0usr/0sys/6real ms.
Pass 5: run failed. Try again with more '-v' (verbose) options.
Keeping temporary directory "/tmp/stap94fdRf"
#
From the kept files, I can see that the function is renamed to
static void function_traverse_pid_chain (struct context * __restrict__ c);
How to call this function?
Thanks,
Om.
More information about the Systemtap
mailing list