aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-11-08 18:32:08 +0000
committerAndrew Cagney <cagney@redhat.com>2001-11-08 18:32:08 +0000
commita62cc96ec59fbc02e3a8135f83bb8d9ce86294ca (patch)
tree5452f4a7d63cdc71e579a2b7dad79ccbbc825daf /gdb/i386-tdep.c
parent8ea43c6d5a6fdc04c59b97817f4041bdfe2d2219 (diff)
downloadgdb-a62cc96ec59fbc02e3a8135f83bb8d9ce86294ca.zip
gdb-a62cc96ec59fbc02e3a8135f83bb8d9ce86294ca.tar.gz
gdb-a62cc96ec59fbc02e3a8135f83bb8d9ce86294ca.tar.bz2
Enable multi-arch for i386.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 276c018..bdb5875 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -34,9 +34,12 @@
#include "regcache.h"
#include "doublest.h"
#include "value.h"
-
+#include "i386-tdep.h"
#include "gdb_assert.h"
+#undef XMALLOC
+#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
+
/* Names of the registers. The first 10 registers match the register
numbering scheme used by GCC for stabs and DWARF. */
static char *i386_register_names[] =
@@ -1195,12 +1198,48 @@ gdb_print_insn_i386 (bfd_vma memaddr, disassemble_info *info)
+struct gdbarch *
+i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+{
+ struct gdbarch_tdep *tdep
+ struct gdbarch *gdbarch;
+
+ /* For the moment there is only one i386 architecture. */
+ if (arches != NULL)
+ return arches->gdbarch;
+
+ /* Allocate space for the new architecture. */
+ tdep = XMALLOC (struct gdbarch_tdep);
+ gdbarch = gdbarch_alloc (&info, tdep);
+
+ set_gdbarch_use_generic_dummy_frames (gdbarch, 0);
+
+ /* Call dummy code. */
+ set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
+ set_gdbarch_call_dummy_breakpoint_offset (gdbarch, 5);
+ set_gdbarch_call_dummy_breakpoint_offset_p (gdbarch, 1);
+ set_gdbarch_call_dummy_p (gdbarch, 1);
+ set_gdbarch_call_dummy_stack_adjust_p (gdbarch, 0);
+
+ set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register);
+ set_gdbarch_push_arguments (gdbarch, i386_push_arguments);
+
+ set_gdbarch_pc_in_call_dummy (gdbarch, pc_in_call_dummy_on_stack);
+
+ /* NOTE: tm-i386nw.h and tm-i386v4.h override this. */
+ set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
+
+ return gdbarch;
+}
+
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_i386_tdep (void);
void
_initialize_i386_tdep (void)
{
+ register_gdbarch_init (bfd_arch_i386, i386_gdbarch_init);
+
/* Initialize the table saying where each register starts in the
register file. */
{