This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, M68K] Handle lack of FPU registers

This patch by Daniel Jacobowitz fixes handling of FPU-less ColdFire CPUs.

Note: m68k_gdbarch_init() invokes set_gdbarch_fp0_regnum twice, the first call is conditioned on fpregs_present, the second invocation is erroneous and, thus, should be removed.

Dan, feel free to check in this patch yourself.


Maxim Kuvyrkov
(650) 331-3385 x724
2009-11-17  Daniel Jacobowitz  <>

	* m68k-tdep.c (m68k_register_name): Check fpregs_present.
	(m68k_gdbarch_init): Remove a duplicate of set_gdbarch_fp0_regnum. |    5 +++++
 gdb/m68k-tdep.c      |    4 +++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index dcf8779..9cbbbb3 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -179,6 +179,9 @@ m68k_register_name (struct gdbarch *gdbarch, int regnum)
   if (regnum < 0 || regnum >= ARRAY_SIZE (m68k_register_names))
     internal_error (__FILE__, __LINE__,
 		    _("m68k_register_name: illegal register number %d"), regnum);
+  else if (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FPI_REGNUM
+	   && gdbarch_tdep (gdbarch)->fpregs_present == 0)
+    return "";
     return m68k_register_names[regnum];
@@ -1190,7 +1193,6 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_sp_regnum (gdbarch, M68K_SP_REGNUM);
   set_gdbarch_pc_regnum (gdbarch, M68K_PC_REGNUM);
   set_gdbarch_ps_regnum (gdbarch, M68K_PS_REGNUM);
-  set_gdbarch_fp0_regnum (gdbarch, M68K_FP0_REGNUM);
   set_gdbarch_convert_register_p (gdbarch, m68k_convert_register_p);
   set_gdbarch_register_to_value (gdbarch,  m68k_register_to_value);
   set_gdbarch_value_to_register (gdbarch, m68k_value_to_register);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]