diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-27 15:34:36 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-09-27 15:45:51 +0200 |
commit | 625801e5ada58af77861c72514ebc5521a67398f (patch) | |
tree | 684d195d6765260b9756c58a300552e50a046e14 /i386 | |
parent | 16a8848a4f04b429d0c76c72118a7b39002cd9c2 (diff) | |
download | gnumach-625801e5ada58af77861c72514ebc5521a67398f.tar.gz gnumach-625801e5ada58af77861c72514ebc5521a67398f.tar.bz2 gnumach-625801e5ada58af77861c72514ebc5521a67398f.zip |
i386: improve syscall tracing
* kern/syscall_sw.h (mach_trap_t): Turn unused field into `mach_trap_name'.
(MACH_TRAP, MACH_TRAP_STACK): Record name.
* i386/i386/debug_i386.c (syscall_trace_print): Use the name and
format the arguments to look like c.
Diffstat (limited to 'i386')
-rw-r--r-- | i386/i386/debug_i386.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/i386/i386/debug_i386.c b/i386/i386/debug_i386.c index f0fe2aef..7a33350f 100644 --- a/i386/i386/debug_i386.c +++ b/i386/i386/debug_i386.c @@ -137,11 +137,22 @@ syscall_trace_print(int syscallvec, ...) { int syscallnum = syscallvec >> 4; int i; - - printf("syscall -%d:", syscallnum); - for (i = 0; i < mach_trap_table[syscallnum].mach_trap_arg_count; i++) - printf(" %08x", (&syscallvec)[1+i]); - printf("\n"); + const mach_trap_t *trap = &mach_trap_table[syscallnum]; + + printf("0x%08x:0x%08x:%s(", + current_task(), current_thread(), trap->mach_trap_name); + for (i = 0; i < trap->mach_trap_arg_count; i++) { + unsigned long value = (&syscallvec)[1+i]; + /* Use a crude heuristic to format pointers. */ + if (value > 1024) + printf("0x%08x", value); + else + printf("%d", value); + + if (i + 1 < trap->mach_trap_arg_count) + printf(", "); + } + printf(")\n"); return syscallvec; } |