aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2002-08-13 13:10:42 +0000
committerStephane Carrez <stcarrez@nerim.fr>2002-08-13 13:10:42 +0000
commit81967506b7550d22cfa251366f5ceb7e1f9ec87b (patch)
tree3083a4ccef04c305ce4b480906ccfffe3d1e090c /gdb
parent338653f54933e2581ba3efb396abd568dfcfcbdd (diff)
downloadgdb-81967506b7550d22cfa251366f5ceb7e1f9ec87b.zip
gdb-81967506b7550d22cfa251366f5ceb7e1f9ec87b.tar.gz
gdb-81967506b7550d22cfa251366f5ceb7e1f9ec87b.tar.bz2
* m68hc11-tdep.c (m68hc11_gdbarch_init): Set int, double and long
double sizes according to ELF ABI flags. (gdbarch_tdep): Record elf_flags.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/m68hc11-tdep.c25
2 files changed, 27 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d7209ae..ef871a5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2002-08-13 Stephane Carrez <stcarrez@nerim.fr>
+ * m68hc11-tdep.c (m68hc11_gdbarch_init): Set int, double and long
+ double sizes according to ELF ABI flags.
+ (gdbarch_tdep): Record elf_flags.
+
+2002-08-13 Stephane Carrez <stcarrez@nerim.fr>
+
* m68hc11-tdep.c (M6812_OP_PSHX, M6812_OP_PSHY): New defines.
(m6812_prolog): They can appear in 68HC12 function prologue.
(m68hc11_frame_chain): Cleanup.
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 125d40f..11237bb 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -36,6 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "target.h"
#include "opcode/m68hc11.h"
+#include "elf/m68hc11.h"
+#include "elf-bfd.h"
/* Register numbers of various important registers.
Note that some of these values are "real" register numbers,
@@ -89,6 +91,9 @@ struct gdbarch_tdep
/* Description of instructions in the prologue. */
struct insn_sequence *prologue;
+
+ /* ELF flags for ABI. */
+ int elf_flags;
};
#define M6811_TDEP gdbarch_tdep (current_gdbarch)
@@ -1029,20 +1034,32 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
{0};
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
+ int elf_flags;
soft_reg_initialized = 0;
-
+
+ /* Extract the elf_flags if available. */
+ if (info.abfd != NULL
+ && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
+ elf_flags = elf_elfheader (info.abfd)->e_flags;
+ else
+ elf_flags = 0;
+
/* try to find a pre-existing architecture */
for (arches = gdbarch_list_lookup_by_info (arches, &info);
arches != NULL;
arches = gdbarch_list_lookup_by_info (arches->next, &info))
{
+ if (gdbarch_tdep (arches->gdbarch)->elf_flags != elf_flags)
+ continue;
+
return arches->gdbarch;
}
/* Need a new architecture. Fill in a target specific vector. */
tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
+ tdep->elf_flags = elf_flags;
switch (info.bfd_arch_info->arch)
{
@@ -1065,10 +1082,10 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
programs. The size of these types should normally be set
according to the dwarf2 debug information. */
set_gdbarch_short_bit (gdbarch, 16);
- set_gdbarch_int_bit (gdbarch, 16);
+ set_gdbarch_int_bit (gdbarch, elf_flags & E_M68HC11_I32 ? 32 : 16);
set_gdbarch_float_bit (gdbarch, 32);
- set_gdbarch_double_bit (gdbarch, 64);
- set_gdbarch_long_double_bit (gdbarch, 64);
+ set_gdbarch_double_bit (gdbarch, elf_flags & E_M68HC11_F64 ? 64 : 32);
+ set_gdbarch_long_double_bit (gdbarch, elf_flags & E_M68HC11_F64 ? 64 : 32);
set_gdbarch_long_bit (gdbarch, 32);
set_gdbarch_ptr_bit (gdbarch, 16);
set_gdbarch_long_long_bit (gdbarch, 64);