From: Andrew Cagney Date: Sun, 29 Nov 1998 07:41:36 +0000 (+0000) Subject: CARP: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8743fc885f33a57c09d1822b6fd5d6f6cc99ec9b;p=binutils-gdb.git CARP: Convert ADDR_BITS_REMOVE to a function. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 289eb6ec0b1..155ce629201 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +Sun Nov 29 11:18:37 1998 Andrew Cagney + + * z8k-tdep.c (z8k_addr_bits_remove), w65-tdep.c + (w65_addr_bits_remove), h8500-tdep.c (h8500_addr_bits_remove), + m88k-tdep.c (m88k_addr_bits_remove): Function to clean up an + address. + * config/z8k/tm-z8k.h, config/w65/tm-w65.h, config/m88k/tm-m88k.h, + config/h8500/tm-h8500.h: Define ADDR_BITS_REMOVE to call targets + corresponding function. + * z8k-tdep.c (saved_pc_after_call): Update. + Sat Nov 28 12:24:31 1998 Andrew Cagney * config/z8k/tm-z8k.h, config/w65/tm-w65.h, config/vax/tm-vax.h, diff --git a/gdb/config/h8500/tm-h8500.h b/gdb/config/h8500/tm-h8500.h index 22e5061b762..8f7d9664efd 100644 --- a/gdb/config/h8500/tm-h8500.h +++ b/gdb/config/h8500/tm-h8500.h @@ -251,7 +251,8 @@ extern void h8500_pop_frame PARAMS ((void)); typedef unsigned short INSN_WORD; -#define ADDR_BITS_REMOVE(addr) ((addr) & 0xffffff) +extern CORE_ADDR h8500_addr_bits_remove PARAMS ((CORE_ADDR)); +#define ADDR_BITS_REMOVE(addr) h8500_addr_bits_remove (addr) #define read_memory_short(x) (read_memory_integer(x,2) & 0xffff) diff --git a/gdb/config/m88k/tm-m88k.h b/gdb/config/m88k/tm-m88k.h index f5c6dc502fd..390cdef96ea 100644 --- a/gdb/config/m88k/tm-m88k.h +++ b/gdb/config/m88k/tm-m88k.h @@ -63,7 +63,8 @@ extern CORE_ADDR skip_prologue (); to realize that those two bits are not really a part of the address of an instruction. Shrug. */ -#define ADDR_BITS_REMOVE(addr) ((addr) & ~3) +extern CORE_ADDR m88k_addr_bits_remove PARAMS ((CORE_ADDR)); +#define ADDR_BITS_REMOVE(addr) m88k_addr_bits_remove (addr) /* Immediately after a function call, return the saved pc. Can't always go through the frames for this because on some machines diff --git a/gdb/config/w65/tm-w65.h b/gdb/config/w65/tm-w65.h index 6809f931ed7..2e354bbb18f 100644 --- a/gdb/config/w65/tm-w65.h +++ b/gdb/config/w65/tm-w65.h @@ -191,7 +191,8 @@ extern CORE_ADDR w65_skip_prologue (); typedef unsigned short INSN_WORD; -#define ADDR_BITS_REMOVE(addr) ((addr) & 0xffffff) +extern CORE_ADDR w65_addr_bits_remove PARAMS ((CORE_ADDR)); +#define ADDR_BITS_REMOVE(addr) w65_addr_bits_remove (addr) #define CALL_DUMMY_LENGTH 10 diff --git a/gdb/config/z8k/tm-z8k.h b/gdb/config/z8k/tm-z8k.h index 8800a9ceaba..8ec1356b1a9 100644 --- a/gdb/config/z8k/tm-z8k.h +++ b/gdb/config/z8k/tm-z8k.h @@ -263,7 +263,8 @@ extern void z8k_pop_frame PARAMS ((void)); #define SP_ARG0 (1 * 4) -#define ADDR_BITS_REMOVE(x) addr_bits_remove(x) +extern CORE_ADDR z8k_addr_bits_remove PARAMS ((CORE_ADDR)); +#define ADDR_BITS_REMOVE(addr) z8k_addr_bits_remove (addr) int sim_z8001_mode; #define BIG (sim_z8001_mode) diff --git a/gdb/h8500-tdep.c b/gdb/h8500-tdep.c index e66bcc3dbf6..49fab2d54e5 100644 --- a/gdb/h8500-tdep.c +++ b/gdb/h8500-tdep.c @@ -98,6 +98,13 @@ h8500_skip_prologue (start_pc) return start_pc; } +CORE_ADDR +h8500_addr_bits_remove (addr) + CORE_ADDR addr; +{ + return ((addr) & 0xffffff); +} + /* Given a GDB frame, determine the address of the calling function's frame. This will be used to create a new GDB frame struct, and then INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c index f74560e1d83..7a755082a6d 100644 --- a/gdb/m88k-tdep.c +++ b/gdb/m88k-tdep.c @@ -36,6 +36,21 @@ void frame_find_saved_regs (); int target_is_m88110 = 0; +/* The m88k kernel aligns all instructions on 4-byte boundaries. The + kernel also uses the least significant two bits for its own hocus + pocus. When gdb receives an address from the kernel, it needs to + preserve those right-most two bits, but gdb also needs to be careful + to realize that those two bits are not really a part of the address + of an instruction. Shrug. */ + +CORE_ADDR +m88k_addr_bits_remove (addr) + CORE_ADDR addr; +{ + return ((addr) & ~3); +} + + /* Given a GDB frame, determine the address of the calling function's frame. This will be used to create a new GDB frame struct, and then INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. diff --git a/gdb/w65-tdep.c b/gdb/w65-tdep.c index e099f71e65a..9546616af4e 100644 --- a/gdb/w65-tdep.c +++ b/gdb/w65-tdep.c @@ -42,10 +42,10 @@ w65_frame_saved_pc (frame) } CORE_ADDR -addr_bits_remove (x) - CORE_ADDR x; +w65_addr_bits_remove (addr) + CORE_ADDR addr; { - return x; + return ((addr) & 0xffffff); } read_memory_pointer (x) diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c index 569605606ab..29e9f6bafa3 100644 --- a/gdb/z8k-tdep.c +++ b/gdb/z8k-tdep.c @@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "dis-asm.h" #include "gdbcore.h" + /* Return the saved PC from this frame. If the frame has a memory copy of SRP_REGNUM, use that. If not, @@ -143,10 +144,10 @@ z8k_skip_prologue (start_pc) } CORE_ADDR -addr_bits_remove (x) - CORE_ADDR x; +z8k_addr_bits_remove (addr) + CORE_ADDR addr; { - return x & PTR_MASK; + return (addr & PTR_MASK); } int @@ -293,7 +294,7 @@ frame_find_saved_regs (fip, fsrp) int saved_pc_after_call () { - return addr_bits_remove + return ADDR_BITS_REMOVE (read_memory_integer (read_register (SP_REGNUM), PTR_SIZE)); }