aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorDavid Carlton <carlton@bactrian.org>2003-02-07 19:18:06 +0000
committerDavid Carlton <carlton@bactrian.org>2003-02-07 19:18:06 +0000
commit9ec3c59b028a60cb6ab45f53f06cba1a24395875 (patch)
tree660b3ce9f1b465c31b507dcbdd2dc5fed7bbc0a9 /gdb/gdbarch.c
parentf79355f07b5ace625d507e1f6308728bcdc757de (diff)
downloadgdb-9ec3c59b028a60cb6ab45f53f06cba1a24395875.zip
gdb-9ec3c59b028a60cb6ab45f53f06cba1a24395875.tar.gz
gdb-9ec3c59b028a60cb6ab45f53f06cba1a24395875.tar.bz2
2003-02-07 David Carlton <carlton@math.stanford.edu>
* Merge with mainline; tag is carlton_dictionary-20030207-merge.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c171
1 files changed, 120 insertions, 51 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 938d9fa..10f6397 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -1,7 +1,7 @@
/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -65,6 +65,7 @@
#include "gdb_string.h"
#include "gdb-events.h"
#include "reggroups.h"
+#include "osabi.h"
/* Static function declarations */
@@ -93,6 +94,7 @@ struct gdbarch
/* basic architectural information */
const struct bfd_arch_info * bfd_arch_info;
int byte_order;
+ enum gdb_osabi osabi;
/* target specific vector. */
struct gdbarch_tdep *tdep;
@@ -199,7 +201,6 @@ struct gdbarch
gdbarch_deprecated_init_frame_pc_ftype *deprecated_init_frame_pc;
int believe_pcc_promotion;
int believe_pcc_promotion_type;
- gdbarch_coerce_float_to_double_ftype *coerce_float_to_double;
gdbarch_get_saved_register_ftype *get_saved_register;
gdbarch_register_convertible_ftype *register_convertible;
gdbarch_register_convert_to_virtual_ftype *register_convert_to_virtual;
@@ -290,6 +291,7 @@ struct gdbarch startup_gdbarch =
/* basic architecture information */
&bfd_default_arch_struct,
BFD_ENDIAN_BIG,
+ GDB_OSABI_UNKNOWN,
/* target specific vector and its dump routine */
NULL, NULL,
/*per-architecture data-pointers and swap regions */
@@ -427,7 +429,6 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
- 0,
generic_in_function_epilogue_p,
construct_inferior_arguments,
0,
@@ -480,6 +481,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->bfd_arch_info = info->bfd_arch_info;
current_gdbarch->byte_order = info->byte_order;
+ current_gdbarch->osabi = info->osabi;
/* Force the explicit initialization of these. */
current_gdbarch->short_bit = 2*TARGET_CHAR_BIT;
@@ -533,7 +535,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->call_dummy_words = legacy_call_dummy_words;
current_gdbarch->sizeof_call_dummy_words = legacy_sizeof_call_dummy_words;
current_gdbarch->call_dummy_stack_adjust_p = -1;
- current_gdbarch->coerce_float_to_double = default_coerce_float_to_double;
current_gdbarch->register_convertible = generic_register_convertible_not;
current_gdbarch->convert_register_p = legacy_convert_register_p;
current_gdbarch->register_to_value = legacy_register_to_value;
@@ -555,7 +556,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
current_gdbarch->frame_args_skip = -1;
current_gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not;
- current_gdbarch->frame_chain_valid = generic_func_frame_chain_valid;
current_gdbarch->frame_args_address = get_frame_base;
current_gdbarch->frame_locals_address = get_frame_base;
current_gdbarch->extra_stack_alignment_needed = 1;
@@ -712,7 +712,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
fprintf_unfiltered (log, "\n\tfix_call_dummy");
/* Skip verify of deprecated_init_frame_pc_first, has predicate */
/* Skip verify of deprecated_init_frame_pc, has predicate */
- /* Skip verify of coerce_float_to_double, invalid_p == 0 */
/* Skip verify of get_saved_register, has predicate */
/* Skip verify of register_convertible, invalid_p == 0 */
/* Skip verify of register_convert_to_virtual, invalid_p == 0 */
@@ -729,9 +728,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
&& (gdbarch->push_dummy_frame == 0))
fprintf_unfiltered (log, "\n\tpush_dummy_frame");
/* Skip verify of push_return_address, has predicate */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->pop_frame == 0))
- fprintf_unfiltered (log, "\n\tpop_frame");
+ /* Skip verify of pop_frame, has predicate */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->store_struct_return == 0))
fprintf_unfiltered (log, "\n\tstore_struct_return");
@@ -740,9 +737,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of extract_struct_value_address, has predicate */
/* Skip verify of deprecated_extract_struct_value_address, has predicate */
/* Skip verify of use_struct_convention, invalid_p == 0 */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->frame_init_saved_regs == 0))
- fprintf_unfiltered (log, "\n\tframe_init_saved_regs");
+ /* Skip verify of frame_init_saved_regs, has predicate */
/* Skip verify of init_extra_frame_info, has predicate */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->skip_prologue == 0))
@@ -766,13 +761,9 @@ verify_gdbarch (struct gdbarch *gdbarch)
&& (gdbarch->frame_args_skip == -1))
fprintf_unfiltered (log, "\n\tframe_args_skip");
/* Skip verify of frameless_function_invocation, invalid_p == 0 */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->frame_chain == 0))
- fprintf_unfiltered (log, "\n\tframe_chain");
- /* Skip verify of frame_chain_valid, invalid_p == 0 */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->frame_saved_pc == 0))
- fprintf_unfiltered (log, "\n\tframe_saved_pc");
+ /* Skip verify of frame_chain, has predicate */
+ /* Skip verify of frame_chain_valid, has predicate */
+ /* Skip verify of frame_saved_pc, has predicate */
/* Skip verify of frame_args_address, invalid_p == 0 */
/* Skip verify of frame_locals_address, invalid_p == 0 */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
@@ -991,7 +982,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: CALL_DUMMY_LENGTH # %s\n",
XSTRING (CALL_DUMMY_LENGTH));
- if (CALL_DUMMY_LOCATION == BEFORE_TEXT_END || CALL_DUMMY_LOCATION == AFTER_TEXT_END)
+ if (gdbarch->call_dummy_length >= 0)
fprintf_unfiltered (file,
"gdbarch_dump: CALL_DUMMY_LENGTH = %d\n",
CALL_DUMMY_LENGTH);
@@ -1075,17 +1066,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->cannot_store_register
/*CANNOT_STORE_REGISTER ()*/);
#endif
-#ifdef COERCE_FLOAT_TO_DOUBLE
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "COERCE_FLOAT_TO_DOUBLE(formal, actual)",
- XSTRING (COERCE_FLOAT_TO_DOUBLE (formal, actual)));
- if (GDB_MULTI_ARCH)
- fprintf_unfiltered (file,
- "gdbarch_dump: COERCE_FLOAT_TO_DOUBLE = <0x%08lx>\n",
- (long) current_gdbarch->coerce_float_to_double
- /*COERCE_FLOAT_TO_DOUBLE ()*/);
-#endif
#ifdef COFF_MAKE_MSYMBOL_SPECIAL
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
@@ -1445,6 +1425,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: FRAME_ARGS_SKIP = %ld\n",
(long) FRAME_ARGS_SKIP);
#endif
+#ifdef FRAME_CHAIN_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "FRAME_CHAIN_P()",
+ XSTRING (FRAME_CHAIN_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: FRAME_CHAIN_P() = %d\n",
+ FRAME_CHAIN_P ());
+#endif
#ifdef FRAME_CHAIN
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -1456,6 +1445,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->frame_chain
/*FRAME_CHAIN ()*/);
#endif
+#ifdef FRAME_CHAIN_VALID_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "FRAME_CHAIN_VALID_P()",
+ XSTRING (FRAME_CHAIN_VALID_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: FRAME_CHAIN_VALID_P() = %d\n",
+ FRAME_CHAIN_VALID_P ());
+#endif
#ifdef FRAME_CHAIN_VALID
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -1467,6 +1465,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->frame_chain_valid
/*FRAME_CHAIN_VALID ()*/);
#endif
+#ifdef FRAME_INIT_SAVED_REGS_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "FRAME_INIT_SAVED_REGS_P()",
+ XSTRING (FRAME_INIT_SAVED_REGS_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: FRAME_INIT_SAVED_REGS_P() = %d\n",
+ FRAME_INIT_SAVED_REGS_P ());
+#endif
#ifdef FRAME_INIT_SAVED_REGS
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
@@ -1503,6 +1510,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->frame_num_args
/*FRAME_NUM_ARGS ()*/);
#endif
+#ifdef FRAME_SAVED_PC_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "FRAME_SAVED_PC_P()",
+ XSTRING (FRAME_SAVED_PC_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: FRAME_SAVED_PC_P() = %d\n",
+ FRAME_SAVED_PC_P ());
+#endif
#ifdef FRAME_SAVED_PC
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -1757,6 +1773,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->pointer_to_address
/*POINTER_TO_ADDRESS ()*/);
#endif
+#ifdef POP_FRAME_P
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "POP_FRAME_P()",
+ XSTRING (POP_FRAME_P ()));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: POP_FRAME_P() = %d\n",
+ POP_FRAME_P ());
+#endif
#ifdef POP_FRAME
#if GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
@@ -2395,6 +2420,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: TARGET_LONG_LONG_BIT = %d\n",
TARGET_LONG_LONG_BIT);
#endif
+#ifdef TARGET_OSABI
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_OSABI # %s\n",
+ XSTRING (TARGET_OSABI));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_OSABI = %ld\n",
+ (long) TARGET_OSABI);
+#endif
#ifdef TARGET_PRINT_INSN
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -2553,6 +2586,15 @@ gdbarch_byte_order (struct gdbarch *gdbarch)
return gdbarch->byte_order;
}
+enum gdb_osabi
+gdbarch_osabi (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_osabi called\n");
+ return gdbarch->osabi;
+}
+
int
gdbarch_short_bit (struct gdbarch *gdbarch)
{
@@ -3871,25 +3913,6 @@ set_gdbarch_believe_pcc_promotion_type (struct gdbarch *gdbarch,
}
int
-gdbarch_coerce_float_to_double (struct gdbarch *gdbarch, struct type *formal, struct type *actual)
-{
- gdb_assert (gdbarch != NULL);
- if (gdbarch->coerce_float_to_double == 0)
- internal_error (__FILE__, __LINE__,
- "gdbarch: gdbarch_coerce_float_to_double invalid");
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_coerce_float_to_double called\n");
- return gdbarch->coerce_float_to_double (formal, actual);
-}
-
-void
-set_gdbarch_coerce_float_to_double (struct gdbarch *gdbarch,
- gdbarch_coerce_float_to_double_ftype coerce_float_to_double)
-{
- gdbarch->coerce_float_to_double = coerce_float_to_double;
-}
-
-int
gdbarch_get_saved_register_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
@@ -4030,7 +4053,7 @@ set_gdbarch_value_to_register (struct gdbarch *gdbarch,
}
CORE_ADDR
-gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf)
+gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const void *buf)
{
gdb_assert (gdbarch != NULL);
if (gdbarch->pointer_to_address == 0)
@@ -4176,6 +4199,13 @@ set_gdbarch_push_return_address (struct gdbarch *gdbarch,
gdbarch->push_return_address = push_return_address;
}
+int
+gdbarch_pop_frame_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->pop_frame != 0;
+}
+
void
gdbarch_pop_frame (struct gdbarch *gdbarch)
{
@@ -4361,6 +4391,13 @@ set_gdbarch_use_struct_convention (struct gdbarch *gdbarch,
gdbarch->use_struct_convention = use_struct_convention;
}
+int
+gdbarch_frame_init_saved_regs_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->frame_init_saved_regs != 0;
+}
+
void
gdbarch_frame_init_saved_regs (struct gdbarch *gdbarch, struct frame_info *frame)
{
@@ -4634,6 +4671,13 @@ set_gdbarch_frameless_function_invocation (struct gdbarch *gdbarch,
gdbarch->frameless_function_invocation = frameless_function_invocation;
}
+int
+gdbarch_frame_chain_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->frame_chain != 0;
+}
+
CORE_ADDR
gdbarch_frame_chain (struct gdbarch *gdbarch, struct frame_info *frame)
{
@@ -4654,6 +4698,13 @@ set_gdbarch_frame_chain (struct gdbarch *gdbarch,
}
int
+gdbarch_frame_chain_valid_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->frame_chain_valid != 0;
+}
+
+int
gdbarch_frame_chain_valid (struct gdbarch *gdbarch, CORE_ADDR chain, struct frame_info *thisframe)
{
gdb_assert (gdbarch != NULL);
@@ -4672,6 +4723,13 @@ set_gdbarch_frame_chain_valid (struct gdbarch *gdbarch,
gdbarch->frame_chain_valid = frame_chain_valid;
}
+int
+gdbarch_frame_saved_pc_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->frame_saved_pc != 0;
+}
+
CORE_ADDR
gdbarch_frame_saved_pc (struct gdbarch *gdbarch, struct frame_info *fi)
{
@@ -5779,6 +5837,8 @@ gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
continue;
if (info->byte_order != arches->gdbarch->byte_order)
continue;
+ if (info->osabi != arches->gdbarch->osabi)
+ continue;
return arches;
}
return NULL;
@@ -5824,6 +5884,12 @@ gdbarch_update_p (struct gdbarch_info info)
if (info.byte_order == BFD_ENDIAN_UNKNOWN)
info.byte_order = TARGET_BYTE_ORDER;
+ /* ``(gdb) set osabi ...'' is handled by gdbarch_lookup_osabi. */
+ if (info.osabi == GDB_OSABI_UNINITIALIZED)
+ info.osabi = gdbarch_lookup_osabi (info.abfd);
+ if (info.osabi == GDB_OSABI_UNINITIALIZED)
+ info.osabi = current_gdbarch->osabi;
+
/* Must have found some sort of architecture. */
gdb_assert (info.bfd_arch_info != NULL);
@@ -5841,6 +5907,9 @@ gdbarch_update_p (struct gdbarch_info info)
: info.byte_order == BFD_ENDIAN_LITTLE ? "little"
: "default"));
fprintf_unfiltered (gdb_stdlog,
+ "gdbarch_update: info.osabi %d (%s)\n",
+ info.osabi, gdbarch_osabi_name (info.osabi));
+ fprintf_unfiltered (gdb_stdlog,
"gdbarch_update: info.abfd 0x%lx\n",
(long) info.abfd);
fprintf_unfiltered (gdb_stdlog,