This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: please help
- From: "Peter Teoh" <htmldeveloper at gmail dot com>
- To: "siddharam suresh" <siddharam dot s dot t at gmail dot com>
- Cc: systemtap at sources dot redhat dot com
- Date: Tue, 14 Oct 2008 11:14:10 +0800
- Subject: Re: please help
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=m7flb+JFCOqKYC5FFIBoB4jM42UVncMe5tQeGSXWVxU=; b=czQ6MRbi67yCYRJafm4LpN+XFDwap6D449k/9/y3ya6ofUaLEml++Do50ohpny/rYe AIK7/cIP8w48qFg0+Rt73u3Z95OqZ/VdWSWJih5vg0m2K3Bi3u8nHLeI7CG+WxUcKVCv eKVbSH61VARXdx8UDpA2/fzCz9AnoZ/Xo6dIQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=LtFMjC8fvMij3+ddlk2K+DmjRyIDTC1MGs+pyqNU5R0rzxqMyWhePFVRpLEkHoxvhP E2uH9AsNVtEUaMsJ5DG31CWf7ruQRI4wrcj1UJL204OMR1jhB+g/vFw0rpg5/gQTkNfT e6bma/HTobC0CvLGrL2l33nu/C2ApuR29MouI=
- References: <e46721ab0810110701s5b1e57edt25a56f7a550fb0@mail.gmail.com> <e46721ab0810110712o721ae3e7p6b6200b6cdfea3e8@mail.gmail.com>
first to use systemtap, u need to roughly know which kernel APIs u
want to trace. to do that, u can use "strace" to trace the userspace
execution of the program, and from the system call output, (usually
:-)) add the sys_xxx to derive the kernel API version, eg, for
execve() it is sys_execve():
The following is your program:
/root>strace ./a.out
execve("./a.out", ["./a.out"], [/* 28 vars */]) = 0
brk(0) = 0x804a000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7ef5000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=54870, ...}) = 0
mmap2(NULL, 54870, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7ee7000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0`\1\000"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=1307104, ...}) = 0
mmap2(NULL, 1312164, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE,
3, 0) = 0xb7da6000
mmap2(0xb7ee1000, 12288, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13b) = 0xb7ee1000
mmap2(0xb7ee4000, 9636, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7ee4000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7da5000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7da56c0,
limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,
limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb7ee1000, 4096, PROT_READ) = 0
munmap(0xb7ee7000, 54870) = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xb7ef4000
write(1, "Test kernel", 11Test kernel) = 11
exit_group(11) = ?
And sys_execve() in arch/x86/kernel/process_32.c is your start (mine
kernel is 2.6.20). Well, it will be a long long path towards full
understanding even of this simple program. Alternatively, pick a
topic of interest, and understand in greater depth about it. Eg,
tracing the filesystem VFS APIs etc.
On Sat, Oct 11, 2008 at 10:12 PM, siddharam suresh
<siddharam.s.t@gmail.com> wrote:
> i want visualize what all the stuffs happening inside the Linux kernel
> when this program is executed
>
>
> #include<stdio.h>
> void main()
> {
> printf("Test kernel"); <-- here i want know what are all the system
> calls and the kernel data structure kernel is used by the kernel. Is
> it possible to put break points here and can we see what are the
> things happening inside the kernel when printf is executed
>
> }
>
>
> is it possible to put break points in side the my program using the
> system tap i want to visualize what are system calls and kernel data
> structure used by particular statement.
>
> as above stated test.c program i what see what is happening inside the
> kernel when printf("Test Kernel"); is executed .This because when the
> my program become large it will show so many information which may not
> be use full to me and very difficult to get the particular
> information.Is there any facilities like step in and step out in
> system tap
>
>
>
> thank you in advance
> waiting great response
>
--
Regards,
Peter Teoh