Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: gdb/nacl-tdep.c

Issue 10829380: Detect NaCl osabi from objfile (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/nacl-tdep.c
diff --git a/gdb/nacl-tdep.c b/gdb/nacl-tdep.c
index e7a1a8f40aedf565619f8cf2c1850ab36d357a85..9a408ddbfcb534f2b1a730b980c86be6daf521b3 100644
--- a/gdb/nacl-tdep.c
+++ b/gdb/nacl-tdep.c
@@ -30,6 +30,19 @@
#include "disasm.h"
#include "breakpoint.h"
#include "target.h"
+#include "elf-bfd.h"
+
+static enum gdb_osabi
+nacl_osabi_sniffer (bfd *abfd)
+{
+ /* WARNING! This way of checking for NaCl OS ABI is deprecated.
+ See http://code.google.com/p/nativeclient/issues/detail?id=2971 */
+ if (bfd_get_flavour (abfd) == bfd_target_elf_flavour &&
+ elf_elfheader (abfd)->e_ident[EI_OSABI] == 123)
+ return GDB_OSABI_NACL;
+
+ return GDB_OSABI_UNKNOWN;
+}
static void
nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -153,6 +166,7 @@ static void
amd64_nacl_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
linux_init_abi (info, gdbarch);
amd64_init_abi (info, gdbarch);
tdep->tdesc = tdesc_amd64_linux;
@@ -193,6 +207,9 @@ extern void _initialize_nacl_tdep (void);
void
_initialize_nacl_tdep (void)
{
+ gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
+ nacl_osabi_sniffer);
+
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
GDB_OSABI_NACL, amd64_nacl_init_abi);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698