Search:

PmWiki

pmwiki.org

edit SideBar

Main / Strace

The system trace tool prints system function calls to the screen for a particular process in real time.
Attach with strace -p <process> or simply run with strace.

strace adds a lot of overhead to execution and may break inter-process interactions. Good for relative timing, not absolute.

Options
Specify which calls to trace or not trace with -e trace=function or -e trace=!function,function

Cross-Compile strace
After unpacking the tar, run CFLAGS="-static" LDFLAGS="-static" ./configure --target=<target uclibc>
Then make. Can be stripped using target-uclibc-strip tool.

Had some problems with the build related to 64-bit support:

file.c: In function `printstatfs64':
file.c:1538: error: storage size of 'statbuf' isn't known
file.c:1538: warning: unused variable `statbuf'
file.c: In function `sys_statfs64':
file.c:1573: error: invalid application of `sizeof' to incomplete type `statfs64'
file.c: In function `sys_fstatfs64':
file.c:1588: error: invalid application of `sizeof' to incomplete type `statfs64'
make[1]: *** [file.o] Error 1
syscall.o:(.rodata+0x1cc8): undefined reference to `sys_truncate64'
syscall.o:(.rodata+0x1cdc): undefined reference to `sys_ftruncate64'
syscall.o:(.rodata+0x1d7c): undefined reference to `sys_getdents64'
collect2: ld returned 1 exit status
make[1]: *** [strace] Error 1

One fix is to comment all the code inside of file.c: static void printstatfs64(tcp, addr) and file.c: int sys_statfs64(tcp) functions.

int
sys_statfs64(tcp)
struct tcb *tcp;
{/*
	if (entering(tcp)) {
		printpath(tcp, tcp->u_arg[0]);
		tprintf(", %lu, ", tcp->u_arg[1]);
	} else {
		if (tcp->u_arg[1] == sizeof (struct statfs64))
			printstatfs64(tcp, tcp->u_arg[2]);
		else
			tprintf("{???}");
	}
 */	return 0;
}

Part two is to go into linux/powerpc/syscallent.h and comment out the offenders, like so: //{ 4, TF, sys_truncate64, "truncate64" }, /* 193 */

Help references:
http://lists.busybox.net/pipermail/buildroot/2012-January/049050.html
http://lists.busybox.net/pipermail/uclibc/2004-March/008625.html
http://permalink.gmane.org/gmane.linux.distributions.gumstix.general/4603


Page last modified on January 02, 2014, at 11:27 AM