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-28  Andrew Cagney  <cagney@redhat.com>

	* gdbint.texinfo (Target Architecture Definition): Replace
	read_fp, TARGET_READ_FP and FP_REGNUM, with deprecated_read_fp,
	DEPRECATED_TARGET_READ_FP and DEPRECATED_REGNUM.
This commit is contained in:
Andrew Cagney 2003-04-30 22:01:38 +00:00
parent 165a7f90d4
commit 810ecf9ffe
17 changed files with 120 additions and 96 deletions

View File

@ -1,3 +1,35 @@
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.

View File

@ -1656,7 +1656,7 @@ demangle.o: demangle.c $(defs_h) $(command_h) $(gdbcmd_h) $(demangle_h) \
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)

View File

@ -238,28 +238,6 @@ read_memory (CORE_ADDR memaddr, char *myaddr, int len)
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

View File

@ -1360,7 +1360,7 @@ display_trace (int low, int high)
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);
}

View File

@ -24,8 +24,8 @@
#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
@ -43,6 +43,28 @@ struct dis_line_entry
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;
@ -391,3 +413,21 @@ gdb_disassembly (struct ui_out *uiout,
gdb_flush (gdb_stdout);
}
/* 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;
}

View File

@ -6219,8 +6219,6 @@ gdbarch_update_p (struct gdbarch_info info)
/* 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);
@ -6229,12 +6227,6 @@ _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,

View File

@ -3381,23 +3381,11 @@ extern const struct bfd_arch_info *target_architecture;
/* 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 gdb_disassemble, and gdbarch_print_insn instead. */
extern int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info*);
/* Use set_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
extern disassemble_info deprecated_tm_print_insn_info;
/* Set the dynamic target-system-dependent parameters (architecture,
byte-order, ...) using information found in the BFD */

View File

@ -1213,23 +1213,11 @@ extern const struct bfd_arch_info *target_architecture;
/* 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 gdb_disassemble, and gdbarch_print_insn instead. */
extern int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info*);
/* Use set_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
extern disassemble_info deprecated_tm_print_insn_info;
/* Set the dynamic target-system-dependent parameters (architecture,
byte-order, ...) using information found in the BFD */
@ -2383,8 +2371,6 @@ gdbarch_update_p (struct gdbarch_info info)
/* 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);
@ -2393,12 +2379,6 @@ _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,

View File

@ -2252,5 +2252,5 @@ _initialize_ia64_tdep (void)
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;
}

View File

@ -163,7 +163,7 @@ mcore_dump_insn (char *commnt, CORE_ADDR pc, int insn)
{
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");
}
}

View File

@ -5543,9 +5543,9 @@ mips_gdbarch_init (struct gdbarch_info info,
/* 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;
@ -5626,7 +5626,7 @@ mips_gdbarch_init (struct gdbarch_info info,
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)
@ -5634,17 +5634,17 @@ mips_gdbarch_init (struct gdbarch_info info,
/* 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,
@ -5652,7 +5652,7 @@ mips_gdbarch_init (struct gdbarch_info info,
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)
{

View File

@ -2243,21 +2243,25 @@ printf_command (char *arg, int from_tty)
/* 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);
}

View File

@ -280,7 +280,7 @@ s390_get_frame_info (CORE_ADDR pc, struct frame_extra_info *fextra_info,
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)
@ -682,7 +682,7 @@ s390_check_function_end (CORE_ADDR pc)
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;
@ -819,7 +819,7 @@ s390_is_sigreturn (CORE_ADDR pc, struct frame_info *sighandler_fi,
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;

View File

@ -2464,7 +2464,7 @@ _initialize_sparc_tdep (void)
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; */
}

View File

@ -1,3 +1,9 @@
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,

View File

@ -73,7 +73,11 @@ tui_disassemble (struct tui_asm_line* lines, CORE_ADDR pc, int count)
/* 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)

View File

@ -614,7 +614,7 @@ v850_scan_prologue (CORE_ADDR pc, struct prologue_info *pi)
#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);
@ -1215,7 +1215,7 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
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;
}
}