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: script compilation fails at 'Pass 4'


On 12/06/2012 03:38 AM, Mehul Choube wrote:
> Hi,
> 
> Whenever a syscall.connect returns I want to print the socket name (getsockname())
> 
> Error:
> 
> ======= run start =======
> 
> [root@rhel5-stap stps]# stap -g strace-connect.stp -c "curl www.google.com"
> Pass 4: compilation failed.  Try again with another '--vp 0001' option.
> 
> [root@rhel5-stap stps]# stap -g --vp 0001 strace-connect.stp -c "curl www.google.com"
> Pass 4: compiled C into "stap_b7800dfc97ca81afbd4921aaa452d856_6437.ko" in 740usr/190sys/932real ms.
> Pass 4: compilation failed.  Try again with another '--vp 0001' option.
> 
> [root@rhel5-stap ~]# uname -a
> Linux rhel5-stap 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
> 
> ======= run end =======
> 
> The script and the C code is at: http://pastebin.com/ZspDG6qx

Mehul,

I'm not sure why you aren't getting any error messages out of stap. What
version of systemtap are you running?

Here's what I get with systemtap HEAD:

====
# stap -gv ./strace-connect.stp -c "curl www.google.com"
Checking "/lib/modules/2.6.18-308.20.1.el5/build/System.map" failed with
error: No such file or directory
Ensure kernel development headers & makefiles are installed
Pass 1: parsed user script and 90 library script(s) using
148624virt/23228res/2904shr/21132data kb, in 180usr/20sys/202real ms.
Pass 2: analyzed script: 1 probe(s), 2 function(s), 3 embed(s), 0
global(s) using 226460virt/81232res/45132shr/36912data kb, in
370usr/20sys/394real ms.
Pass 3: translated to C into
"/tmp/stapg3uHUN/stap_548b6f815eca69cfd5a759e9b2e12233_7447_src.c" using
226460virt/81476res/45376shr/36912data kb, in 10usr/0sys/8real ms.
/tmp/stapg3uHUN/stap_548b6f815eca69cfd5a759e9b2e12233_7447_src.c:22:20:
error: stdlib.h: No such file or directory
/tmp/stapg3uHUN/stap_548b6f815eca69cfd5a759e9b2e12233_7447_src.c:23:24:
error: sys/socket.h: No such file or directory
/tmp/stapg3uHUN/stap_548b6f815eca69cfd5a759e9b2e12233_7447_src.c: In
function ‘function_sockname’:
/tmp/stapg3uHUN/stap_548b6f815eca69cfd5a759e9b2e12233_7447_src.c:501:
error: implicit declaration of function ‘malloc’
cc1: warnings being treated as errors
/tmp/stapg3uHUN/stap_548b6f815eca69cfd5a759e9b2e12233_7447_src.c:501:
warning: incompatible implicit declaration of built-in function ‘malloc’
/tmp/stapg3uHUN/stap_548b6f815eca69cfd5a759e9b2e12233_7447_src.c:501:
error: invalid application of ‘sizeof’ to incomplete type ‘struct sockaddr’
/tmp/stapg3uHUN/stap_548b6f815eca69cfd5a759e9b2e12233_7447_src.c:502:
error: expected ‘,’ or ‘;’ before ‘if’
make[1]: ***
[/tmp/stapg3uHUN/stap_548b6f815eca69cfd5a759e9b2e12233_7447_src.o] Error 1
make: *** [_module_/tmp/stapg3uHUN] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_548b6f815eca69cfd5a759e9b2e12233_7447.ko"
in 380usr/190sys/588real ms.
Pass 4: compilation failed.  Try again with another '--vp 0001' option.
====

There are several misconceptions with your script. The main one being
that the embedded C code in your script isn't user code, it is kernel
code. So, for instance you can't call malloc(), header files don't come
from /usr/include, etc.

Perhaps you could back up a bit and tell us what you are really trying
to do?

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)


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