diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-07-10 01:35:53 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-07-10 01:35:53 +0000 |
commit | 34df79fc9d631a7cacdb2f9a9e12d5e3f8c6dd1c (patch) | |
tree | 90f72ebb31b2efb141be6ccc518e56eb37b0a701 /gdb/sparc-tdep.c | |
parent | ec1c752b34daada508decf3f978f0796f6008f77 (diff) | |
download | gdb-34df79fc9d631a7cacdb2f9a9e12d5e3f8c6dd1c.zip gdb-34df79fc9d631a7cacdb2f9a9e12d5e3f8c6dd1c.tar.gz gdb-34df79fc9d631a7cacdb2f9a9e12d5e3f8c6dd1c.tar.bz2 |
* findvar.c, defs.h
({extract,store}_{signed_integer,unsigned_integer,address}):
New routines to replace SWAP_TARGET_AND_HOST.
All over: All uses of SWAP_TARGET_AND_HOST on integers replaced.
Diffstat (limited to 'gdb/sparc-tdep.c')
-rw-r--r-- | gdb/sparc-tdep.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 5bfd263..62e8a18 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -147,8 +147,7 @@ sparc_frame_chain (thisframe) err = target_read_memory (addr, (char *) &retval, sizeof (REGISTER_TYPE)); if (err) return 0; - SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); - return retval; + return extract_address (&retval, sizeof (retval)); } CORE_ADDR @@ -167,22 +166,12 @@ frame_saved_pc (frame) FRAME frame; { REGISTER_TYPE retval; - CORE_ADDR addr,prev_pc; - - if (get_current_frame () == frame) /* FIXME, debug check. Remove >=gdb-4.6 */ - { - if (read_register (SP_REGNUM) != frame->bottom) abort(); - } + CORE_ADDR addr; addr = (frame->bottom + FRAME_SAVED_I0 + REGISTER_RAW_SIZE (I7_REGNUM) * (I7_REGNUM - I0_REGNUM)); read_memory (addr, (char *) &retval, sizeof (REGISTER_TYPE)); - SWAP_TARGET_AND_HOST (&retval, sizeof (retval)); - - /* CORE_ADDR isn't always the same size as REGISTER_TYPE, so convert. */ - - prev_pc = (CORE_ADDR) retval; - return PC_ADJUST (prev_pc); + return PC_ADJUST (extract_address (&retval, sizeof (REGISTER_TYPE))); } /* @@ -582,11 +571,12 @@ CORE_ADDR sparc_pc_adjust(pc) CORE_ADDR pc; { - long insn; + unsigned long insn; + char buf[4]; int err; - err = target_read_memory (pc + 8, (char *)&insn, sizeof(long)); - SWAP_TARGET_AND_HOST (&insn, sizeof(long)); + err = target_read_memory (pc + 8, buf, sizeof(long)); + insn = extract_unsigned_integer (buf, 4); if ((err == 0) && (insn & 0xfffffe00) == 0) return pc+12; else @@ -769,14 +759,16 @@ get_longjmp_target(pc) CORE_ADDR *pc; { CORE_ADDR jb_addr; +#define LONGJMP_TARGET_SIZE 4 + char buf[LONGJMP_TARGET_SIZE]; jb_addr = read_register(O0_REGNUM); - if (target_read_memory(jb_addr + JB_PC * JB_ELEMENT_SIZE, (char *) pc, - sizeof(CORE_ADDR))) + if (target_read_memory(jb_addr + JB_PC * JB_ELEMENT_SIZE, buf, + LONGJMP_TARGET_SIZE)) return 0; - SWAP_TARGET_AND_HOST(pc, sizeof(CORE_ADDR)); + *pc = extract_address (buf, LONGJMP_TARGET_SIZE); return 1; } |