This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Note on handling Android special symbols


It seems that some special Android ART symbols in .oat and .odex framework
libraries can prevent GDB to detect ARM/Thumb mode under some circumstances;
since LLDB is known to have a kinda workaround, shouldn't GDB incorporate
something similar? See https://github.com/android-ndk/ndk/issues/628 and
https://reviews.llvm.org/rL274500 for details.

Dmitry
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 103b2144c3..f144cdd45f 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -241,6 +241,11 @@ elf_symtab_read (minimal_symbol_reader &reader,
   int stripped = (bfd_get_symcount (objfile->obfd) == 0);
   int elf_make_msymbol_special_p
     = gdbarch_elf_make_msymbol_special_p (gdbarch);
+  /* Hack to skip some special Android symbols.  Stolen
+     from LLDB, see https://reviews.llvm.org/rL274500.  */
+  const char *ext = strrchr (objfile_name (objfile), '.');
+  int skip_android_special_symbols_p
+    = ext ? (!strcmp (ext + 1, "oat") || !strcmp (ext + 1, "odex")) : 0;
 
   for (i = 0; i < number_of_symbols; i++)
     {
@@ -252,6 +257,11 @@ elf_symtab_read (minimal_symbol_reader &reader,
 	  continue;
 	}
 
+      if (skip_android_special_symbols_p &&
+	  (!strcmp (sym->name, "oatdata") ||
+	   !strcmp (sym->name, "oatexec")))
+	continue;
+
       /* Skip "special" symbols, e.g. ARM mapping symbols.  These are
 	 symbols which do not correspond to objects in the symbol table,
 	 but have some other target-specific meaning.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]