diff options
Diffstat (limited to 'gdb/z80-tdep.c')
-rw-r--r-- | gdb/z80-tdep.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c index 7b9a7e2..9d453cd 100644 --- a/gdb/z80-tdep.c +++ b/gdb/z80-tdep.c @@ -54,19 +54,21 @@ __gdb_break_handler: next frame - frame of caller, which has called current function */ -struct gdbarch_tdep +struct z80_gdbarch_tdep : gdbarch_tdep { /* Number of bytes used for address: 2 bytes for all Z80 family 3 bytes for eZ80 CPUs operating in ADL mode */ - int addr_length; + int addr_length = 0; /* Type for void. */ - struct type *void_type; + struct type *void_type = nullptr; + /* Type for a function returning void. */ - struct type *func_void_type; + struct type *func_void_type = nullptr; + /* Type for a pointer to a function. Used for the type of PC. */ - struct type *pc_type; + struct type *pc_type = nullptr; }; /* At any time stack frame contains following parts: @@ -305,7 +307,8 @@ z80_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end, struct z80_unwind_cache *info) { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int addr_len = gdbarch_tdep (gdbarch)->addr_length; + z80_gdbarch_tdep *tdep = (z80_gdbarch_tdep *) gdbarch_tdep (gdbarch); + int addr_len = tdep->addr_length; gdb_byte prologue[32]; /* max prologue is 24 bytes: __interrupt with local array */ int pos = 0; int len; @@ -560,7 +563,8 @@ z80_frame_unwind_cache (struct frame_info *this_frame, gdb_byte buf[sizeof(void*)]; struct z80_unwind_cache *info; struct gdbarch *gdbarch = get_frame_arch (this_frame); - int addr_len = gdbarch_tdep (gdbarch)->addr_length; + z80_gdbarch_tdep *tdep = (z80_gdbarch_tdep *) gdbarch_tdep (gdbarch); + int addr_len = tdep->addr_length; if (*this_prologue_cache) return (struct z80_unwind_cache *) *this_prologue_cache; @@ -692,7 +696,7 @@ z80_frame_prev_register (struct frame_info *this_frame, ULONGEST pc; gdb_byte buf[3]; struct gdbarch *gdbarch = get_frame_arch (this_frame); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + z80_gdbarch_tdep *tdep = (z80_gdbarch_tdep *) gdbarch_tdep (gdbarch); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); read_memory (info->saved_regs[Z80_PC_REGNUM].addr (), @@ -745,11 +749,12 @@ z80_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size) } else /* kind is non-RST address, use CALL instead, but it is dungerous */ { + z80_gdbarch_tdep *tdep = (z80_gdbarch_tdep *) gdbarch_tdep (gdbarch); gdb_byte *p = break_insn; *p++ = 0xcd; *p++ = (kind >> 0) & 0xff; *p++ = (kind >> 8) & 0xff; - if (gdbarch_tdep (gdbarch)->addr_length > 2) + if (tdep->addr_length > 2) *p++ = (kind >> 16) & 0xff; *size = p - break_insn; } @@ -1077,7 +1082,6 @@ static struct gdbarch * z80_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) { struct gdbarch *gdbarch; - struct gdbarch_tdep *tdep; struct gdbarch_list *best_arch; tdesc_arch_data_up tdesc_data; unsigned long mach = info.bfd_arch_info->mach; @@ -1119,7 +1123,7 @@ z80_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) } /* None found, create a new architecture from the information provided. */ - tdep = XCNEW (struct gdbarch_tdep); + z80_gdbarch_tdep *tdep = new z80_gdbarch_tdep; gdbarch = gdbarch_alloc (&info, tdep); if (mach == bfd_mach_ez80_adl) |