diff options
author | Greg Clayton <gclayton@apple.com> | 2016-04-25 23:39:19 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2016-04-25 23:39:19 +0000 |
commit | 07c8c4475fb1fe9746027b91f2e4cfea3061e34a (patch) | |
tree | c48de895b021691323d0af5919633155692aa89d | |
parent | 6f6c5f2a023b046d131593a4edd96a64acb96726 (diff) | |
download | bcm5719-llvm-07c8c4475fb1fe9746027b91f2e4cfea3061e34a.tar.gz bcm5719-llvm-07c8c4475fb1fe9746027b91f2e4cfea3061e34a.zip |
Make sure that the following SymbolFileDWARF functions can handle getting a lldb::user_id_t for another SymbolFileDWARF:
CompilerDecl
SymbolFileDWARF::GetDeclForUID (lldb::user_id_t type_uid);
CompilerDeclContext
SymbolFileDWARF::GetDeclContextForUID (lldb::user_id_t type_uid)
CompilerDeclContext
SymbolFileDWARF::GetDeclContextContainingUID (lldb::user_id_t type_uid)
Type*
SymbolFileDWARF::ResolveTypeUID (lldb::user_id_t type_uid)
<rdar://problem/25592223>
llvm-svn: 267494
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 60 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h | 6 |
2 files changed, 57 insertions, 9 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 8b9726fbf2d..e3e5b7cb0ed 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1459,10 +1459,45 @@ SymbolFileDWARF::ParseDeclsForContext (CompilerDeclContext decl_ctx) ast_parser->GetDeclForUIDFromDWARF(decl); } +SymbolFileDWARF * +SymbolFileDWARF::GetDWARFForUID (lldb::user_id_t uid) +{ + // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API + // we must make sure we use the correct DWARF file when resolving things. + // On MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple + // SymbolFileDWARF classes, one for each .o file. We can often end up + // with references to other DWARF objects and we must be ready to receive + // a "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF + // instance. + SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile(); + if (debug_map) + return debug_map->GetSymbolFileByOSOIndex(debug_map->GetOSOIndexFromUserID(uid)); + return this; +} + +DWARFDIE +SymbolFileDWARF::GetDIEFromUID (lldb::user_id_t uid) +{ + // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API + // we must make sure we use the correct DWARF file when resolving things. + // On MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple + // SymbolFileDWARF classes, one for each .o file. We can often end up + // with references to other DWARF objects and we must be ready to receive + // a "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF + // instance. + SymbolFileDWARF *dwarf = GetDWARFForUID(uid); + if (dwarf) + return dwarf->GetDIE(DIERef(uid, dwarf)); + return DWARFDIE(); +} + CompilerDecl SymbolFileDWARF::GetDeclForUID (lldb::user_id_t type_uid) { - DWARFDIE die = GetDIE(DIERef(type_uid, this)); + // Anytime we have a lldb::user_id_t, we must get the DIE by + // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside + // the SymbolFileDWARF::GetDIEFromUID() for details. + DWARFDIE die = GetDIEFromUID(type_uid); if (die) return die.GetDecl(); return CompilerDecl(); @@ -1471,7 +1506,10 @@ SymbolFileDWARF::GetDeclForUID (lldb::user_id_t type_uid) CompilerDeclContext SymbolFileDWARF::GetDeclContextForUID (lldb::user_id_t type_uid) { - DWARFDIE die = GetDIE(DIERef(type_uid, this)); + // Anytime we have a lldb::user_id_t, we must get the DIE by + // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside + // the SymbolFileDWARF::GetDIEFromUID() for details. + DWARFDIE die = GetDIEFromUID(type_uid); if (die) return die.GetDeclContext(); return CompilerDeclContext(); @@ -1480,7 +1518,10 @@ SymbolFileDWARF::GetDeclContextForUID (lldb::user_id_t type_uid) CompilerDeclContext SymbolFileDWARF::GetDeclContextContainingUID (lldb::user_id_t type_uid) { - DWARFDIE die = GetDIE (DIERef(type_uid, this)); + // Anytime we have a lldb::user_id_t, we must get the DIE by + // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside + // the SymbolFileDWARF::GetDIEFromUID() for details. + DWARFDIE die = GetDIEFromUID(type_uid); if (die) return die.GetContainingDeclContext(); return CompilerDeclContext(); @@ -1490,13 +1531,14 @@ SymbolFileDWARF::GetDeclContextContainingUID (lldb::user_id_t type_uid) Type* SymbolFileDWARF::ResolveTypeUID (lldb::user_id_t type_uid) { - DWARFDIE type_die = GetDIE (DIERef(type_uid, this)); + // Anytime we have a lldb::user_id_t, we must get the DIE by + // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside + // the SymbolFileDWARF::GetDIEFromUID() for details. + DWARFDIE type_die = GetDIEFromUID(type_uid); if (type_die) - { - const bool assert_not_being_parsed = true; - return ResolveTypeUID (type_die, assert_not_being_parsed); - } - return NULL; + return type_die.ResolveType(); + else + return nullptr; } Type* diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index c0314e200ce..ae331978edf 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -160,6 +160,12 @@ public: bool assert_not_being_parsed = true, bool resolve_function_context = false); + SymbolFileDWARF * + GetDWARFForUID (lldb::user_id_t uid); + + DWARFDIE + GetDIEFromUID (lldb::user_id_t uid); + lldb_private::CompilerDecl GetDeclForUID (lldb::user_id_t uid) override; |