linux-user strace
PATCH 1/1 linux-user strace
Here is a refresh vs todays CVS of the strace patch. I have filled in a couple more syscall specific formats since the last time this was sent out. It would be nice to get this one merged in so future format updates would be smaller and easier to digest.
This patch implements strace like functionallity for the target executable.
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 +10 -0
@@ -312,6 +312,11 @@return (unsigned long )ret >= (unsigned long )(-4096 ); } +char *target_strerror (int err) +{ +return strerror (host_to_target_errno (err)); +} +static target_ulong target_brk;static target_ulong target_original_brk;
@@ -2606,6 +2611,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
@@ -4790,6 +4798,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 +93 -0
93 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
@@ -1880,6 +1880,10 @@putenv ("LD_LIBRARY_PATH=/usr/lib/libfakeroot:/usr/lib64/libfakeroot:/usr/lib32/libfakeroot" ); } +if (getenv ("QEMU_STRACE" ) ){ + do_strace=1 ; + } + wrk = environ;while (*(wrk++)) environ_count++;
linux-user/qemu.h +6 -0
@@ -138,10 +138,16 @@void cpu_loop (CPUState *env);void init_paths (const char *prefix);const char *path (const char *pathname); +char *target_strerror (int err);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 );