summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2015-03-18 10:36:27 +0000
committerTamas Berghammer <tberghammer@google.com>2015-03-18 10:36:27 +0000
commitdb037d9c4914aec989c860888230b2ce70dce019 (patch)
tree86fa7f0b7c9bc1e1b658204e91f18a56f3d0bf05 /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
parent1a9f58b32d7e5892aa7c360ff11c07641e8c7159 (diff)
downloadbcm5719-llvm-db037d9c4914aec989c860888230b2ce70dce019.tar.gz
bcm5719-llvm-db037d9c4914aec989c860888230b2ce70dce019.zip
Parse .note.android.ident header from elf files
In android a .note.android.ident section header is added to the elf files to provide information for the debuggers that it is an android specific module. This CL add logic to parse it out from the elf files and set the module specification based on it. Differential revision: http://reviews.llvm.org/D8377 llvm-svn: 232625
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 74776652770..0ca92de175f 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -48,6 +48,7 @@ const char *const LLDB_NT_OWNER_FREEBSD = "FreeBSD";
const char *const LLDB_NT_OWNER_GNU = "GNU";
const char *const LLDB_NT_OWNER_NETBSD = "NetBSD";
const char *const LLDB_NT_OWNER_CSR = "csr";
+const char *const LLDB_NT_OWNER_ANDROID = "Android";
// ELF note type definitions
const elf_word LLDB_NT_FREEBSD_ABI_TAG = 0x01;
@@ -1362,6 +1363,11 @@ ObjectFileELF::RefineModuleDetailsFromNote (lldb_private::DataExtractor &data, l
(void)cstr;
}
}
+ else if (note.n_name == LLDB_NT_OWNER_ANDROID)
+ {
+ arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux);
+ arch_spec.GetTriple().setEnvironment(llvm::Triple::EnvironmentType::Android);
+ }
if (!processed)
offset += llvm::RoundUpToAlignment(note.n_descsz, 4);
@@ -1478,7 +1484,15 @@ ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
}
// Process ELF note section entries.
- if (header.sh_type == SHT_NOTE)
+ bool is_note_header = (header.sh_type == SHT_NOTE);
+
+ // The section header ".note.android.ident" is stored as a
+ // PROGBITS type header but it is actually a note header.
+ static ConstString g_sect_name_android_ident (".note.android.ident");
+ if (!is_note_header && name == g_sect_name_android_ident)
+ is_note_header = true;
+
+ if (is_note_header)
{
// Allow notes to refine module info.
DataExtractor data;
OpenPOWER on IntegriCloud