This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Why can't I call a (Embedded C) function from another (Embedded C) function?
- From: Srikar Dronamraju <srikar at linux dot vnet dot ibm dot com>
- To: Om Narasimhan <om dot turyx at gmail dot com>
- Cc: systemtap at sourceware dot org
- Date: Mon, 8 Sep 2008 10:05:45 +0530
- Subject: Re: Why can't I call a (Embedded C) function from another (Embedded C) function?
- References: <48C31A7D.4060309@gmail.com> <48C3246D.1050306@gmail.com>
- Reply-to: Srikar Dronamraju <srikar at linux dot vnet dot ibm dot com>
* Om Narasimhan <om.turyx@gmail.com> [2008-09-06 17:46:37]:
Embedded C code whatever is there in %{ %} gets included in a verbatim
fashion in the generated module. Hence you see this behaviour.
--
Thanks and Regards
Srikar
> I figured it out.
>
> Om Narasimhan wrote:
>> 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,
>
> I modified the script to
> %{/*PURE*/
>
> long traverse_pid_chain (long pidnr)
> {
> printk("param = %06ld\n", pidnr);
> return 0;
> }
>
> %}
>
> function task_analysis : long()
> %{/*PURE*/
> long traverse_pid_chain(long);
> traverse_pid_chain(0);
> printk("done\n");
> THIS->__retvalue = 0;
> %}
>
>
> probe syscall.kill
> {
> task_analysis()
> printf("Called...\n")
> }
>
> And it started working.
> Is it a hack or the right way to get such calls working?
>
> Thanks,
> Om.