+2003-04-30 Andrew Cagney <cagney@redhat.com>
+
+ * gdbarch.sh (deprecated_tm_print_insn_info): Rename
+ "tm_print_insn_info".
+ (TARGET_PRINT_INSN_INFO): Delete macro.
+ (dis_asm_read_memory): Delete function declaration.
+ (dis_asm_memory_error, dis_asm_print_address): Ditto.
+ (tm_print_insn_info): Delete variable definition.
+ (_initialize_gdbarch): Do not initialize "tm_print_insn_info".
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * d10v-tdep.c (display_trace): Replace "tm_print_insn_info" with
+ "deprecated_tm_print_insn_info".
+ * mcore-tdep.c (mcore_dump_insn): Ditto.
+ * mips-tdep.c (mips_gdbarch_init): Ditto.
+ * sparc-tdep.c (_initialize_sparc_tdep): Ditto.
+ * v850-tdep.c (v850_scan_prologue, v850_gdbarch_init): Ditto.
+ * ia64-tdep.c (_initialize_ia64_tdep): Ditto.
+ * printcmd.c (print_insn): Use "deprecated_tm_print_insn_info"
+ instead of TARGET_PRINT_INSN_INFO, add comment.
+ * s390-tdep.c (s390_get_frame_info): Instead of
+ "dis_asm_read_memory", use "deprecated_tm_print_insn_info".
+ (s390_check_function_end, s390_is_sigreturn): Ditto.
+ * corefile.c (dis_asm_read_memory): Move to "disasm.c".
+ (dis_asm_memory_error, dis_asm_print_address): Ditto.
+ * disasm.c: Include "gdbcore.h".
+ (_initialize_disasm): New function, initialize
+ "deprecated_tm_print_insn_info".
+ (deprecated_tm_print_insn_info): New variable.
+ (dis_asm_read_memory): Moved from "corefile.c", made static.
+ (dis_asm_print_address, dis_asm_memory_error): Ditto.
+ * Makefile.in (disasm.o): Update dependencies.
+
2003-04-30 Andrew Cagney <cagney@redhat.com>
* sparc-tdep.c (SPARC_HAS_FPU): When multi-arch, define as 1.
dink32-rom.o: dink32-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
$(serial_h) $(symfile_h) $(inferior_h) $(regcache_h)
disasm.o: disasm.c $(defs_h) $(gdb_string_h) $(target_h) $(value_h) \
- $(disasm_h) $(ui_out_h)
+ $(disasm_h) $(ui_out_h) $(gdbcore_h)
doublest.o: doublest.c $(defs_h) $(doublest_h) $(floatformat_h) \
$(gdb_assert_h) $(gdb_string_h) $(gdbtypes_h)
dpx2-nat.o: dpx2-nat.c $(defs_h) $(gdbcore_h) $(gdb_string_h)
memory_error (status, memaddr);
}
-/* Like target_read_memory, but slightly different parameters. */
-int
-dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, unsigned int len,
- disassemble_info *info)
-{
- return target_read_memory (memaddr, (char *) myaddr, len);
-}
-
-/* Like memory_error with slightly different parameters. */
-void
-dis_asm_memory_error (int status, bfd_vma memaddr, disassemble_info *info)
-{
- memory_error (status, memaddr);
-}
-
-/* Like print_address with slightly different parameters. */
-void
-dis_asm_print_address (bfd_vma addr, struct disassemble_info *info)
-{
- print_address (addr, info->stream);
-}
-
/* Argument / return result struct for use with
do_captured_read_memory_integer(). MEMADDR and LEN are filled in
by gdb_read_memory_integer(). RESULT is the contents that were
printf_filtered ("\t");
wrap_here (" ");
next_address += TARGET_PRINT_INSN (next_address,
- &tm_print_insn_info);
+ &deprecated_tm_print_insn_info);
printf_filtered ("\n");
gdb_flush (gdb_stdout);
}
#include "value.h"
#include "ui-out.h"
#include "gdb_string.h"
-
#include "disasm.h"
+#include "gdbcore.h"
/* Disassemble functions.
FIXME: We should get rid of all the duplicate code in gdb that does
CORE_ADDR end_pc;
};
+/* Like target_read_memory, but slightly different parameters. */
+static int
+dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, unsigned int len,
+ disassemble_info *info)
+{
+ return target_read_memory (memaddr, (char *) myaddr, len);
+}
+
+/* Like memory_error with slightly different parameters. */
+static void
+dis_asm_memory_error (int status, bfd_vma memaddr, disassemble_info *info)
+{
+ memory_error (status, memaddr);
+}
+
+/* Like print_address with slightly different parameters. */
+static void
+dis_asm_print_address (bfd_vma addr, struct disassemble_info *info)
+{
+ print_address (addr, info->stream);
+}
+
/* This variable determines where memory used for disassembly is read from. */
int gdb_disassemble_from_exec = -1;
gdb_flush (gdb_stdout);
}
+
+\f
+/* FIXME: cagney/2003-04-28: This global deprecated_tm_print_insn_info
+ is going away. */
+disassemble_info deprecated_tm_print_insn_info;
+
+extern void _initialize_disasm (void);
+
+void
+_initialize_disasm (void)
+{
+ INIT_DISASSEMBLE_INFO_NO_ARCH (deprecated_tm_print_insn_info, gdb_stdout,
+ (fprintf_ftype)fprintf_filtered);
+ deprecated_tm_print_insn_info.flavour = bfd_target_unknown_flavour;
+ deprecated_tm_print_insn_info.read_memory_func = dis_asm_read_memory;
+ deprecated_tm_print_insn_info.memory_error_func = dis_asm_memory_error;
+ deprecated_tm_print_insn_info.print_address_func = dis_asm_print_address;
+}
/* Pointer to the target-dependent disassembly function. */
int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info *);
-disassemble_info tm_print_insn_info;
-
extern void _initialize_gdbarch (void);
{
struct cmd_list_element *c;
- INIT_DISASSEMBLE_INFO_NO_ARCH (tm_print_insn_info, gdb_stdout, (fprintf_ftype)fprintf_filtered);
- tm_print_insn_info.flavour = bfd_target_unknown_flavour;
- tm_print_insn_info.read_memory_func = dis_asm_read_memory;
- tm_print_insn_info.memory_error_func = dis_asm_memory_error;
- tm_print_insn_info.print_address_func = dis_asm_print_address;
-
add_show_from_set (add_set_cmd ("arch",
class_maintenance,
var_zinteger,
/* The target-system-dependent disassembler is semi-dynamic */
-extern int dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr,
- unsigned int len, disassemble_info *info);
-
-extern void dis_asm_memory_error (int status, bfd_vma memaddr,
- disassemble_info *info);
-
-extern void dis_asm_print_address (bfd_vma addr,
- disassemble_info *info);
-
-/* Use set_gdbarch_print_insn instead. */
+/* Use gdb_disassemble, and gdbarch_print_insn instead. */
extern int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info*);
-extern disassemble_info tm_print_insn_info;
-#ifndef TARGET_PRINT_INSN_INFO
-#define TARGET_PRINT_INSN_INFO (&tm_print_insn_info)
-#endif
-
+/* Use set_gdbarch_print_insn instead. */
+extern disassemble_info deprecated_tm_print_insn_info;
/* Set the dynamic target-system-dependent parameters (architecture,
byte-order, ...) using information found in the BFD */
/* The target-system-dependent disassembler is semi-dynamic */
-extern int dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr,
- unsigned int len, disassemble_info *info);
-
-extern void dis_asm_memory_error (int status, bfd_vma memaddr,
- disassemble_info *info);
-
-extern void dis_asm_print_address (bfd_vma addr,
- disassemble_info *info);
-
-/* Use set_gdbarch_print_insn instead. */
+/* Use gdb_disassemble, and gdbarch_print_insn instead. */
extern int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info*);
-extern disassemble_info tm_print_insn_info;
-#ifndef TARGET_PRINT_INSN_INFO
-#define TARGET_PRINT_INSN_INFO (&tm_print_insn_info)
-#endif
-
+/* Use set_gdbarch_print_insn instead. */
+extern disassemble_info deprecated_tm_print_insn_info;
/* Set the dynamic target-system-dependent parameters (architecture,
byte-order, ...) using information found in the BFD */
/* Pointer to the target-dependent disassembly function. */
int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info *);
-disassemble_info tm_print_insn_info;
-
extern void _initialize_gdbarch (void);
{
struct cmd_list_element *c;
- INIT_DISASSEMBLE_INFO_NO_ARCH (tm_print_insn_info, gdb_stdout, (fprintf_ftype)fprintf_filtered);
- tm_print_insn_info.flavour = bfd_target_unknown_flavour;
- tm_print_insn_info.read_memory_func = dis_asm_read_memory;
- tm_print_insn_info.memory_error_func = dis_asm_memory_error;
- tm_print_insn_info.print_address_func = dis_asm_print_address;
-
add_show_from_set (add_set_cmd ("arch",
class_maintenance,
var_zinteger,
register_gdbarch_init (bfd_arch_ia64, ia64_gdbarch_init);
deprecated_tm_print_insn = print_insn_ia64;
- tm_print_insn_info.bytes_per_line = SLOT_MULTIPLIER;
+ deprecated_tm_print_insn_info.bytes_per_line = SLOT_MULTIPLIER;
}
{
printf_filtered ("MCORE: %s %08x %08x ",
commnt, (unsigned int) pc, (unsigned int) insn);
- TARGET_PRINT_INSN (pc, &tm_print_insn_info);
+ TARGET_PRINT_INSN (pc, &deprecated_tm_print_insn_info);
printf_filtered ("\n");
}
}
/* Reset the disassembly info, in case it was set to something
non-default. */
- tm_print_insn_info.flavour = bfd_target_unknown_flavour;
- tm_print_insn_info.arch = bfd_arch_unknown;
- tm_print_insn_info.mach = 0;
+ deprecated_tm_print_insn_info.flavour = bfd_target_unknown_flavour;
+ deprecated_tm_print_insn_info.arch = bfd_arch_unknown;
+ deprecated_tm_print_insn_info.mach = 0;
elf_flags = 0;
if (wanted_abi != MIPS_ABI_UNKNOWN)
mips_abi = wanted_abi;
- /* We have to set tm_print_insn_info before looking for a
+ /* We have to set deprecated_tm_print_insn_info before looking for a
pre-existing architecture, otherwise we may return before we get
a chance to set it up. */
if (mips_abi == MIPS_ABI_N32 || mips_abi == MIPS_ABI_N64)
/* Set up the disassembler info, so that we get the right
register names from libopcodes. */
if (mips_abi == MIPS_ABI_N32)
- tm_print_insn_info.disassembler_options = "gpr-names=n32";
+ deprecated_tm_print_insn_info.disassembler_options = "gpr-names=n32";
else
- tm_print_insn_info.disassembler_options = "gpr-names=64";
- tm_print_insn_info.flavour = bfd_target_elf_flavour;
- tm_print_insn_info.arch = bfd_arch_mips;
+ deprecated_tm_print_insn_info.disassembler_options = "gpr-names=64";
+ deprecated_tm_print_insn_info.flavour = bfd_target_elf_flavour;
+ deprecated_tm_print_insn_info.arch = bfd_arch_mips;
if (info.bfd_arch_info != NULL
&& info.bfd_arch_info->arch == bfd_arch_mips
&& info.bfd_arch_info->mach)
- tm_print_insn_info.mach = info.bfd_arch_info->mach;
+ deprecated_tm_print_insn_info.mach = info.bfd_arch_info->mach;
else
- tm_print_insn_info.mach = bfd_mach_mips8000;
+ deprecated_tm_print_insn_info.mach = bfd_mach_mips8000;
}
else
/* This string is not recognized explicitly by the disassembler,
the bfd elf headers, such that, if the user overrides the ABI
of a program linked as NewABI, the disassembly will follow the
register naming conventions specified by the user. */
- tm_print_insn_info.disassembler_options = "gpr-names=32";
+ deprecated_tm_print_insn_info.disassembler_options = "gpr-names=32";
if (gdbarch_debug)
{
/* Print the instruction at address MEMADDR in debugged memory,
on STREAM. Returns length of the instruction, in bytes. */
+/* FIXME: cagney/2003-04-28: Should instead be using the generic
+ disassembler but first need to clean that up and stop it trying to
+ access the exec file. */
+
static int
print_insn (CORE_ADDR memaddr, struct ui_file *stream)
{
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_BIG;
+ deprecated_tm_print_insn_info.endian = BFD_ENDIAN_BIG;
else
- TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_LITTLE;
+ deprecated_tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
if (TARGET_ARCHITECTURE != NULL)
- TARGET_PRINT_INSN_INFO->mach = TARGET_ARCHITECTURE->mach;
+ deprecated_tm_print_insn_info.mach = TARGET_ARCHITECTURE->mach;
/* else: should set .mach=0 but some disassemblers don't grok this */
- TARGET_PRINT_INSN_INFO->stream = stream;
+ deprecated_tm_print_insn_info.stream = stream;
- return TARGET_PRINT_INSN (memaddr, TARGET_PRINT_INSN_INFO);
+ return TARGET_PRINT_INSN (memaddr, &deprecated_tm_print_insn_info);
}
\f
memset (gprs_saved, 0, sizeof (gprs_saved));
memset (fprs_saved, 0, sizeof (fprs_saved));
- info.read_memory_func = dis_asm_read_memory;
+ info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
save_link_regidx = subtract_sp_regidx = 0;
if (fextra_info)
disassemble_info info;
int regidx, instrlen;
- info.read_memory_func = dis_asm_read_memory;
+ info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
instrlen = s390_readinstruction (instr, pc, &info);
if (instrlen < 0)
return -1;
scontext = temp_sregs = 0;
- info.read_memory_func = dis_asm_read_memory;
+ info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
instrlen = s390_readinstruction (instr, pc, &info);
if (sigcaller_pc)
*sigcaller_pc = 0;
gdbarch_register (bfd_arch_sparc, sparc_gdbarch_init, sparc_dump_tdep);
deprecated_tm_print_insn = gdb_print_insn_sparc;
- tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */
+ deprecated_tm_print_insn_info.mach = TM_PRINT_INSN_MACH; /* Selects sparc/sparclite */
/* OBSOLETE target_architecture_hook = sparc_target_architecture_hook; */
}
+2003-04-30 Andrew Cagney <cagney@redhat.com>
+
+ * tuiDisassem.c (tui_disassemble): Use
+ "deprecated_tm_print_insn_info" instead of TARGET_PRINT_INSN_INFO,
+ add comment.
+
2003-03-14 Andrew Cagney <cagney@redhat.com>
* tuiRegs.c (_tuiGetRegisterRawValue): Use frame_read_register,
/* now init the ui_file structure */
gdb_dis_out = tui_sfileopen (256);
- memcpy (&asm_info, TARGET_PRINT_INSN_INFO, sizeof (asm_info));
+ /* FIXME: cagney/2003-04-28: Should instead be using the generic
+ disassembler but first need to clean that up and stop it trying
+ to access the exec file. */
+
+ memcpy (&asm_info, &deprecated_tm_print_insn_info, sizeof (asm_info));
asm_info.stream = gdb_dis_out;
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
#ifdef DEBUG
printf_filtered ("0x%.8lx ", (long) current_pc);
- TARGET_PRINT_INSN (current_pc, &tm_print_insn_info);
+ TARGET_PRINT_INSN (current_pc, &deprecated_tm_print_insn_info);
#endif
insn = read_memory_unsigned_integer (current_pc, 2);
if (v850_processor_type_table[i].mach == info.bfd_arch_info->mach)
{
v850_register_names = v850_processor_type_table[i].regnames;
- tm_print_insn_info.mach = info.bfd_arch_info->mach;
+ deprecated_tm_print_insn_info.mach = info.bfd_arch_info->mach;
break;
}
}