diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-12-28 13:18:05 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2005-12-28 13:18:05 +0000 |
commit | 56027564e5fbb94e46f88ec96906808e0c5ea458 (patch) | |
tree | c636f1a1cf692f8fca7e60461a0f76a89e06759d /gnu/usr.bin | |
parent | 475e36128527a63dfeaeab3b0671f2a9f4526a2d (diff) |
Fix single-stepping over system calls on sparc and sparc64.
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/binutils/gdb/sparc-tdep.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gnu/usr.bin/binutils/gdb/sparc-tdep.c b/gnu/usr.bin/binutils/gdb/sparc-tdep.c index a472bb27e61..c41a763d4df 100644 --- a/gnu/usr.bin/binutils/gdb/sparc-tdep.c +++ b/gnu/usr.bin/binutils/gdb/sparc-tdep.c @@ -1,6 +1,6 @@ /* Target-dependent code for SPARC. - Copyright 2003, 2004 Free Software Foundation, Inc. + Copyright 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GDB. @@ -80,6 +80,8 @@ struct regset; #define X_OP2(i) (((i) >> 22) & 0x7) #define X_IMM22(i) ((i) & 0x3fffff) #define X_OP3(i) (((i) >> 19) & 0x3f) +#define X_RS1(i) (((i) >> 14) & 0x1f) +#define X_RS2(i) ((i) & 0x1f) #define X_I(i) (((i) >> 13) & 1) /* Sign extension macros. */ #define X_DISP22(i) ((X_IMM22 (i) ^ 0x200000) - 0x200000) @@ -985,6 +987,23 @@ sparc_analyze_control_transfer (CORE_ADDR pc, CORE_ADDR *npc) branch_p = 1; offset = 4 * X_DISP19 (insn); } + else if (X_OP (insn) == 2 && X_OP3 (insn) == 0x3a) + { + if ((X_I (insn) == 0 && X_RS1 (insn) == 0 && X_RS2 (insn) == 0) + || (X_I (insn) == 1 && X_RS1 (insn) == 0 && (insn & 0x7f) == 0)) + { + /* OpenBSD system call. */ + ULONGEST number; + + regcache_cooked_read_unsigned (current_regcache, + SPARC_G1_REGNUM, &number); + + if (number & 0x400) + return sparc_address_from_register (SPARC_G2_REGNUM); + if (number & 0x800) + return sparc_address_from_register (SPARC_G7_REGNUM); + } + } /* FIXME: Handle DONE and RETRY instructions. */ |