diff options
author | Alan Hayward <alan.hayward@arm.com> | 2018-09-13 16:44:48 +0100 |
---|---|---|
committer | Alan Hayward <alan.hayward@arm.com> | 2018-09-13 16:44:48 +0100 |
commit | 94db4093aa62bad3fc8abea6ba6b353b1699e6bb (patch) | |
tree | 7dea58cc71935af4fc74243e43c859e9eddf23d1 | |
parent | ce7ec4c76f96750377f9e2b880b9640810bb7e2e (diff) | |
download | gdb-94db4093aa62bad3fc8abea6ba6b353b1699e6bb.zip gdb-94db4093aa62bad3fc8abea6ba6b353b1699e6bb.tar.gz gdb-94db4093aa62bad3fc8abea6ba6b353b1699e6bb.tar.bz2 |
Name and seperate the union in gdbarch_info
Add gdbarch_target_info as a new union. This will allow it to be
used directly as a parameter to functions in later patches.
2018-09-13 Alan Hayward <alan.hayward@arm.com>
* aarch64-linux-nat.c
(aarch64_linux_nat_target::thread_architecture): Use target_info.
* aarch64-tdep.c (aarch64_gdbarch_init): Likewise.
* amd64-linux-tdep.c (amd64_linux_init_abi): Likewise.
(amd64_x32_linux_init_abi): Likewise.
* amd64-tdep.c (amd64_init_abi): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* gdbarch.sh (gdbarch_target_info): Add union
(gdbarch_info): Use gdbarch_target_info.
* i386-linux-tdep.c (i386_linux_init_abi): Use target_info.
* i386-tdep.c (i386_gdbarch_init): Likewise.
* mips-linux-tdep.c (mips_linux_init_abi): Likewise.
* mips-tdep.c (mips_gdbarch_init): Likewise.
* nds32-tdep.c (nds32_gdbarch_init): Likewise.
* ppc-linux-tdep.c (ppu2spu_sniffer): Likewise.
(ppc_linux_init_abi): Likewise.
* rs6000-tdep.c (rs6000_gdbarch_init): Likewise.
* s390-tdep.c (s390_gdbarch_init): Likewise.
* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
* spu-multiarch.c (spu_gdbarch): Likewise.
* spu-tdep.c (spu_gdbarch_init): Likewise.
-rw-r--r-- | gdb/aarch64-linux-nat.c | 2 | ||||
-rw-r--r-- | gdb/aarch64-tdep.c | 6 | ||||
-rw-r--r-- | gdb/amd64-linux-tdep.c | 4 | ||||
-rw-r--r-- | gdb/amd64-tdep.c | 2 | ||||
-rw-r--r-- | gdb/gdbarch.c | 4 | ||||
-rw-r--r-- | gdb/gdbarch.h | 34 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 38 | ||||
-rw-r--r-- | gdb/i386-linux-tdep.c | 2 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 2 | ||||
-rw-r--r-- | gdb/mips-linux-tdep.c | 2 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 2 | ||||
-rw-r--r-- | gdb/nds32-tdep.c | 2 | ||||
-rw-r--r-- | gdb/ppc-linux-tdep.c | 4 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 2 | ||||
-rw-r--r-- | gdb/s390-tdep.c | 2 | ||||
-rw-r--r-- | gdb/sparc-tdep.c | 2 | ||||
-rw-r--r-- | gdb/spu-multiarch.c | 2 | ||||
-rw-r--r-- | gdb/spu-tdep.c | 4 |
18 files changed, 62 insertions, 54 deletions
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 61da550..9105c4f 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -915,7 +915,7 @@ aarch64_linux_nat_target::thread_architecture (ptid_t ptid) struct gdbarch_info info; gdbarch_info_init (&info); info.bfd_arch_info = bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu); - info.id = (int *) vq; + info.target_info.id = (int *) vq; return gdbarch_find_by_info (info); } diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 498864d..9859ba1 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -2990,8 +2990,8 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Use the vector length passed via the target info. Otherwise use the vector length from the existing tdesc. Otherwise assume no SVE. */ - if (info.id != 0) - vq = (uint64_t) info.id; + if (info.target_info.id != 0) + vq = (uint64_t) info.target_info.id; else vq = aarch64_get_tdesc_vq (tdesc); @@ -3159,7 +3159,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Hook in the ABI-specific overrides, if they have been registered. */ info.target_desc = tdesc; - info.tdesc_data = tdesc_data; + info.target_info.tdesc_data = tdesc_data; gdbarch_init_osabi (info, gdbarch); dwarf2_frame_set_init_reg (gdbarch, aarch64_dwarf2_frame_init_reg); diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index 7ab4389..3bd4ba1 100644 --- a/gdb/amd64-linux-tdep.c +++ b/gdb/amd64-linux-tdep.c @@ -1854,7 +1854,7 @@ static void amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - struct tdesc_arch_data *tdesc_data = info.tdesc_data; + struct tdesc_arch_data *tdesc_data = info.target_info.tdesc_data; const struct tdesc_feature *feature; int valid_p; @@ -2068,7 +2068,7 @@ static void amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - struct tdesc_arch_data *tdesc_data = info.tdesc_data; + struct tdesc_arch_data *tdesc_data = info.target_info.tdesc_data; const struct tdesc_feature *feature; int valid_p; diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 088542d..57119ac 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -3104,7 +3104,7 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch, const struct tdesc_feature *feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.segments"); struct tdesc_arch_data *tdesc_data_segments = - (struct tdesc_arch_data *) info.tdep_info; + (struct tdesc_arch_data *) info.target_info.tdep_info; tdesc_numbered_register (feature, tdesc_data_segments, AMD64_FSBASE_REGNUM, "fs_base"); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index e2abf26..19dacea 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -5402,8 +5402,8 @@ gdbarch_find_by_info (struct gdbarch_info info) "gdbarch_find_by_info: info.abfd %s\n", host_address_to_string (info.abfd)); fprintf_unfiltered (gdb_stdlog, - "gdbarch_find_by_info: info.tdep_info %s\n", - host_address_to_string (info.tdep_info)); + "gdbarch_find_by_info: info.target_info.tdep_info %s\n", + host_address_to_string (info.target_info.tdep_info)); } /* Find the tdep code that knows about this architecture. */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index fc2f1a8..72edc79 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -102,6 +102,24 @@ typedef void (iterate_over_regset_sections_cb) (const char *sect_name, int supply_size, int collect_size, const struct regset *regset, const char *human_name, void *cb_data); +/* Different targets need different indentification data for gdbarch_info. */ +union gdbarch_target_info +{ + /* Architecture-specific information. The generic form for targets + that have extra requirements. */ + struct gdbarch_tdep_info *tdep_info; + + /* Architecture-specific target description data. Numerous targets + need only this, so give them an easy way to hold it. */ + struct tdesc_arch_data *tdesc_data; + + /* SPU file system ID. This is a single integer, so using the + generic form would only complicate code. Other targets may + reuse this member if suitable. */ + int *id; +}; + + /* The following are pre-initialized by GDBARCH. */ @@ -1652,21 +1670,7 @@ struct gdbarch_info bfd *abfd; /* Use default: NULL (ZERO). */ - union - { - /* Architecture-specific information. The generic form for targets - that have extra requirements. */ - struct gdbarch_tdep_info *tdep_info; - - /* Architecture-specific target description data. Numerous targets - need only this, so give them an easy way to hold it. */ - struct tdesc_arch_data *tdesc_data; - - /* SPU file system ID. This is a single integer, so using the - generic form would only complicate code. Other targets may - reuse this member if suitable. */ - int *id; - }; + union gdbarch_target_info target_info; /* Use default: GDB_OSABI_UNINITIALIZED (-1). */ enum gdb_osabi osabi; diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 670ac30..9e770c4 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -1327,6 +1327,24 @@ typedef int (iterate_over_objfiles_in_search_order_cb_ftype) typedef void (iterate_over_regset_sections_cb) (const char *sect_name, int supply_size, int collect_size, const struct regset *regset, const char *human_name, void *cb_data); + +/* Different targets need different indentification data for gdbarch_info. */ +union gdbarch_target_info +{ + /* Architecture-specific information. The generic form for targets + that have extra requirements. */ + struct gdbarch_tdep_info *tdep_info; + + /* Architecture-specific target description data. Numerous targets + need only this, so give them an easy way to hold it. */ + struct tdesc_arch_data *tdesc_data; + + /* SPU file system ID. This is a single integer, so using the + generic form would only complicate code. Other targets may + reuse this member if suitable. */ + int *id; +}; + EOF # function typedef's @@ -1476,21 +1494,7 @@ struct gdbarch_info bfd *abfd; /* Use default: NULL (ZERO). */ - union - { - /* Architecture-specific information. The generic form for targets - that have extra requirements. */ - struct gdbarch_tdep_info *tdep_info; - - /* Architecture-specific target description data. Numerous targets - need only this, so give them an easy way to hold it. */ - struct tdesc_arch_data *tdesc_data; - - /* SPU file system ID. This is a single integer, so using the - generic form would only complicate code. Other targets may - reuse this member if suitable. */ - int *id; - }; + union gdbarch_target_info target_info; /* Use default: GDB_OSABI_UNINITIALIZED (-1). */ enum gdb_osabi osabi; @@ -2420,8 +2424,8 @@ gdbarch_find_by_info (struct gdbarch_info info) "gdbarch_find_by_info: info.abfd %s\n", host_address_to_string (info.abfd)); fprintf_unfiltered (gdb_stdlog, - "gdbarch_find_by_info: info.tdep_info %s\n", - host_address_to_string (info.tdep_info)); + "gdbarch_find_by_info: info.target_info.tdep_info %s\n", + host_address_to_string (info.target_info.tdep_info)); } /* Find the tdep code that knows about this architecture. */ diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 802c41f..9fae6e1 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -825,7 +825,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); const struct target_desc *tdesc = info.target_desc; - struct tdesc_arch_data *tdesc_data = info.tdesc_data; + struct tdesc_arch_data *tdesc_data = info.target_info.tdesc_data; const struct tdesc_feature *feature; int valid_p; diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index a6994aa..9fb8667 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -8604,7 +8604,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Hook in ABI-specific overrides, if they have been registered. Note: If INFO specifies a 64 bit arch, this is where we turn a 32-bit i386 into a 64-bit amd64. */ - info.tdesc_data = tdesc_data; + info.target_info.tdesc_data = tdesc_data; gdbarch_init_osabi (info, gdbarch); if (!i386_validate_tdesc_p (tdep, tdesc_data)) diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 575575f..a5ede2b 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -1531,7 +1531,7 @@ mips_linux_init_abi (struct gdbarch_info info, { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); enum mips_abi abi = mips_abi (gdbarch); - struct tdesc_arch_data *tdesc_data = info.tdesc_data; + struct tdesc_arch_data *tdesc_data = info.target_info.tdesc_data; linux_init_abi (info, gdbarch); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 5e0a606..87f3861 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -8769,7 +8769,7 @@ mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) mips_register_g_packet_guesses (gdbarch); /* Hook in OS ABI-specific overrides, if they have been registered. */ - info.tdesc_data = tdesc_data; + info.target_info.tdesc_data = tdesc_data; gdbarch_init_osabi (info, gdbarch); /* The hook may have adjusted num_regs, fetch the final value and diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c index b616cc9..939c659 100644 --- a/gdb/nds32-tdep.c +++ b/gdb/nds32-tdep.c @@ -2130,7 +2130,7 @@ nds32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) nds32_add_reggroups (gdbarch); /* Hook in ABI-specific overrides, if they have been registered. */ - info.tdesc_data = tdesc_data; + info.target_info.tdesc_data = tdesc_data; gdbarch_init_osabi (info, gdbarch); /* Override tdesc_register callbacks for system registers. */ diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 817a002..6634a57 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1424,7 +1424,7 @@ ppu2spu_sniffer (const struct frame_unwind *self, info.bfd_arch_info = bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu); info.byte_order = BFD_ENDIAN_BIG; info.osabi = GDB_OSABI_LINUX; - info.id = &data.id; + info.target_info.id = &data.id; data.gdbarch = gdbarch_find_by_info (info); if (!data.gdbarch) return 0; @@ -1729,7 +1729,7 @@ ppc_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - struct tdesc_arch_data *tdesc_data = info.tdesc_data; + struct tdesc_arch_data *tdesc_data = info.target_info.tdesc_data; static const char *const stap_integer_prefixes[] = { "i", NULL }; static const char *const stap_register_indirection_prefixes[] = { "(", NULL }; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 5a3e65f..d3fe416 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -6416,7 +6416,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Hook in ABI-specific overrides, if they have been registered. */ info.target_desc = tdesc; - info.tdesc_data = tdesc_data; + info.target_info.tdesc_data = tdesc_data; gdbarch_init_osabi (info, gdbarch); switch (info.osabi) diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index e962824..7853b36 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -6932,7 +6932,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) struct gdbarch_tdep *tdep = s390_gdbarch_tdep_alloc (); struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep); struct tdesc_arch_data *tdesc_data = tdesc_data_alloc (); - info.tdesc_data = tdesc_data; + info.target_info.tdesc_data = tdesc_data; set_gdbarch_believe_pcc_promotion (gdbarch, 0); set_gdbarch_char_signed (gdbarch, 0); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 7a50a8d..c46788c 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -1925,7 +1925,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) } /* Target description may have changed. */ - info.tdesc_data = tdesc_data; + info.target_info.tdesc_data = tdesc_data; tdesc_use_registers (gdbarch, tdesc, tdesc_data); } diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c index 7e642d6..8111b28 100644 --- a/gdb/spu-multiarch.c +++ b/gdb/spu-multiarch.c @@ -143,7 +143,7 @@ spu_gdbarch (int spufs_fd) info.bfd_arch_info = bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu); info.byte_order = BFD_ENDIAN_BIG; info.osabi = GDB_OSABI_LINUX; - info.id = &spufs_fd; + info.target_info.id = &spufs_fd; return gdbarch_find_by_info (info); } diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index 6ae37f5..f72de04 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -2644,8 +2644,8 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) int id = -1; /* Which spufs ID was requested as address space? */ - if (info.id) - id = *info.id; + if (info.target_info.id) + id = *info.target_info.id; /* For objfile architectures of SPU solibs, decode the ID from the name. This assumes the filename convention employed by solib-spu.c. */ else if (info.abfd) |