diff options
author | Mark Kettenis <kettenis@gnu.org> | 2004-11-10 17:48:23 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2004-11-10 17:48:23 +0000 |
commit | 06987e6431adee88dcffb552d01162668efbf9f4 (patch) | |
tree | a9c49e02768bde099006e3d47e27f40f680e1768 | |
parent | 4a302917ab01de824acff3470ac3fea896e9271b (diff) | |
download | gdb-06987e6431adee88dcffb552d01162668efbf9f4.zip gdb-06987e6431adee88dcffb552d01162668efbf9f4.tar.gz gdb-06987e6431adee88dcffb552d01162668efbf9f4.tar.bz2 |
* mips-tdep.c (mips32_relative_offset): Change return type to
LONGEST, change argument type to ULONGEST. Fix sign-extension.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 13 |
2 files changed, 8 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 36694a3..386d9f7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2004-11-10 Mark Kettenis <kettenis@gnu.org> + + * mips-tdep.c (mips32_relative_offset): Change return type to + LONGEST, change argument type to ULONGEST. Fix sign-extension. + 2004-11-10 Randolph Chung <tausq@debian.org> * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Make static. diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 7ad78da..487e3da 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -878,17 +878,10 @@ mips_fetch_instruction (CORE_ADDR addr) #define rtype_shamt(x) ((x >> 6) & 0x1f) #define rtype_funct(x) (x & 0x3f) -static CORE_ADDR -mips32_relative_offset (unsigned long inst) +static LONGEST +mips32_relative_offset (ULONGEST inst) { - long x; - x = itype_immediate (inst); - if (x & 0x8000) /* sign bit set */ - { - x |= 0xffff0000; /* sign extension */ - } - x = x << 2; - return x; + return ((itype_immediate (inst) ^ 0x8000) - 0x8000) << 2; } /* Determine whate to set a single step breakpoint while considering |