mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-25 11:04:18 +08:00
CARP:
Pass gdbarch_info by value to the arch init function. Review doco. Update mips-tdep.c
This commit is contained in:
parent
492eae092d
commit
2e64ee9aae
@ -1,3 +1,29 @@
|
||||
start-sanitize-carp start-sanitize-vr4xxx
|
||||
Fri Dec 18 12:56:56 1998 Andrew Cagney <cagney@chook>
|
||||
|
||||
* gdbarch.h (gdbarch_init_ftype): Pass struct gdbarch_info
|
||||
by-value.
|
||||
(struct gdbarch_info): Add struct gdbarch_tdep_info *tdep_info.
|
||||
* gdbarch.c (gdbarch_update): Update.
|
||||
* mips-tdep.c: (mips_gdbarch_init): Update
|
||||
|
||||
* gdbarch.c (gdbarch_update): Add more tracing.
|
||||
|
||||
end-sanitize-carp end-sanitize-vr4xxx
|
||||
Thu Dec 17 02:15:40 1998 Andrew Cagney <cagney@chook.cygnus.com>
|
||||
|
||||
* configure.tgt (gdb_target): Identify mips64*vr4100*-*-elf* as
|
||||
vr4100.
|
||||
* config/mips/vr4100.mt, config/mips/tm-vr4100.h: Replace
|
||||
vr4xxx.mt and tm-vr4xxx.h.
|
||||
start-sanitize-vr4xxx
|
||||
|
||||
* configure.tgt (gdb_target): Identify mips64*vr4xxx*-*-elf* as
|
||||
vr4xxx.
|
||||
* config/mips/vr4xxx.mt, config/mips/tm-vr4xxx.h: New files.
|
||||
Define GDB_MULTI_ARCH and MIPS_DEFAULT_FPU_TYPE.
|
||||
end-sanitize-vr4xxx
|
||||
|
||||
start-sanitize-carp start-sanitize-vr4xxx
|
||||
Thu Dec 17 02:06:17 1998 Andrew Cagney <cagney@chook.cygnus.com>
|
||||
|
||||
|
@ -62,12 +62,12 @@ struct gdbarch
|
||||
|
||||
When adding to the below you must also: declare/define set/get
|
||||
value functions; override the corresponding macro in gdbarch.h;
|
||||
initialize the value in gdbarch_alloc() (if zero is an unsuitable
|
||||
default); confirm that the target updated the value correctly in
|
||||
verify_gdbarch(); add a fprintf_unfiltered call to
|
||||
if zero/NULL is not a suitable default, initialize the field in
|
||||
gdbarch_alloc(); confirm that the target updated the value
|
||||
correctly in verify_gdbarch(); add a fprintf_unfiltered call to
|
||||
gdbarch_update() so that the new field is dumped out; append an
|
||||
initial value to the static variable DEFAULT_GDBARCH (base values
|
||||
on the host's c-type system). */
|
||||
initial value to the static variable ``default_gdbarch'' (base
|
||||
values on the host's c-type system). */
|
||||
|
||||
int long_bit;
|
||||
int long_long_bit;
|
||||
@ -478,8 +478,33 @@ gdbarch_update (info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (gdbarch_debug)
|
||||
{
|
||||
fprintf_unfiltered (stderr,
|
||||
"gdbarch_update: info.bfd_architecture %d (%s)\n",
|
||||
info.bfd_architecture,
|
||||
bfd_lookup_arch (info.bfd_architecture, 0)->printable_name);
|
||||
fprintf_unfiltered (stderr,
|
||||
"gdbarch_update: info.bfd_arch_info %s\n",
|
||||
(info.bfd_arch_info != NULL
|
||||
? info.bfd_arch_info->printable_name
|
||||
: "(null)"));
|
||||
fprintf_unfiltered (stderr,
|
||||
"gdbarch_update: info.byte_order %d (%s)\n",
|
||||
info.byte_order,
|
||||
(info.byte_order == BIG_ENDIAN ? "big"
|
||||
: info.byte_order == LITTLE_ENDIAN ? "little"
|
||||
: "default"));
|
||||
fprintf_unfiltered (stderr,
|
||||
"gdbarch_update: info.abfd 0x%lx\n",
|
||||
(long) info.abfd);
|
||||
fprintf_unfiltered (stderr,
|
||||
"gdbarch_update: info.tdep_info 0x%lx\n",
|
||||
(long) info.tdep_info);
|
||||
}
|
||||
|
||||
/* Ask the target for a replacement architecture. */
|
||||
new_gdbarch = rego->init (&info, rego->arches);
|
||||
new_gdbarch = rego->init (info, rego->arches);
|
||||
|
||||
/* Did the target like it? No. Reject the change. */
|
||||
if (new_gdbarch == NULL)
|
||||
@ -528,13 +553,25 @@ gdbarch_update (info)
|
||||
current_gdbarch = new_gdbarch;
|
||||
if (gdbarch_debug)
|
||||
{
|
||||
fprintf_unfiltered (stderr, "gdbarch_update: New architecture 0x%08lx (%s) selected\n",
|
||||
fprintf_unfiltered (stderr,
|
||||
"gdbarch_update: New architecture 0x%08lx (%s) selected\n",
|
||||
(long) new_gdbarch,
|
||||
new_gdbarch->bfd_arch_info->printable_name);
|
||||
fprintf_unfiltered (stderr, "TARGET_BYTE_ORDER = %d\n", TARGET_BYTE_ORDER);
|
||||
fprintf_unfiltered (stderr, "TARGET_LONG_BIT = %d\n", TARGET_LONG_BIT);
|
||||
fprintf_unfiltered (stderr, "TARGET_LONG_LONG_BIT = %d\n", TARGET_LONG_LONG_BIT);
|
||||
fprintf_unfiltered (stderr, "TARGET_PTR_BIT = %d\n", TARGET_PTR_BIT);
|
||||
fprintf_unfiltered (stderr,
|
||||
"gdbarch_update: TARGET_BYTE_ORDER = %d (%s)\n",
|
||||
TARGET_BYTE_ORDER,
|
||||
(TARGET_BYTE_ORDER == BIG_ENDIAN ? "big"
|
||||
: TARGET_BYTE_ORDER == LITTLE_ENDIAN ? "little"
|
||||
: "default"));
|
||||
fprintf_unfiltered (stderr,
|
||||
"gdbarch_update: TARGET_LONG_BIT = %d\n",
|
||||
TARGET_LONG_BIT);
|
||||
fprintf_unfiltered (stderr,
|
||||
"gdbarch_update: TARGET_LONG_LONG_BIT = %d\n",
|
||||
TARGET_LONG_LONG_BIT);
|
||||
fprintf_unfiltered (stderr,
|
||||
"gdbarch_update: TARGET_PTR_BIT = %d\n",
|
||||
TARGET_PTR_BIT);
|
||||
}
|
||||
|
||||
/* Check that the newly installed architecture is valid. */
|
||||
|
@ -100,10 +100,9 @@ extern struct gdbarch_tdep *gdbarch_tdep PARAMS ((struct gdbarch*));
|
||||
INIT takes two parameters: INFO which contains the information
|
||||
available to gdbarch about the (possibly new) architecture; ARCHES
|
||||
which is a list of the previously created ``struct gdbarch'' for
|
||||
this architecture. Fields within the structure INFO which have no
|
||||
previous value are set to defaults: BFD_ARCHITECTURE -
|
||||
bfd_arch_unknown; BFD_ARCH_INFO - NULL; BYTE_ORDER - 0; ABFD -
|
||||
NULL;
|
||||
this architecture. When possible, and when no other value was
|
||||
provided, INFO is initialized using either the ABFD or the current
|
||||
GDBARCH.
|
||||
|
||||
The INIT function shall return any of: NULL indicating that it
|
||||
doesn't reconize the selected architecture; an existing ``struct
|
||||
@ -120,13 +119,23 @@ struct gdbarch_list
|
||||
|
||||
struct gdbarch_info
|
||||
{
|
||||
/* Default: bfd_arch_unknown. */
|
||||
enum bfd_architecture bfd_architecture;
|
||||
|
||||
/* Default: NULL */
|
||||
const struct bfd_arch_info *bfd_arch_info;
|
||||
|
||||
/* Default: 0 */
|
||||
int byte_order;
|
||||
|
||||
/* Default: NULL */
|
||||
bfd *abfd;
|
||||
|
||||
/* Default: NULL */
|
||||
struct gdbarch_tdep_info *tdep_info;
|
||||
};
|
||||
|
||||
typedef struct gdbarch *(gdbarch_init_ftype) PARAMS ((const struct gdbarch_info *info, struct gdbarch_list *arches));
|
||||
typedef struct gdbarch *(gdbarch_init_ftype) PARAMS ((struct gdbarch_info info, struct gdbarch_list *arches));
|
||||
|
||||
extern void register_gdbarch_init PARAMS ((enum bfd_architecture, gdbarch_init_ftype *));
|
||||
|
||||
|
@ -67,7 +67,7 @@ struct gdbarch_tdep
|
||||
#define MIPS_LAST_ARG_REGNUM (gdbarch_tdep (current_gdbarch)->mips_last_arg_regnum)
|
||||
#endif
|
||||
|
||||
/* end-sanitize-carp start-sanitize-vr4xxx */
|
||||
/* end-sanitize-carp end-sanitize-vr4xxx */
|
||||
|
||||
#define VM_MIN_ADDRESS (CORE_ADDR)0x400000
|
||||
|
||||
@ -3229,23 +3229,26 @@ mips_call_dummy_address ()
|
||||
static gdbarch_init_ftype mips_gdbarch_init;
|
||||
static struct gdbarch *
|
||||
mips_gdbarch_init (info, arches)
|
||||
const struct gdbarch_info *info;
|
||||
struct gdbarch_info info;
|
||||
struct gdbarch_list *arches;
|
||||
{
|
||||
struct gdbarch *gdbarch;
|
||||
struct gdbarch_tdep *tdep;
|
||||
int elf_abi;
|
||||
if (info->abfd != NULL)
|
||||
elf_abi = elf_elfheader (info->abfd)->e_flags & EF_MIPS_ABI;
|
||||
char *abi_name;
|
||||
|
||||
/* find a default for ELF_ABI */
|
||||
if (info.abfd != NULL)
|
||||
elf_abi = elf_elfheader (info.abfd)->e_flags & EF_MIPS_ABI;
|
||||
else if (gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_mips)
|
||||
elf_abi = gdbarch_tdep (current_gdbarch)->elf_abi;
|
||||
else
|
||||
elf_abi = 0;
|
||||
|
||||
/* try to find a pre-existing architecture */
|
||||
for (arches = gdbarch_list_lookup_by_info (arches, info);
|
||||
for (arches = gdbarch_list_lookup_by_info (arches, &info);
|
||||
arches != NULL;
|
||||
arches = gdbarch_list_lookup_by_info (arches->next, info))
|
||||
arches = gdbarch_list_lookup_by_info (arches->next, &info))
|
||||
{
|
||||
/* MIPS needs to be pedantic about which ABI the object is
|
||||
using. */
|
||||
@ -3256,31 +3259,36 @@ mips_gdbarch_init (info, arches)
|
||||
|
||||
/* Need a new architecture. Fill in a target specific vector. */
|
||||
tdep = (struct gdbarch_tdep*) xmalloc (sizeof (struct gdbarch_tdep));
|
||||
gdbarch = gdbarch_alloc (info, tdep);
|
||||
gdbarch = gdbarch_alloc (&info, tdep);
|
||||
tdep->elf_abi = elf_abi;
|
||||
switch (elf_abi)
|
||||
{
|
||||
case E_MIPS_ABI_O32:
|
||||
abi_name = "o32";
|
||||
tdep->mips_eabi = 0;
|
||||
set_gdbarch_long_bit (gdbarch, 32);
|
||||
set_gdbarch_ptr_bit (gdbarch, 32);
|
||||
break;
|
||||
case E_MIPS_ABI_O64:
|
||||
abi_name = "o64";
|
||||
tdep->mips_eabi = 0;
|
||||
set_gdbarch_long_bit (gdbarch, 32);
|
||||
set_gdbarch_ptr_bit (gdbarch, 32);
|
||||
break;
|
||||
case E_MIPS_ABI_EABI32:
|
||||
abi_name = "eabi32";
|
||||
tdep->mips_eabi = 1;
|
||||
set_gdbarch_long_bit (gdbarch, 32);
|
||||
set_gdbarch_ptr_bit (gdbarch, 32);
|
||||
break;
|
||||
case E_MIPS_ABI_EABI64:
|
||||
abi_name = "eabi64";
|
||||
tdep->mips_eabi = 1;
|
||||
set_gdbarch_long_bit (gdbarch, 64);
|
||||
set_gdbarch_ptr_bit (gdbarch, 64);
|
||||
break;
|
||||
default:
|
||||
abi_name = "default";
|
||||
tdep->mips_eabi = 0;
|
||||
set_gdbarch_long_bit (gdbarch, 32);
|
||||
set_gdbarch_ptr_bit (gdbarch, 32);
|
||||
@ -3304,15 +3312,25 @@ mips_gdbarch_init (info, arches)
|
||||
|
||||
if (gdbarch_debug)
|
||||
{
|
||||
fprintf_unfiltered (stderr, "MIPS_EABI = %d\n", tdep->mips_eabi);
|
||||
fprintf_unfiltered (stderr, "MIPS_LAST_ARG_REGNUM = %d\n", tdep->mips_last_arg_regnum);
|
||||
fprintf_unfiltered (stderr, "MIPS_LAST_FP_ARG_REGNUM = %d (%d)\n", tdep->mips_last_fp_arg_regnum, tdep->mips_last_fp_arg_regnum - FP0_REGNUM);
|
||||
fprintf_unfiltered (stderr,
|
||||
"mips_gdbarch_init: (info)elf_abi 0x%x (%s)\n",
|
||||
elf_abi, abi_name);
|
||||
fprintf_unfiltered (stderr,
|
||||
"mips_gdbarch_init: MIPS_EABI = %d\n",
|
||||
tdep->mips_eabi);
|
||||
fprintf_unfiltered (stderr,
|
||||
"mips_gdbarch_init: MIPS_LAST_ARG_REGNUM = %d\n",
|
||||
tdep->mips_last_arg_regnum);
|
||||
fprintf_unfiltered (stderr,
|
||||
"mips_gdbarch_init: MIPS_LAST_FP_ARG_REGNUM = %d (%d)\n",
|
||||
tdep->mips_last_fp_arg_regnum,
|
||||
tdep->mips_last_fp_arg_regnum - FP0_REGNUM);
|
||||
}
|
||||
|
||||
return gdbarch;
|
||||
}
|
||||
|
||||
/* end-sanitize-carp start-sanitize-vr4xxx */
|
||||
/* end-sanitize-carp end-sanitize-vr4xxx */
|
||||
|
||||
void
|
||||
_initialize_mips_tdep ()
|
||||
@ -3322,7 +3340,7 @@ _initialize_mips_tdep ()
|
||||
/* start-sanitize-carp start-sanitize-vr4xxx */
|
||||
if (GDB_MULTI_ARCH)
|
||||
register_gdbarch_init (bfd_arch_mips, mips_gdbarch_init);
|
||||
/* end-sanitize-carp start-sanitize-vr4xxx */
|
||||
/* end-sanitize-carp end-sanitize-vr4xxx */
|
||||
if (!tm_print_insn) /* Someone may have already set it */
|
||||
tm_print_insn = gdb_print_insn_mips;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user