diff options
author | marcel <marcel@FreeBSD.org> | 2006-04-04 03:00:20 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2006-04-04 03:00:20 +0000 |
commit | 78f0584b0b21163bd30a2efc9dd947338b604cd7 (patch) | |
tree | 77b43fa6a855a8f08366acfadf40eafce8375336 /sys/amd64 | |
parent | 31f2b819c68f20ff188724669d3044a0680e3ceb (diff) | |
download | FreeBSD-src-78f0584b0b21163bd30a2efc9dd947338b604cd7.zip FreeBSD-src-78f0584b0b21163bd30a2efc9dd947338b604cd7.tar.gz |
Sync with i386: Map exceptions to signals in gdb_cpu_signal() so
that kgdb(1) gets a SIGTRAP when it needs to.
Pointed out by: grehan@
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/gdb_machdep.c | 24 | ||||
-rw-r--r-- | sys/amd64/include/gdb_machdep.h | 7 |
2 files changed, 25 insertions, 6 deletions
diff --git a/sys/amd64/amd64/gdb_machdep.c b/sys/amd64/amd64/gdb_machdep.c index 6a50d7d..5775c8f 100644 --- a/sys/amd64/amd64/gdb_machdep.c +++ b/sys/amd64/amd64/gdb_machdep.c @@ -91,3 +91,27 @@ gdb_cpu_setreg(int regnum, void *val) kdb_frame->tf_rip = *(register_t *)val; } } + +int +gdb_cpu_signal(int type, int code) +{ + + switch (type & ~T_USER) { + case 0: return (SIGFPE); /* Divide by zero. */ + case 1: return (SIGTRAP); /* Debug exception. */ + case 3: return (SIGTRAP); /* Breakpoint. */ + case 4: return (SIGSEGV); /* into instr. (overflow). */ + case 5: return (SIGURG); /* bound instruction. */ + case 6: return (SIGILL); /* Invalid opcode. */ + case 7: return (SIGFPE); /* Coprocessor not present. */ + case 8: return (SIGEMT); /* Double fault. */ + case 9: return (SIGSEGV); /* Coprocessor segment overrun. */ + case 10: return (SIGTRAP); /* Invalid TSS (also single-step). */ + case 11: return (SIGSEGV); /* Segment not present. */ + case 12: return (SIGSEGV); /* Stack exception. */ + case 13: return (SIGSEGV); /* General protection. */ + case 14: return (SIGSEGV); /* Page fault. */ + case 16: return (SIGEMT); /* Coprocessor error. */ + } + return (SIGEMT); +} diff --git a/sys/amd64/include/gdb_machdep.h b/sys/amd64/include/gdb_machdep.h index f626405..d007eef 100644 --- a/sys/amd64/include/gdb_machdep.h +++ b/sys/amd64/include/gdb_machdep.h @@ -40,12 +40,6 @@ gdb_cpu_regsz(int regnum) } static __inline int -gdb_cpu_signal(int type, int code __unused) -{ - return (type); -} - -static __inline int gdb_cpu_query(void) { return (0); @@ -53,5 +47,6 @@ gdb_cpu_query(void) void *gdb_cpu_getreg(int, size_t *); void gdb_cpu_setreg(int, void *); +int gdb_cpu_signal(int, int); #endif /* !_MACHINE_GDB_MACHDEP_H_ */ |