X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fh8300-tdep.c;h=acc2da93a41c17bc4d13b7507450b8d491dae852;hb=ee9a09e959a5b7c152cc72028d4f6c879bc901c9;hp=10ef7962e2f9255a5eadf8ad1fee9c9cd9218355;hpb=61baf725eca99af2569262d10aca03dcde2698f6;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index 10ef7962e2..acc2da93a4 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -662,18 +662,17 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (argument = 0; argument < nargs; argument++) { - struct cleanup *back_to; struct type *type = value_type (args[argument]); int len = TYPE_LENGTH (type); char *contents = (char *) value_contents (args[argument]); /* Pad the argument appropriately. */ int padded_len = align_up (len, wordsize); - gdb_byte *padded = (gdb_byte *) xmalloc (padded_len); - back_to = make_cleanup (xfree, padded); + /* Use std::vector here to get zero initialization. */ + std::vector padded (padded_len); - memset (padded, 0, padded_len); - memcpy (len < wordsize ? padded + padded_len - len : padded, + memcpy ((len < wordsize ? padded.data () + padded_len - len + : padded.data ()), contents, len); /* Could the argument fit in the remaining registers? */ @@ -684,7 +683,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (len > wordsize && len % wordsize) { /* I feel so unclean. */ - write_memory (sp + stack_offset, padded, padded_len); + write_memory (sp + stack_offset, padded.data (), padded_len); stack_offset += padded_len; /* That's right --- even though we passed the argument @@ -702,7 +701,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, for (offset = 0; offset < padded_len; offset += wordsize) { ULONGEST word - = extract_unsigned_integer (padded + offset, + = extract_unsigned_integer (&padded[offset], wordsize, byte_order); regcache_cooked_write_unsigned (regcache, reg++, word); } @@ -711,15 +710,13 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, else { /* It doesn't fit in registers! Onto the stack it goes. */ - write_memory (sp + stack_offset, padded, padded_len); + write_memory (sp + stack_offset, padded.data (), padded_len); stack_offset += padded_len; /* Once one argument has spilled onto the stack, all subsequent arguments go on the stack. */ reg = E_ARGLAST_REGNUM + 1; } - - do_cleanups (back_to); } /* Store return address. */ @@ -742,7 +739,7 @@ static void h8300_extract_return_value (struct type *type, struct regcache *regcache, gdb_byte *valbuf) { - struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch *gdbarch = regcache->arch (); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int len = TYPE_LENGTH (type); ULONGEST c, addr; @@ -779,7 +776,7 @@ static void h8300h_extract_return_value (struct type *type, struct regcache *regcache, gdb_byte *valbuf) { - struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch *gdbarch = regcache->arch (); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); ULONGEST c; @@ -844,7 +841,7 @@ static void h8300_store_return_value (struct type *type, struct regcache *regcache, const gdb_byte *valbuf) { - struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch *gdbarch = regcache->arch (); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); ULONGEST val; @@ -873,7 +870,7 @@ static void h8300h_store_return_value (struct type *type, struct regcache *regcache, const gdb_byte *valbuf) { - struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch *gdbarch = regcache->arch (); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); ULONGEST val; @@ -954,7 +951,7 @@ h8300_register_name (struct gdbarch *gdbarch, int regno) { /* The register names change depending on which h8300 processor type is selected. */ - static char *register_names[] = { + static const char *register_names[] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "", "pc", "cycles", "tick", "inst", "ccr", /* pseudo register */ @@ -971,7 +968,7 @@ h8300_register_name (struct gdbarch *gdbarch, int regno) static const char * h8300s_register_name (struct gdbarch *gdbarch, int regno) { - static char *register_names[] = { + static const char *register_names[] = { "er0", "er1", "er2", "er3", "er4", "er5", "er6", "sp", "", "pc", "cycles", "", "tick", "inst", "mach", "macl", @@ -989,7 +986,7 @@ h8300s_register_name (struct gdbarch *gdbarch, int regno) static const char * h8300sx_register_name (struct gdbarch *gdbarch, int regno) { - static char *register_names[] = { + static const char *register_names[] = { "er0", "er1", "er2", "er3", "er4", "er5", "er6", "sp", "", "pc", "cycles", "", "tick", "inst", "mach", "macl", "sbr", "vbr", @@ -1275,7 +1272,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_return_value (gdbarch, h8300_return_value); - set_gdbarch_print_insn (gdbarch, print_insn_h8300); break; case bfd_mach_h8300h: case bfd_mach_h8300hn: @@ -1296,7 +1292,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); } set_gdbarch_return_value (gdbarch, h8300h_return_value); - set_gdbarch_print_insn (gdbarch, print_insn_h8300h); break; case bfd_mach_h8300s: case bfd_mach_h8300sn: @@ -1317,7 +1312,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); } set_gdbarch_return_value (gdbarch, h8300h_return_value); - set_gdbarch_print_insn (gdbarch, print_insn_h8300s); break; case bfd_mach_h8300sx: case bfd_mach_h8300sxn: @@ -1338,7 +1332,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bit (gdbarch, 2 * TARGET_CHAR_BIT); } set_gdbarch_return_value (gdbarch, h8300h_return_value); - set_gdbarch_print_insn (gdbarch, print_insn_h8300s); break; } @@ -1381,6 +1374,10 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT); + + set_gdbarch_wchar_bit (gdbarch, 2 * TARGET_CHAR_BIT); + set_gdbarch_wchar_signed (gdbarch, 0); + set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_double_format (gdbarch, floatformats_ieee_single); set_gdbarch_long_double_bit (gdbarch, 4 * TARGET_CHAR_BIT); @@ -1396,8 +1393,6 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) } -extern initialize_file_ftype _initialize_h8300_tdep; /* -Wmissing-prototypes */ - void _initialize_h8300_tdep (void) {