/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
Software Foundation, Inc.
This file is part of GDB.
#define GDBARCH_DEBUG 0
#endif
int gdbarch_debug = GDBARCH_DEBUG;
+static void
+show_gdbarch_debug (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("Architecture debugging is %s.\n"), value);
+}
+
+static const char *
+pformat (const struct floatformat *format)
+{
+ if (format == NULL)
+ return "(null)";
+ else
+ return format->name;
+}
/* Maintain the struct gdbarch object */
int long_bit;
int long_long_bit;
int float_bit;
+ const struct floatformat * float_format;
int double_bit;
+ const struct floatformat * double_format;
int long_double_bit;
+ const struct floatformat * long_double_format;
int ptr_bit;
int addr_bit;
int bfd_vma_bit;
gdbarch_deprecated_reg_struct_has_addr_ftype *deprecated_reg_struct_has_addr;
gdbarch_stabs_argument_has_addr_ftype *stabs_argument_has_addr;
int frame_red_zone_size;
- const struct floatformat * float_format;
- const struct floatformat * double_format;
- const struct floatformat * long_double_format;
gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
gdbarch_addr_bits_remove_ftype *addr_bits_remove;
gdbarch_smash_text_address_ftype *smash_text_address;
gdbarch_software_single_step_ftype *software_single_step;
+ gdbarch_single_step_through_delay_ftype *single_step_through_delay;
gdbarch_print_insn_ftype *print_insn;
gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
gdbarch_skip_solib_resolver_ftype *skip_solib_resolver;
- gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline;
gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline;
gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p;
gdbarch_construct_inferior_arguments_ftype *construct_inferior_arguments;
8 * sizeof (long), /* long_bit */
8 * sizeof (LONGEST), /* long_long_bit */
8 * sizeof (float), /* float_bit */
+ 0, /* float_format */
8 * sizeof (double), /* double_bit */
+ 0, /* double_format */
8 * sizeof (long double), /* long_double_bit */
+ 0, /* long_double_format */
8 * sizeof (void*), /* ptr_bit */
8 * sizeof (void*), /* addr_bit */
8 * sizeof (void*), /* bfd_vma_bit */
0, /* deprecated_reg_struct_has_addr */
default_stabs_argument_has_addr, /* stabs_argument_has_addr */
0, /* frame_red_zone_size */
- 0, /* float_format */
- 0, /* double_format */
- 0, /* long_double_format */
convert_from_func_ptr_addr_identity, /* convert_from_func_ptr_addr */
0, /* addr_bits_remove */
0, /* smash_text_address */
0, /* software_single_step */
+ 0, /* single_step_through_delay */
0, /* print_insn */
0, /* skip_trampoline_code */
generic_skip_solib_resolver, /* skip_solib_resolver */
- 0, /* in_solib_call_trampoline */
0, /* in_solib_return_trampoline */
generic_in_function_epilogue_p, /* in_function_epilogue_p */
construct_inferior_arguments, /* construct_inferior_arguments */
current_gdbarch->smash_text_address = core_addr_identity;
current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
current_gdbarch->skip_solib_resolver = generic_skip_solib_resolver;
- current_gdbarch->in_solib_call_trampoline = generic_in_solib_call_trampoline;
current_gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline;
current_gdbarch->in_function_epilogue_p = generic_in_function_epilogue_p;
current_gdbarch->construct_inferior_arguments = construct_inferior_arguments;
/* Skip verify of long_bit, invalid_p == 0 */
/* Skip verify of long_long_bit, invalid_p == 0 */
/* Skip verify of float_bit, invalid_p == 0 */
+ if (current_gdbarch->float_format == 0)
+ current_gdbarch->float_format = default_float_format (current_gdbarch);
/* Skip verify of double_bit, invalid_p == 0 */
+ if (current_gdbarch->double_format == 0)
+ current_gdbarch->double_format = default_double_format (current_gdbarch);
/* Skip verify of long_double_bit, invalid_p == 0 */
+ if (current_gdbarch->long_double_format == 0)
+ current_gdbarch->long_double_format = default_double_format (current_gdbarch);
/* Skip verify of ptr_bit, invalid_p == 0 */
if (current_gdbarch->addr_bit == 0)
current_gdbarch->addr_bit = TARGET_PTR_BIT;
/* Skip verify of virtual_frame_pointer, invalid_p == 0 */
/* Skip verify of pseudo_register_read, has predicate */
/* Skip verify of pseudo_register_write, has predicate */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (current_gdbarch->num_regs == -1))
+ if (current_gdbarch->num_regs == -1)
fprintf_unfiltered (log, "\n\tnum_regs");
/* Skip verify of num_pseudo_regs, invalid_p == 0 */
/* Skip verify of sp_regnum, invalid_p == 0 */
/* Skip verify of store_return_value, invalid_p == 0 */
/* Skip verify of deprecated_use_struct_convention, invalid_p == 0 */
/* Skip verify of deprecated_extract_struct_value_address, has predicate */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (current_gdbarch->skip_prologue == 0))
+ if (current_gdbarch->skip_prologue == 0)
fprintf_unfiltered (log, "\n\tskip_prologue");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (current_gdbarch->inner_than == 0))
+ if (current_gdbarch->inner_than == 0)
fprintf_unfiltered (log, "\n\tinner_than");
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (current_gdbarch->breakpoint_from_pc == 0))
+ if (current_gdbarch->breakpoint_from_pc == 0)
fprintf_unfiltered (log, "\n\tbreakpoint_from_pc");
/* Skip verify of adjust_breakpoint_address, has predicate */
/* Skip verify of memory_insert_breakpoint, invalid_p == 0 */
/* Skip verify of frame_align, has predicate */
/* Skip verify of deprecated_reg_struct_has_addr, has predicate */
/* Skip verify of stabs_argument_has_addr, invalid_p == 0 */
- if (current_gdbarch->float_format == 0)
- current_gdbarch->float_format = default_float_format (current_gdbarch);
- if (current_gdbarch->double_format == 0)
- current_gdbarch->double_format = default_double_format (current_gdbarch);
- if (current_gdbarch->long_double_format == 0)
- current_gdbarch->long_double_format = default_double_format (current_gdbarch);
/* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
/* Skip verify of addr_bits_remove, invalid_p == 0 */
/* Skip verify of smash_text_address, invalid_p == 0 */
/* Skip verify of software_single_step, has predicate */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (current_gdbarch->print_insn == 0))
+ /* Skip verify of single_step_through_delay, has predicate */
+ if (current_gdbarch->print_insn == 0)
fprintf_unfiltered (log, "\n\tprint_insn");
/* Skip verify of skip_trampoline_code, invalid_p == 0 */
/* Skip verify of skip_solib_resolver, invalid_p == 0 */
- /* Skip verify of in_solib_call_trampoline, invalid_p == 0 */
/* Skip verify of in_solib_return_trampoline, invalid_p == 0 */
/* Skip verify of in_function_epilogue_p, invalid_p == 0 */
/* Skip verify of construct_inferior_arguments, invalid_p == 0 */
make_cleanup (xfree, buf);
if (strlen (buf) > 0)
internal_error (__FILE__, __LINE__,
- "verify_gdbarch: the following are invalid ...%s",
+ _("verify_gdbarch: the following are invalid ...%s"),
buf);
do_cleanups (cleanups);
}
void
gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
{
+ const char *gdb_xm_file = "<not-defined>";
+ const char *gdb_nm_file = "<not-defined>";
+ const char *gdb_tm_file = "<not-defined>";
+#if defined (GDB_XM_FILE)
+ gdb_xm_file = GDB_XM_FILE;
+#endif
fprintf_unfiltered (file,
- "gdbarch_dump: GDB_MULTI_ARCH = %d\n",
- GDB_MULTI_ARCH);
+ "gdbarch_dump: GDB_XM_FILE = %s\n",
+ gdb_xm_file);
+#if defined (GDB_NM_FILE)
+ gdb_nm_file = GDB_NM_FILE;
+#endif
+ fprintf_unfiltered (file,
+ "gdbarch_dump: GDB_NM_FILE = %s\n",
+ gdb_nm_file);
+#if defined (GDB_TM_FILE)
+ gdb_tm_file = GDB_TM_FILE;
+#endif
+ fprintf_unfiltered (file,
+ "gdbarch_dump: GDB_TM_FILE = %s\n",
+ gdb_tm_file);
#ifdef TARGET_ADDR_BIT
fprintf_unfiltered (file,
"gdbarch_dump: TARGET_ADDR_BIT # %s\n",
#endif
fprintf_unfiltered (file,
"gdbarch_dump: double_format = %s\n",
- (TARGET_DOUBLE_FORMAT)->name);
+ pformat (current_gdbarch->double_format));
#ifdef DWARF2_REG_TO_REGNUM
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
#endif
fprintf_unfiltered (file,
"gdbarch_dump: float_format = %s\n",
- (TARGET_FLOAT_FORMAT)->name);
+ pformat (current_gdbarch->float_format));
#ifdef FP0_REGNUM
fprintf_unfiltered (file,
"gdbarch_dump: FP0_REGNUM # %s\n",
fprintf_unfiltered (file,
"gdbarch_dump: in_function_epilogue_p = <0x%lx>\n",
(long) current_gdbarch->in_function_epilogue_p);
-#ifdef IN_SOLIB_CALL_TRAMPOLINE
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "IN_SOLIB_CALL_TRAMPOLINE(pc, name)",
- XSTRING (IN_SOLIB_CALL_TRAMPOLINE (pc, name)));
-#endif
- fprintf_unfiltered (file,
- "gdbarch_dump: in_solib_call_trampoline = <0x%lx>\n",
- (long) current_gdbarch->in_solib_call_trampoline);
#ifdef IN_SOLIB_RETURN_TRAMPOLINE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
fprintf_unfiltered (file,
"gdbarch_dump: int_bit = %s\n",
paddr_d (current_gdbarch->int_bit));
-#ifdef INTEGER_TO_ADDRESS_P
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "INTEGER_TO_ADDRESS_P()",
- XSTRING (INTEGER_TO_ADDRESS_P ()));
-#endif
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_integer_to_address_p() = %d\n",
gdbarch_integer_to_address_p (current_gdbarch));
-#ifdef INTEGER_TO_ADDRESS
- fprintf_unfiltered (file,
- "gdbarch_dump: %s # %s\n",
- "INTEGER_TO_ADDRESS(type, buf)",
- XSTRING (INTEGER_TO_ADDRESS (type, buf)));
-#endif
fprintf_unfiltered (file,
"gdbarch_dump: integer_to_address = <0x%lx>\n",
(long) current_gdbarch->integer_to_address);
#endif
fprintf_unfiltered (file,
"gdbarch_dump: long_double_format = %s\n",
- (TARGET_LONG_DOUBLE_FORMAT)->name);
+ pformat (current_gdbarch->long_double_format));
#ifdef TARGET_LONG_LONG_BIT
fprintf_unfiltered (file,
"gdbarch_dump: TARGET_LONG_LONG_BIT # %s\n",
fprintf_unfiltered (file,
"gdbarch_dump: short_bit = %s\n",
paddr_d (current_gdbarch->short_bit));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_single_step_through_delay_p() = %d\n",
+ gdbarch_single_step_through_delay_p (current_gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: single_step_through_delay = <0x%lx>\n",
+ (long) current_gdbarch->single_step_through_delay);
#ifdef SKIP_PROLOGUE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
gdbarch->float_bit = float_bit;
}
+const struct floatformat *
+gdbarch_float_format (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_float_format called\n");
+ return gdbarch->float_format;
+}
+
+void
+set_gdbarch_float_format (struct gdbarch *gdbarch,
+ const struct floatformat * float_format)
+{
+ gdbarch->float_format = float_format;
+}
+
int
gdbarch_double_bit (struct gdbarch *gdbarch)
{
gdbarch->double_bit = double_bit;
}
+const struct floatformat *
+gdbarch_double_format (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_double_format called\n");
+ return gdbarch->double_format;
+}
+
+void
+set_gdbarch_double_format (struct gdbarch *gdbarch,
+ const struct floatformat * double_format)
+{
+ gdbarch->double_format = double_format;
+}
+
int
gdbarch_long_double_bit (struct gdbarch *gdbarch)
{
gdbarch->long_double_bit = long_double_bit;
}
+const struct floatformat *
+gdbarch_long_double_format (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_format called\n");
+ return gdbarch->long_double_format;
+}
+
+void
+set_gdbarch_long_double_format (struct gdbarch *gdbarch,
+ const struct floatformat * long_double_format)
+{
+ gdbarch->long_double_format = long_double_format;
+}
+
int
gdbarch_ptr_bit (struct gdbarch *gdbarch)
{
}
CORE_ADDR
-gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, void *buf)
+gdbarch_integer_to_address (struct gdbarch *gdbarch, struct type *type, const bfd_byte *buf)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->integer_to_address != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_integer_to_address called\n");
- return gdbarch->integer_to_address (type, buf);
+ return gdbarch->integer_to_address (gdbarch, type, buf);
}
void
gdbarch->frame_red_zone_size = frame_red_zone_size;
}
-const struct floatformat *
-gdbarch_float_format (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_float_format called\n");
- return gdbarch->float_format;
-}
-
-void
-set_gdbarch_float_format (struct gdbarch *gdbarch,
- const struct floatformat * float_format)
-{
- gdbarch->float_format = float_format;
-}
-
-const struct floatformat *
-gdbarch_double_format (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_double_format called\n");
- return gdbarch->double_format;
-}
-
-void
-set_gdbarch_double_format (struct gdbarch *gdbarch,
- const struct floatformat * double_format)
-{
- gdbarch->double_format = double_format;
-}
-
-const struct floatformat *
-gdbarch_long_double_format (struct gdbarch *gdbarch)
-{
- gdb_assert (gdbarch != NULL);
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_long_double_format called\n");
- return gdbarch->long_double_format;
-}
-
-void
-set_gdbarch_long_double_format (struct gdbarch *gdbarch,
- const struct floatformat * long_double_format)
-{
- gdbarch->long_double_format = long_double_format;
-}
-
CORE_ADDR
gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
{
gdbarch->software_single_step = software_single_step;
}
+int
+gdbarch_single_step_through_delay_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->single_step_through_delay != NULL;
+}
+
+int
+gdbarch_single_step_through_delay (struct gdbarch *gdbarch, struct frame_info *frame)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->single_step_through_delay != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_single_step_through_delay called\n");
+ return gdbarch->single_step_through_delay (gdbarch, frame);
+}
+
+void
+set_gdbarch_single_step_through_delay (struct gdbarch *gdbarch,
+ gdbarch_single_step_through_delay_ftype single_step_through_delay)
+{
+ gdbarch->single_step_through_delay = single_step_through_delay;
+}
+
int
gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, struct disassemble_info *info)
{
gdbarch->skip_solib_resolver = skip_solib_resolver;
}
-int
-gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name)
-{
- gdb_assert (gdbarch != NULL);
- gdb_assert (gdbarch->in_solib_call_trampoline != NULL);
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_in_solib_call_trampoline called\n");
- return gdbarch->in_solib_call_trampoline (pc, name);
-}
-
-void
-set_gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch,
- gdbarch_in_solib_call_trampoline_ftype in_solib_call_trampoline)
-{
- gdbarch->in_solib_call_trampoline = in_solib_call_trampoline;
-}
-
int
gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name)
{
ap = bfd_lookup_arch (rego->bfd_architecture, 0);
if (ap == NULL)
internal_error (__FILE__, __LINE__,
- "gdbarch_architecture_names: multi-arch unknown");
+ _("gdbarch_architecture_names: multi-arch unknown"));
do
{
append_name (&arches, &nr_arches, ap->printable_name);
if (bfd_arch_info == NULL)
{
internal_error (__FILE__, __LINE__,
- "gdbarch: Attempt to register unknown architecture (%d)",
+ _("gdbarch: Attempt to register unknown architecture (%d)"),
bfd_architecture);
}
/* Check that we haven't seen this architecture before */
{
if (bfd_architecture == (*curr)->bfd_architecture)
internal_error (__FILE__, __LINE__,
- "gdbarch: Duplicate registraration of architecture (%s)",
+ _("gdbarch: Duplicate registraration of architecture (%s)"),
bfd_arch_info->printable_name);
}
/* log it */
{
struct cmd_list_element *c;
- deprecated_add_show_from_set
- (add_set_cmd ("arch",
- class_maintenance,
- var_zinteger,
- (char *)&gdbarch_debug,
- "Set architecture debugging.\n\
-When non-zero, architecture debugging is enabled.", &setdebuglist),
- &showdebuglist);
- c = add_set_cmd ("archdebug",
- class_maintenance,
- var_zinteger,
- (char *)&gdbarch_debug,
- "Set architecture debugging.\n\
-When non-zero, architecture debugging is enabled.", &setlist);
-
- deprecate_cmd (c, "set debug arch");
- deprecate_cmd (deprecated_add_show_from_set (c, &showlist), "show debug arch");
+ add_setshow_zinteger_cmd ("arch", class_maintenance, &gdbarch_debug, _("\
+Set architecture debugging."), _("\
+Show architecture debugging."), _("\
+When non-zero, architecture debugging is enabled."),
+ NULL,
+ show_gdbarch_debug,
+ &setdebuglist, &showdebuglist);
}