Why can't I call a (Embedded C) function from another (Embedded C) function?
Srikar Dronamraju
srikar@linux.vnet.ibm.com
Mon Sep 8 04:43:00 GMT 2008
* 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.
More information about the Systemtap
mailing list