diff options
author | Daniel Jacobowitz <drow@false.org> | 2002-06-09 19:36:15 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2002-06-09 19:36:15 +0000 |
commit | caaa3122d826d264e30046a5895fea2c8253c625 (patch) | |
tree | 0ffc013936ce87d96ec1c89c98f3e524ce8957b5 | |
parent | 8a6def3ba3af7395f6130850e52edbba32606fe0 (diff) | |
download | gdb-caaa3122d826d264e30046a5895fea2c8253c625.zip gdb-caaa3122d826d264e30046a5895fea2c8253c625.tar.gz gdb-caaa3122d826d264e30046a5895fea2c8253c625.tar.bz2 |
2002-06-09 Daniel Jacobowitz <drow@mvista.com>
* mips-tdep.c (mips_find_abi_section): New function.
(mips_gdbarch_init): Call it.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/mips-tdep.c | 30 |
2 files changed, 35 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bbe728e..f4c0016 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2002-06-09 Daniel Jacobowitz <drow@mvista.com> + + * mips-tdep.c (mips_find_abi_section): New function. + (mips_gdbarch_init): Call it. + 2002-06-09 Mark Kettenis <kettenis@gnu.org> * solib-svr4.c (init_fetch_link_map_offsets): Simply return diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 67409f6..c62886c 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -4126,6 +4126,32 @@ mips_integer_to_address (struct type *type, void *buf) TYPE_LENGTH (builtin_type_void_data_ptr)); } +static void +mips_find_abi_section (bfd *abfd, asection *sect, void *obj) +{ + enum mips_abi *abip = (enum mips_abi *) obj; + const char *name = bfd_get_section_name (abfd, sect); + + if (*abip != MIPS_ABI_UNKNOWN) + return; + + if (strncmp (name, ".mdebug.", 8) != 0) + return; + + if (strcmp (name, ".mdebug.abi32") == 0) + *abip = MIPS_ABI_O32; + else if (strcmp (name, ".mdebug.abiN32") == 0) + *abip = MIPS_ABI_N32; + else if (strcmp (name, ".mdebug.abiO64") == 0) + *abip = MIPS_ABI_O64; + else if (strcmp (name, ".mdebug.eabi32") == 0) + *abip = MIPS_ABI_EABI32; + else if (strcmp (name, ".mdebug.eabi64") == 0) + *abip = MIPS_ABI_EABI64; + else + warning ("unsupported ABI %s.", name + 8); +} + static struct gdbarch * mips_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) @@ -4180,6 +4206,10 @@ mips_gdbarch_init (struct gdbarch_info info, break; } + /* GCC creates a pseudo-section whose name describes the ABI. */ + if (mips_abi == MIPS_ABI_UNKNOWN && info.abfd != NULL) + bfd_map_over_sections (info.abfd, mips_find_abi_section, &mips_abi); + /* Try the architecture for any hint of the corect ABI */ if (mips_abi == MIPS_ABI_UNKNOWN && info.bfd_arch_info != NULL |