Skip to content
Commit 3eba3a01 authored by Tom Tromey's avatar Tom Tromey
Browse files

Various m68k fixes for gdb

Recently I tried the m68k port of gdb.  It had some issues, which are
fixed in this patch.

* Various types of return values were not being handled properly.  In
  particular:

  * arrays are returned by following the same convention as
    structures.  This matters in languages like Ada, where an array
    can in fact be returned as a value.

  * "long double" was not being handled correctly in
    m68k_svr4_return_value.

  * GCC's m68k back end does not return vector types in registers, so
    change gdb to follow.

  * GCC's m68k back end doesn't faithfully implement the ABI, and so
    some objects with unusual size (not possible in C, but possible in
    Ada) are not returned correctly.

* gcc implements an m68k ABI variant that it simply describes as
  "embedded".  This ABI is similar to the SVR4 ABI, but rather than
  returning pointer-typed values in %a0, such values are returned in
  %d0.  To support this, an ELF osabi sniffer is added.

* Commit 85f7484a ("m68k: tag floating-point ABI used") adds an
  attribute that can be used to recognize when hard- or soft-float is
  in use.  gdb can now read this tag and choose the ABI accordingly.

I was unable to run the gdb test suite with this patch.  Instead, I
tested it using qemu and the internal AdaCore test suite.

gdb/ChangeLog
2020-09-14  Tom Tromey  <tromey@adacore.com>

	* m68k-tdep.c (m68k_extract_return_value): Use
	pointer_result_regnum.
	(m68k_store_return_value): Likewise.
	(m68k_reg_struct_return_p): Handle vectors and arrays.
	(m68k_return_value): Handle arrays.
	(m68k_svr4_return_value): Fix single-element aggregate handling.
	Handle long double.  Adjust for embedded ABI.
	(m68k_svr4_init_abi): Set pointer_result_regnum.
	(m68k_embedded_init_abi): New function.
	(m68k_gdbarch_init): Handle Tag_GNU_M68K_ABI_FP.
	(m68k_osabi_sniffer): New function.
	(_initialize_m68k_tdep): Register osabi sniffer.
	* m68k-tdep.h (struct gdbarch_tdep) <pointer_result_regnum>: New
	member.
parent 33f4dd48
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment