This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why can't I call a (Embedded C) function from another (Embedded C) function?


* 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]