gdbarch_write_fp_ftype *write_fp;
gdbarch_read_sp_ftype *read_sp;
gdbarch_write_sp_ftype *write_sp;
+ gdbarch_register_read_ftype *register_read;
+ gdbarch_register_write_ftype *register_write;
int num_regs;
int num_pseudo_regs;
int sp_regnum;
gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint;
gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint;
CORE_ADDR decr_pc_after_break;
+ gdbarch_prepare_to_proceed_ftype *prepare_to_proceed;
CORE_ADDR function_start_offset;
gdbarch_remote_translate_xfer_address_ftype *remote_translate_xfer_address;
CORE_ADDR frame_args_skip;
const struct floatformat * double_format;
const struct floatformat * long_double_format;
gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
+ gdbarch_software_single_step_ftype *software_single_step;
};
0,
0,
0,
+ 0,
+ 0,
generic_get_saved_register,
0,
0,
0,
0,
0,
+ 0,
+ 0,
/* startup_gdbarch() */
};
gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint;
gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint;
gdbarch->decr_pc_after_break = -1;
+ gdbarch->prepare_to_proceed = default_prepare_to_proceed;
gdbarch->function_start_offset = -1;
gdbarch->remote_translate_xfer_address = generic_remote_translate_xfer_address;
gdbarch->frame_args_skip = -1;
/* Skip verify of write_fp, invalid_p == 0 */
/* Skip verify of read_sp, invalid_p == 0 */
/* Skip verify of write_sp, invalid_p == 0 */
+ /* Skip verify of register_read, has predicate */
+ /* Skip verify of register_write, has predicate */
if ((GDB_MULTI_ARCH >= 2)
&& (gdbarch->num_regs == -1))
internal_error (__FILE__, __LINE__,
&& (gdbarch->decr_pc_after_break == -1))
internal_error (__FILE__, __LINE__,
"gdbarch: verify_gdbarch: decr_pc_after_break invalid");
+ /* Skip verify of prepare_to_proceed, invalid_p == 0 */
if ((GDB_MULTI_ARCH >= 2)
&& (gdbarch->function_start_offset == -1))
internal_error (__FILE__, __LINE__,
if (gdbarch->long_double_format == 0)
gdbarch->long_double_format = &floatformat_unknown;
/* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
+ /* Skip verify of software_single_step, has predicate */
}
#ifdef TARGET_READ_PC
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
- "TARGET_READ_PC(pid)",
- XSTRING (TARGET_READ_PC (pid)));
+ "TARGET_READ_PC(ptid)",
+ XSTRING (TARGET_READ_PC (ptid)));
#endif
#if defined (TARGET_WRITE_PC) && GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
- "TARGET_WRITE_PC(val, pid)",
- XSTRING (TARGET_WRITE_PC (val, pid)));
+ "TARGET_WRITE_PC(val, ptid)",
+ XSTRING (TARGET_WRITE_PC (val, ptid)));
#endif
#ifdef TARGET_READ_FP
fprintf_unfiltered (file,
"gdbarch_dump: DECR_PC_AFTER_BREAK # %s\n",
XSTRING (DECR_PC_AFTER_BREAK));
#endif
+#ifdef PREPARE_TO_PROCEED
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "PREPARE_TO_PROCEED(select_it)",
+ XSTRING (PREPARE_TO_PROCEED (select_it)));
+#endif
#ifdef FUNCTION_START_OFFSET
fprintf_unfiltered (file,
"gdbarch_dump: FUNCTION_START_OFFSET # %s\n",
"CONVERT_FROM_FUNC_PTR_ADDR(addr)",
XSTRING (CONVERT_FROM_FUNC_PTR_ADDR (addr)));
#endif
+#if defined (SOFTWARE_SINGLE_STEP) && GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p)",
+ XSTRING (SOFTWARE_SINGLE_STEP (sig, insert_breakpoints_p)));
+#endif
#ifdef TARGET_ARCHITECTURE
if (TARGET_ARCHITECTURE != NULL)
fprintf_unfiltered (file,
(long) current_gdbarch->write_sp
/*TARGET_WRITE_SP ()*/);
#endif
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: register_read = 0x%08lx\n",
+ (long) current_gdbarch->register_read);
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: register_write = 0x%08lx\n",
+ (long) current_gdbarch->register_write);
#ifdef NUM_REGS
fprintf_unfiltered (file,
"gdbarch_dump: NUM_REGS = %ld\n",
"gdbarch_dump: DECR_PC_AFTER_BREAK = %ld\n",
(long) DECR_PC_AFTER_BREAK);
#endif
+#ifdef PREPARE_TO_PROCEED
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: PREPARE_TO_PROCEED = 0x%08lx\n",
+ (long) current_gdbarch->prepare_to_proceed
+ /*PREPARE_TO_PROCEED ()*/);
+#endif
#ifdef FUNCTION_START_OFFSET
fprintf_unfiltered (file,
"gdbarch_dump: FUNCTION_START_OFFSET = %ld\n",
"gdbarch_dump: CONVERT_FROM_FUNC_PTR_ADDR = 0x%08lx\n",
(long) current_gdbarch->convert_from_func_ptr_addr
/*CONVERT_FROM_FUNC_PTR_ADDR ()*/);
+#endif
+#ifdef SOFTWARE_SINGLE_STEP
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: SOFTWARE_SINGLE_STEP = 0x%08lx\n",
+ (long) current_gdbarch->software_single_step
+ /*SOFTWARE_SINGLE_STEP ()*/);
#endif
if (current_gdbarch->dump_tdep != NULL)
current_gdbarch->dump_tdep (current_gdbarch, file);
}
CORE_ADDR
-gdbarch_read_pc (struct gdbarch *gdbarch, int pid)
+gdbarch_read_pc (struct gdbarch *gdbarch, ptid_t ptid)
{
if (gdbarch->read_pc == 0)
internal_error (__FILE__, __LINE__,
"gdbarch: gdbarch_read_pc invalid");
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_read_pc called\n");
- return gdbarch->read_pc (pid);
+ return gdbarch->read_pc (ptid);
}
void
}
void
-gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, int pid)
+gdbarch_write_pc (struct gdbarch *gdbarch, CORE_ADDR val, ptid_t ptid)
{
if (gdbarch->write_pc == 0)
internal_error (__FILE__, __LINE__,
"gdbarch: gdbarch_write_pc invalid");
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_write_pc called\n");
- gdbarch->write_pc (val, pid);
+ gdbarch->write_pc (val, ptid);
}
void
gdbarch->write_sp = write_sp;
}
+int
+gdbarch_register_read_p (struct gdbarch *gdbarch)
+{
+ return gdbarch->register_read != 0;
+}
+
+void
+gdbarch_register_read (struct gdbarch *gdbarch, int regnum, char *buf)
+{
+ if (gdbarch->register_read == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_register_read invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_register_read called\n");
+ gdbarch->register_read (gdbarch, regnum, buf);
+}
+
+void
+set_gdbarch_register_read (struct gdbarch *gdbarch,
+ gdbarch_register_read_ftype register_read)
+{
+ gdbarch->register_read = register_read;
+}
+
+int
+gdbarch_register_write_p (struct gdbarch *gdbarch)
+{
+ return gdbarch->register_write != 0;
+}
+
+void
+gdbarch_register_write (struct gdbarch *gdbarch, int regnum, char *buf)
+{
+ if (gdbarch->register_write == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_register_write invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_register_write called\n");
+ gdbarch->register_write (gdbarch, regnum, buf);
+}
+
+void
+set_gdbarch_register_write (struct gdbarch *gdbarch,
+ gdbarch_register_write_ftype register_write)
+{
+ gdbarch->register_write = register_write;
+}
+
int
gdbarch_num_regs (struct gdbarch *gdbarch)
{
gdbarch->decr_pc_after_break = decr_pc_after_break;
}
+int
+gdbarch_prepare_to_proceed (struct gdbarch *gdbarch, int select_it)
+{
+ if (gdbarch->prepare_to_proceed == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_prepare_to_proceed invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_prepare_to_proceed called\n");
+ return gdbarch->prepare_to_proceed (select_it);
+}
+
+void
+set_gdbarch_prepare_to_proceed (struct gdbarch *gdbarch,
+ gdbarch_prepare_to_proceed_ftype prepare_to_proceed)
+{
+ gdbarch->prepare_to_proceed = prepare_to_proceed;
+}
+
CORE_ADDR
gdbarch_function_start_offset (struct gdbarch *gdbarch)
{
gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr;
}
+int
+gdbarch_software_single_step_p (struct gdbarch *gdbarch)
+{
+ return gdbarch->software_single_step != 0;
+}
+
+void
+gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p)
+{
+ if (gdbarch->software_single_step == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_software_single_step invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_software_single_step called\n");
+ gdbarch->software_single_step (sig, insert_breakpoints_p);
+}
+
+void
+set_gdbarch_software_single_step (struct gdbarch *gdbarch,
+ gdbarch_software_single_step_ftype software_single_step)
+{
+ gdbarch->software_single_step = software_single_step;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */
struct gdbarch_list **list;
struct gdbarch_registration *rego;
- /* Fill in any missing bits. Most important is the bfd_architecture
- which is used to select the target architecture. */
- if (info.bfd_architecture == bfd_arch_unknown)
- {
- if (info.bfd_arch_info != NULL)
- info.bfd_architecture = info.bfd_arch_info->arch;
- else if (info.abfd != NULL)
- info.bfd_architecture = bfd_get_arch (info.abfd);
- /* FIXME - should query BFD for its default architecture. */
- else
- info.bfd_architecture = current_gdbarch->bfd_arch_info->arch;
- }
+ /* Fill in missing parts of the INFO struct using a number of
+ sources: ``set ...''; INFOabfd supplied; existing target. */
+
+ /* ``(gdb) set architecture ...'' */
+ if (info.bfd_arch_info == NULL
+ && !TARGET_ARCHITECTURE_AUTO)
+ info.bfd_arch_info = TARGET_ARCHITECTURE;
+ if (info.bfd_arch_info == NULL
+ && info.abfd != NULL
+ && bfd_get_arch (info.abfd) != bfd_arch_unknown
+ && bfd_get_arch (info.abfd) != bfd_arch_obscure)
+ info.bfd_arch_info = bfd_get_arch_info (info.abfd);
if (info.bfd_arch_info == NULL)
- {
- if (target_architecture_auto && info.abfd != NULL)
- info.bfd_arch_info = bfd_get_arch_info (info.abfd);
- else
- info.bfd_arch_info = current_gdbarch->bfd_arch_info;
- }
+ info.bfd_arch_info = TARGET_ARCHITECTURE;
+
+ /* ``(gdb) set byte-order ...'' */
+ if (info.byte_order == 0
+ && !TARGET_BYTE_ORDER_AUTO)
+ info.byte_order = TARGET_BYTE_ORDER;
+ /* From the INFO struct. */
+ if (info.byte_order == 0
+ && info.abfd != NULL)
+ info.byte_order = (bfd_big_endian (info.abfd) ? BIG_ENDIAN
+ : bfd_little_endian (info.abfd) ? LITTLE_ENDIAN
+ : 0);
+ /* From the current target. */
if (info.byte_order == 0)
- {
- if (target_byte_order_auto && info.abfd != NULL)
- info.byte_order = (bfd_big_endian (info.abfd) ? BIG_ENDIAN
- : bfd_little_endian (info.abfd) ? LITTLE_ENDIAN
- : 0);
- else
- info.byte_order = current_gdbarch->byte_order;
- /* FIXME - should query BFD for its default byte-order. */
- }
- /* A default for abfd? */
+ info.byte_order = TARGET_BYTE_ORDER;
- /* Find the target that knows about this architecture. */
- for (rego = gdbarch_registry;
- rego != NULL;
- rego = rego->next)
- if (rego->bfd_architecture == info.bfd_architecture)
- break;
- if (rego == NULL)
- {
- if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\n");
- return 0;
- }
+ /* Must have found some sort of architecture. */
+ gdb_assert (info.bfd_arch_info != NULL);
if (gdbarch_debug)
{
- fprintf_unfiltered (gdb_stdlog,
- "gdbarch_update: info.bfd_architecture %d (%s)\n",
- info.bfd_architecture,
- bfd_lookup_arch (info.bfd_architecture, 0)->printable_name);
fprintf_unfiltered (gdb_stdlog,
"gdbarch_update: info.bfd_arch_info %s\n",
(info.bfd_arch_info != NULL
(long) info.tdep_info);
}
+ /* Find the target that knows about this architecture. */
+ for (rego = gdbarch_registry;
+ rego != NULL;
+ rego = rego->next)
+ if (rego->bfd_architecture == info.bfd_arch_info->arch)
+ break;
+ if (rego == NULL)
+ {
+ if (gdbarch_debug)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_update: No matching architecture\n");
+ return 0;
+ }
+
/* Ask the target for a replacement architecture. */
new_gdbarch = rego->init (info, rego->arches);