This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Why can't I call a (Embedded C) function from another (Embedded C) function?
- From: Om Narasimhan <om dot turyx at gmail dot com>
- To: systemtap at sourceware dot org
- Date: Sat, 06 Sep 2008 17:04:13 -0700
- Subject: Why can't I call a (Embedded C) function from another (Embedded C) function?
- 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=DemJusE481m5gKGI5Iufq3Xv0fUmg6xYepjrUcuvjgo=; b=uJrPAsMK+smWBtSqNUtBe/+kzRXeDcIXxtdwRfpxY4GQgkzXIPKdeGo4o9PKYzP6Gj 4vDLkdkfZVaLR5brfW2SwurSICamqfxR9Q58nz09LBTFQOX5oOgKtyBkqVN3dMJCpWXv J0vDdbPqEW4TcaX0bnlYgrUr457OubHcFfJ8U=
- 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=GAW3E4iOqPp5RuhsLrzf0NI8TySeaONFxthTwNNioyuW1rVRTtr0aNumwuoah02U/N hQnnika3qU/95bqqit3K9qwhPJMEe9/ntXidft5EA1leQOGByv5CqTYg3/4PgoCB2/k4 5wxxisVacdLdBkFPcTg3xwjfummHs3v1Z9XZw=
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.