[PATCH v2 2/3] Add FreeBSD/mips architecture.

John Baldwin jhb@freebsd.org
Fri Dec 9 19:02:00 GMT 2016


On Thursday, December 08, 2016 02:13:17 PM Luis Machado wrote:
> On 12/08/2016 02:08 PM, John Baldwin wrote:
> > On Thursday, December 08, 2016 12:47:42 PM Luis Machado wrote:
> >> On 12/06/2016 03:00 PM, John Baldwin wrote:
> >>> +static void
> >>> +mips_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
> >>> +{
> >>> +  enum mips_abi abi = mips_abi (gdbarch);
> >>> +
> >>> +  /* Generic FreeBSD support.  */
> >>> +  fbsd_init_abi (info, gdbarch);
> >>> +
> >>> +  set_gdbarch_software_single_step (gdbarch, mips_software_single_step);
> >>> +
> >>> +  switch (abi)
> >>> +    {
> >>> +      case MIPS_ABI_O32:
> >>> +	tramp_frame_prepend_unwinder (gdbarch, &mips_fbsd_sigframe);
> >>> +	break;
> >>> +      case MIPS_ABI_N32:
> >>> +	break;
> >>> +      case MIPS_ABI_N64:
> >>> +	tramp_frame_prepend_unwinder (gdbarch, &mips64_fbsd_sigframe);
> >>> +	break;
> >>> +    }
> >>> +
> >>> +  set_gdbarch_iterate_over_regset_sections
> >>> +    (gdbarch, mips_fbsd_iterate_over_regset_sections);
> >>> +
> >>> +  /* FreeBSD/mips has SVR4-style shared libraries.  */
> >>> +  set_solib_svr4_fetch_link_map_offsets
> >>> +    (gdbarch, (gdbarch_ptr_bit (gdbarch) == 32 ?
> >>> +	       mips_fbsd_ilp32_fetch_link_map_offsets :
> >>> +	       mips_fbsd_lp64_fetch_link_map_offsets));
> >>> +}
> >>> +
> >>> +
> >>
> >> Do we need to set a reasonable default in case abi is something unknown
> >> or undefined? Maybe as a fail-safe?
> >
> > Default in which sense, for the sigframe unwinder or something else?
> > I don't think there's any support in any toolchains I'm aware of to
> > generate FreeBSD binaries with other ABIs (no O64 in particular).
> >
> 
> For the sigframe unwinders. I was mostly concerned about the switch 
> construct without a default case for something invalid.

Well, in that case we simply won't have an unwinder for signal frames, but
the target will work for other things.  That said, I don't know of any
existing toolchain that supports generating FreeBSD/mips binaries that
supports any ABIs other than o32, n32, and n64.  Specifically, FreeBSD
does not have any o64 support, and binutils doesn't have a linker emulation
for any other ABIs on FreeBSD/mips.

-- 
John Baldwin



More information about the Gdb-patches mailing list