linux-user strace
PATCH 1/1 linux-user strace
Attached is a new version of the patch that implements strace-like functionallity for linux-user. Unlike the previous patch, this one can be considered "complete" and ready for inclusion, and has already proven to be useful for debugging problems.
Improvement over the previous patch include:
Activated by setting QEMU_STRACE env variable cleaner integration into do_syscall()
Per syscall override of the output function to allow for
a more customized display of the parameters.
Per syscall override of the return value output function. custom format string for a few more syscalls
Stuart
Stuart R. Anderson [email protected] Network & Software Engineering http://www.netsweng.com/ 1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F BD03 0A62 E534 37A7 9149
Makefile.target +1 -1
@@ -240,7 +240,7 @@ endif ifdef CONFIG_LINUX_USER -OBJS= main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o \ +OBJS= main.o syscall.o syscall_names.o mmap.o signal.o path.o osdep.o thunk.o \ elfload.o linuxload.o LIBS+= $(AIOLIBS) ifdef TARGET_HAS_BFLT
linux-user/syscall.c +5 -0
@@ -2598,6 +2598,9 @@#ifdef DEBUG gemu_log ("syscall %d" , num);#endif +if (do_strace) +print_syscall (num, arg1, arg2, arg3, arg4, arg5, arg6); +switch (num) {case TARGET_NR_exit:#ifdef HAVE_GPROF
@@ -4771,6 +4774,8 @@#ifdef DEBUG gemu_log (" = %ld\n" , ret);#endif +if (do_strace) +print_syscall_ret (num, ret);return ret; }
linux-user/syscall_names.c new file +71 -0
71 lines not on this page · raw message
linux-user/syscall_names.list new file +1509 -0
1,509 lines not on this page · raw message
linux-user/main.c +4 -0
@@ -1875,6 +1875,10 @@putenv ("LD_LIBRARY_PATH=/usr/lib/libfakeroot:/usr/lib64/libfakeroot:/usr/lib32/libfakeroot" ); } +if (getenv ("QEMU_STRACE" ) ){ + do_strace=1 ; + } +if (loader_exec (filename, argv+optind, environ, regs, info) !=0 ) {printf ("Error loading %s\n" , filename);_exit (1 );
linux-user/qemu.h +5 -0
@@ -142,6 +142,11 @@extern int loglevel;extern FILE *logfile; +/* syscall_names.c */ +void print_syscall (int num,long arg1,long arg2,long arg3,long arg4,long arg5,long arg6); +void print_syscall_ret (int num,long arg1); +extern int do_strace; +/* signal.c */ void process_pending_signals (void *cpu_env);void signal_init (void );