summaryrefslogtreecommitdiff
path: root/debian/patches/random-fixes0003-i386-improve-syscall-tracing.patch
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-27 15:46:01 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-27 15:46:01 +0200
commitd5ca98b7b1a664df4260dc690e331ae0d6ae9f4a (patch)
tree100ef1180a5b9d6ad6b40d47a6d61eac74ef127a /debian/patches/random-fixes0003-i386-improve-syscall-tracing.patch
parent1c257880c4c53f7245feb9b8df3e8c0292897486 (diff)
add patch series
Diffstat (limited to 'debian/patches/random-fixes0003-i386-improve-syscall-tracing.patch')
-rw-r--r--debian/patches/random-fixes0003-i386-improve-syscall-tracing.patch72
1 files changed, 72 insertions, 0 deletions
diff --git a/debian/patches/random-fixes0003-i386-improve-syscall-tracing.patch b/debian/patches/random-fixes0003-i386-improve-syscall-tracing.patch
new file mode 100644
index 0000000..41aa5f4
--- /dev/null
+++ b/debian/patches/random-fixes0003-i386-improve-syscall-tracing.patch
@@ -0,0 +1,72 @@
+From 625801e5ada58af77861c72514ebc5521a67398f Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 15:34:36 +0200
+Subject: [PATCH gnumach 3/4] 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.
+---
+ i386/i386/debug_i386.c | 21 ++++++++++++++++-----
+ kern/syscall_sw.h | 6 +++---
+ 2 files changed, 19 insertions(+), 8 deletions(-)
+
+diff --git a/i386/i386/debug_i386.c b/i386/i386/debug_i386.c
+index f0fe2ae..7a33350 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;
+ }
+diff --git a/kern/syscall_sw.h b/kern/syscall_sw.h
+index 87fc1bb..1edf1c7 100644
+--- a/kern/syscall_sw.h
++++ b/kern/syscall_sw.h
+@@ -37,15 +37,15 @@ typedef struct {
+ int mach_trap_arg_count;
+ int (*mach_trap_function)();
+ boolean_t mach_trap_stack;
+- int mach_trap_unused;
++ const char *mach_trap_name;
+ } mach_trap_t;
+
+ extern mach_trap_t mach_trap_table[];
+ extern int mach_trap_count;
+
+ #define MACH_TRAP(name, arg_count) \
+- { (arg_count), (int (*)()) (name), FALSE, 0 }
++ { (arg_count), (int (*)()) (name), FALSE, #name }
+ #define MACH_TRAP_STACK(name, arg_count) \
+- { (arg_count), (int (*)()) (name), TRUE, 0 }
++ { (arg_count), (int (*)()) (name), TRUE, #name }
+
+ #endif /* _KERN_SYSCALL_SW_H_ */
+--
+2.1.4
+