gdb:csky save fpu and vdsp info to struct csky_gdbarch_tdep
First, add three variables fpu_abi, fpu_hardfp and vdsp_version to csky_gdbarch_tdep. They will be initialized from info.abfd in cskg_gdbarch_init. Now, they are just used to find a candidate among the list of pre-declared architectures Later, they will be used in gdbarch_return_value and gdbarch_push_dummy_call for funtions described below: fpu_abi: to check if the bfd is using VAL_CSKY_FPU_ABI_HARD or VAL_CSKY_FPU_ABI_SOFT fpu_hardfp: to check if the bfd is using VAL_CSKY_FPU_HARDFP_SINGLE or VAL_CSKY_FPU_HARDFP_DOUBLE vdsp_version: to check if a function is returned with CSKY_VRET_REGNUM
This commit is contained in:
parent
b0de9ed86f
commit
68538bbeaa
2 changed files with 43 additions and 4 deletions
|
@ -2154,16 +2154,52 @@ static struct gdbarch *
|
||||||
csky_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
csky_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch;
|
struct gdbarch *gdbarch;
|
||||||
|
/* Analyze info.abfd. */
|
||||||
|
unsigned int fpu_abi = 0;
|
||||||
|
unsigned int vdsp_version = 0;
|
||||||
|
unsigned int fpu_hardfp = 0;
|
||||||
|
|
||||||
|
/* When the type of bfd file is srec(or any files are not elf),
|
||||||
|
the E_FLAGS will be not credible. */
|
||||||
|
if (info.abfd != NULL && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
|
||||||
|
{
|
||||||
|
/* Get FPU, VDSP build options. */
|
||||||
|
fpu_abi = bfd_elf_get_obj_attr_int (info.abfd,
|
||||||
|
OBJ_ATTR_PROC,
|
||||||
|
Tag_CSKY_FPU_ABI);
|
||||||
|
vdsp_version = bfd_elf_get_obj_attr_int (info.abfd,
|
||||||
|
OBJ_ATTR_PROC,
|
||||||
|
Tag_CSKY_VDSP_VERSION);
|
||||||
|
fpu_hardfp = bfd_elf_get_obj_attr_int (info.abfd,
|
||||||
|
OBJ_ATTR_PROC,
|
||||||
|
Tag_CSKY_FPU_HARDFP);
|
||||||
|
}
|
||||||
|
|
||||||
/* Find a candidate among the list of pre-declared architectures. */
|
/* Find a candidate among the list of pre-declared architectures. */
|
||||||
arches = gdbarch_list_lookup_by_info (arches, &info);
|
for (arches = gdbarch_list_lookup_by_info (arches, &info);
|
||||||
if (arches != NULL)
|
arches != NULL;
|
||||||
return arches->gdbarch;
|
arches = gdbarch_list_lookup_by_info (arches->next, &info))
|
||||||
|
{
|
||||||
|
csky_gdbarch_tdep *tdep
|
||||||
|
= (csky_gdbarch_tdep *) gdbarch_tdep (arches->gdbarch);
|
||||||
|
if (fpu_abi != tdep->fpu_abi)
|
||||||
|
continue;
|
||||||
|
if (vdsp_version != tdep->vdsp_version)
|
||||||
|
continue;
|
||||||
|
if (fpu_hardfp != tdep->fpu_hardfp)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Found a match. */
|
||||||
|
return arches->gdbarch;
|
||||||
|
}
|
||||||
|
|
||||||
/* None found, create a new architecture from the information
|
/* None found, create a new architecture from the information
|
||||||
provided. */
|
provided. */
|
||||||
csky_gdbarch_tdep *tdep = new csky_gdbarch_tdep;
|
csky_gdbarch_tdep *tdep = new csky_gdbarch_tdep;
|
||||||
gdbarch = gdbarch_alloc (&info, tdep);
|
gdbarch = gdbarch_alloc (&info, tdep);
|
||||||
|
tdep->fpu_abi = fpu_abi;
|
||||||
|
tdep->vdsp_version = vdsp_version;
|
||||||
|
tdep->fpu_hardfp = fpu_hardfp;
|
||||||
|
|
||||||
/* Target data types. */
|
/* Target data types. */
|
||||||
set_gdbarch_ptr_bit (gdbarch, 32);
|
set_gdbarch_ptr_bit (gdbarch, 32);
|
||||||
|
|
|
@ -33,7 +33,10 @@ enum lr_type_t
|
||||||
/* Target-dependent structure in gdbarch. */
|
/* Target-dependent structure in gdbarch. */
|
||||||
struct csky_gdbarch_tdep : gdbarch_tdep
|
struct csky_gdbarch_tdep : gdbarch_tdep
|
||||||
{
|
{
|
||||||
/* This is Unused. */
|
/* Save FPU, VDSP ABI. */
|
||||||
|
unsigned int fpu_abi;
|
||||||
|
unsigned int fpu_hardfp;
|
||||||
|
unsigned int vdsp_version;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Instruction sizes. */
|
/* Instruction sizes. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue