This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH/SPARC] Fix long double problems
- From: Mark Kettenis <kettenis at chello dot nl>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 31 Dec 2003 21:47:37 +0100 (CET)
- Subject: [PATCH/SPARC] Fix long double problems
This makes sure long double works correctly on those SPARC targets
where a long double really is a long double (and not the same as an
ordinary double). Committed to the branch.
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* sparc-tdep.c: Include "floatformat.h".
(floatformat_sparc_quad): New define.
(sparc32_gdbarch_init): Set long_double_format to
&floatformat_sparc_quad.
* sparc-linux-tdep.c: Include "floatformat.h".
(sparc32_linux_init_abi): Set long_double_format to
&floatformat_ieee_double_big.
* sparcnbsd-tdep.c: Likewise.
Index: sparc-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/Attic/sparc-linux-tdep.c,v
retrieving revision 1.1.2.6
diff -u -p -r1.1.2.6 sparc-linux-tdep.c
--- sparc-linux-tdep.c 21 Dec 2003 23:13:59 -0000 1.1.2.6
+++ sparc-linux-tdep.c 31 Dec 2003 20:41:59 -0000
@@ -20,6 +20,7 @@
Boston, MA 02111-1307, USA. */
#include "defs.h"
+#include "floatformat.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
@@ -291,6 +292,7 @@ sparc32_linux_init_abi (struct gdbarch_i
/* GNU/Linux doesn't support the 128-bit `long double' from the psABI. */
set_gdbarch_long_double_bit (gdbarch, 64);
+ set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
set_gdbarch_pc_in_sigtramp (gdbarch, sparc32_linux_pc_in_sigtramp);
frame_unwind_append_sniffer (gdbarch, sparc32_linux_sigtramp_frame_sniffer);
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.127.2.10
diff -u -p -r1.127.2.10 sparc-tdep.c
--- sparc-tdep.c 31 Dec 2003 20:20:07 -0000 1.127.2.10
+++ sparc-tdep.c 31 Dec 2003 20:42:00 -0000
@@ -22,6 +22,7 @@
#include "defs.h"
#include "arch-utils.h"
#include "dis-asm.h"
+#include "floatformat.h"
#include "frame.h"
#include "frame-base.h"
#include "frame-unwind.h"
@@ -60,6 +61,10 @@
code that can handle both. The 64-bit specific code lives in
sparc64-tdep.c; don't add any here. */
+/* The SPARC Floating-Point Quad-Precision format is similar to
+ big-endian IA-64 Quad-recision format. */
+#define floatformat_sparc_quad floatformat_ia64_quad_big
+
/* The stack pointer is offset from the stack frame by a BIAS of 2047
(0x7ff) for 64-bit code. BIAS is likely to be defined on SPARC
hosts, so undefine it first. */
@@ -1020,6 +1025,7 @@ sparc32_gdbarch_init (struct gdbarch_inf
tdep->plt_entry_size = 0;
set_gdbarch_long_double_bit (gdbarch, 128);
+ set_gdbarch_long_double_format (gdbarch, &floatformat_sparc_quad);
set_gdbarch_num_regs (gdbarch, SPARC32_NUM_REGS);
set_gdbarch_register_name (gdbarch, sparc32_register_name);
Index: sparcnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparcnbsd-tdep.c,v
retrieving revision 1.7.2.4
diff -u -p -r1.7.2.4 sparcnbsd-tdep.c
--- sparcnbsd-tdep.c 29 Dec 2003 17:26:51 -0000 1.7.2.4
+++ sparcnbsd-tdep.c 31 Dec 2003 20:42:00 -0000
@@ -21,6 +21,7 @@
Boston, MA 02111-1307, USA. */
#include "defs.h"
+#include "floatformat.h"
#include "frame.h"
#include "frame-unwind.h"
#include "gdbcore.h"
@@ -265,6 +266,7 @@ sparc32nbsd_init_abi (struct gdbarch_inf
{
/* NetBSD doesn't support the 128-bit `long double' from the psABI. */
set_gdbarch_long_double_bit (gdbarch, 64);
+ set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
set_gdbarch_pc_in_sigtramp (gdbarch, sparc32nbsd_pc_in_sigtramp);
frame_unwind_append_sniffer (gdbarch, sparc32nbsd_sigtramp_frame_sniffer);