This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] New GDB target iq2000
- From: Jim Blandy <jimb at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: 01 Mar 2005 17:11:31 -0500
- Subject: Re: [RFA] New GDB target iq2000
- References: <20050222114141.GA18314@cygbert.vinschen.de>
Hi, Corinna.
> +/* Function: gdbarch_init
> + Initializer function for the iq2000 gdbarch vector.
> + Called by gdbarch. Sets up the gdbarch vector(s) for this target. */
> +
> +static struct gdbarch *
> +iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
> +{
> + struct gdbarch *gdbarch;
> +
> + /* Look up list for candidates - only one. */
> + arches = gdbarch_list_lookup_by_info (arches, &info);
> + if (arches != NULL)
> + return arches->gdbarch;
> +
> + gdbarch = gdbarch_alloc (&info, NULL);
> +
> + set_gdbarch_num_regs (gdbarch, E_NUM_REGS);
> + set_gdbarch_num_pseudo_regs (gdbarch, 0);
> + set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
> + set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
> + set_gdbarch_register_name (gdbarch, iq2000_register_name);
> + set_gdbarch_address_to_pointer (gdbarch, iq2000_address_to_pointer);
> + set_gdbarch_pointer_to_address (gdbarch, iq2000_pointer_to_address);
> + set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> + set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
> + set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> + set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> + set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
> + set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
> + set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
> + set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
> + set_gdbarch_float_format (gdbarch, & floatformat_ieee_single_big);
> + set_gdbarch_double_format (gdbarch, & floatformat_ieee_double_big);
> + set_gdbarch_long_double_format (gdbarch, & floatformat_ieee_double_big);
> + set_gdbarch_return_value (gdbarch, iq2000_return_value);
> + set_gdbarch_breakpoint_from_pc (gdbarch, iq2000_breakpoint_from_pc);
> + set_gdbarch_frame_args_skip (gdbarch, 0);
> + set_gdbarch_skip_prologue (gdbarch, iq2000_skip_prologue);
> + set_gdbarch_decr_pc_after_break (gdbarch, 0);
> + set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
> + set_gdbarch_print_insn (gdbarch, print_insn_iq2000);
> + set_gdbarch_register_type (gdbarch, iq2000_register_type);
> + set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
> + set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
> + set_gdbarch_unwind_pc (gdbarch, iq2000_unwind_pc);
> + set_gdbarch_unwind_dummy_id (gdbarch, iq2000_unwind_dummy_id);
> + frame_base_set_default (gdbarch, &iq2000_frame_base);
> + set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call);
> +
> + gdbarch_init_osabi (info, gdbarch);
> +
> + frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
> + frame_unwind_append_sniffer (gdbarch, iq2000_frame_sniffer);
> +
> + return gdbarch;
> +}
I think all the calls to set_gdbarch_<type>_bit can be left out,
because they just re-state the default values. Same for
decr_pc_after_break, no?
+static enum return_value_convention
+iq2000_return_value (struct gdbarch *gdbarch, struct type *type,
+ struct regcache *regcache,
+ void *readbuf, const void *writebuf)
+{
+ if (iq2000_use_struct_convention (type))
+ return RETURN_VALUE_STRUCT_CONVENTION;
+ if (writebuf)
+ iq2000_store_return_value (type, regcache, writebuf);
+ else if (readbuf)
+ iq2000_extract_return_value (type, regcache, readbuf);
+ return RETURN_VALUE_REGISTER_CONVENTION;
+}
The other return_value implementations I've seen allow one to pass
both a readbuf and a writebuf, and do the read before the write. I
can't find any place where it's actually used this way, but it seems
to be allowed by the interface. In any case, it's easy enough to make
iq2000_return_value behave like the others.