diff options
Diffstat (limited to 'gdb/osabi.c')
-rw-r--r-- | gdb/osabi.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/gdb/osabi.c b/gdb/osabi.c index bbd7635..f1b7f22 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -332,9 +332,10 @@ can_run_code_for (const struct bfd_arch_info *a, const struct bfd_arch_info *b) return (a == b || a->compatible (a, b) == a); } +/* Return OS ABI handler for INFO. */ -void -gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch) +static struct gdb_osabi_handler * +gdbarch_osabi_handler (struct gdbarch_info info) { struct gdb_osabi_handler *handler; @@ -367,10 +368,32 @@ gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch) ISA"). BFD doesn't normally consider 32-bit and 64-bit "compatible" so it doesn't succeed. */ if (can_run_code_for (info.bfd_arch_info, handler->arch_info)) - { - (*handler->init_osabi) (info, gdbarch); - return; - } + return handler; + } + + return nullptr; +} + +/* See osabi.h. */ + +bool +has_gdb_osabi_handler (struct gdbarch_info info) +{ + return gdbarch_osabi_handler (info) != nullptr; +} + +void +gdbarch_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + struct gdb_osabi_handler *handler; + + gdb_assert (info.osabi != GDB_OSABI_UNKNOWN); + handler = gdbarch_osabi_handler (info); + + if (handler != nullptr) + { + (*handler->init_osabi) (info, gdbarch); + return; } if (info.osabi == GDB_OSABI_NONE) |