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]

Issue related to systemtap output in guru mode


Hi,

We have an issue regarding the usage of systemtap in Guru mode.

When using systemtap in guru mode, we could not use  printf statement.

The compilation stage failed. When we checked with more -v options, we
observed that an error was generated because of inclusion of printf
statement.

I would like to illustrate with a simple example as shown below:

Code snippet for hello world program

#!/usr/bin/stap -g

//hello_world.stp - prints hello world

function print_hello() %{

            printf ("Hello World\n");

%}

probe begin {



            print ("Test program\n")

            print_hello()

}


Following observations were made:



1. When we executed the program with -vv option, we observed following
error message:

/tmp/stapivivxS/stap_a2609c1ce06492087c58daddf95c569a_258.c: In
function 'function_print_hello':

/tmp/stapivivxS/stap_a2609c1ce06492087c58daddf95c569a_258.c:105:
error: implicit declaration of function 'printf'

make[1]: *** [/tmp/stapivivxS/stap_a2609c1ce06492087c58daddf95c569a_258.o]
Error 1

make: *** [_module_/tmp/stapivivxS] Error 2

make: Leaving directory `/usr/src/linux-2.6.16.46-0.12'

Pass 4: compiled C into "stap_a2609c1ce06492087c58daddf95c569a_258.ko"
in 480usr/80sys/595real ms.

Pass 4: compilation failed.  Try again with more '-v' (verbose) options.

Running rm -rf /tmp/stapivivxS



2. Then we included the stdio.h file as well as shown below
%{ #include <stdio.h> %}



However we observed following error messages:

 /tmp/stapaMIET3/stap_a71619a8fd49b440ead016c3a87d8b4e_306.c:94:19:
error: stdio.h: No such file or directory

/tmp/stapaMIET3/stap_a71619a8fd49b440ead016c3a87d8b4e_306.c: In
function 'function_print_hello':

/tmp/stapaMIET3/stap_a71619a8fd49b440ead016c3a87d8b4e_306.c:109:
error: implicit declaration of function 'printf'

make[1]: *** [/tmp/stapaMIET3/stap_a71619a8fd49b440ead016c3a87d8b4e_306.o]
Error 1

make: *** [_module_/tmp/stapaMIET3] Error 2

make: Leaving directory `/usr/src/linux-2.6.16.46-0.12'

Pass 4: compiled C into "stap_a71619a8fd49b440ead016c3a87d8b4e_306.ko"
in 490usr/70sys/575real ms.

Pass 4: compilation failed.  Try again with more '-v' (verbose) options.

Running rm -rf /tmp/stapaMIET3



 3. However the program works fine if we use printk in place of printf
function, output messages appear in /var/log/messages. But we would
like to have the output to appear on the console.


Can any one please suggest how to display the information on console
when we are using systemtap in Guru Mode.?


Regards,

Ramya


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