summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-10-19 18:09:39 +0000
committerGreg Clayton <gclayton@apple.com>2011-10-19 18:09:39 +0000
commit81c22f6104a391f4b3c9f072cf8cfd47b746367d (patch)
tree24933ab12c153c7af3b0604f4cfd54a457aa4c7f /lldb/source/Plugins
parentc620f554b9c465a9b1db8cd832bf2ce3e11447bf (diff)
downloadbcm5719-llvm-81c22f6104a391f4b3c9f072cf8cfd47b746367d.tar.gz
bcm5719-llvm-81c22f6104a391f4b3c9f072cf8cfd47b746367d.zip
Moved lldb::user_id_t values to be 64 bit. This was going to be needed for
process IDs, and thread IDs, but was mainly needed for for the UserID's for Types so that DWARF with debug map can work flawlessly. With DWARF in .o files the type ID was the DIE offset in the DWARF for the .o file which is not unique across all .o files, so now the SymbolFileDWARFDebugMap class will make the .o file index part (the high 32 bits) of the unique type identifier so it can uniquely identify the types. llvm-svn: 142534
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp16
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp14
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp34
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp183
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h17
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp48
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h10
9 files changed, 203 insertions, 123 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index bca099c0242..09350b30e00 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -294,7 +294,7 @@ ProcessKDP::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_threa
// locker will keep a mutex locked until it goes out of scope
LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_THREAD));
if (log && log->GetMask().Test(KDP_LOG_VERBOSE))
- log->Printf ("ProcessKDP::%s (pid = %i)", __FUNCTION__, GetID());
+ log->Printf ("ProcessKDP::%s (pid = %llu)", __FUNCTION__, GetID());
// We currently are making only one thread per core and we
// actually don't know about actual threads. Eventually we
@@ -698,7 +698,7 @@ ProcessKDP::AsyncThread (void *arg)
LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_PROCESS));
if (log)
- log->Printf ("ProcessKDP::%s (arg = %p, pid = %i) thread starting...", __FUNCTION__, arg, process->GetID());
+ log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) thread starting...", __FUNCTION__, arg, process->GetID());
Listener listener ("ProcessKDP::AsyncThread");
EventSP event_sp;
@@ -713,14 +713,14 @@ ProcessKDP::AsyncThread (void *arg)
while (!done)
{
if (log)
- log->Printf ("ProcessKDP::%s (arg = %p, pid = %i) listener.WaitForEvent (NULL, event_sp)...", __FUNCTION__, arg, process->GetID());
+ log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) listener.WaitForEvent (NULL, event_sp)...", __FUNCTION__, arg, process->GetID());
if (listener.WaitForEvent (NULL, event_sp))
{
const uint32_t event_type = event_sp->GetType();
if (event_sp->BroadcasterIs (&process->m_async_broadcaster))
{
if (log)
- log->Printf ("ProcessKDP::%s (arg = %p, pid = %i) Got an event of type: %d...", __FUNCTION__, arg, process->GetID(), event_type);
+ log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) Got an event of type: %d...", __FUNCTION__, arg, process->GetID(), event_type);
switch (event_type)
{
@@ -772,13 +772,13 @@ ProcessKDP::AsyncThread (void *arg)
case eBroadcastBitAsyncThreadShouldExit:
if (log)
- log->Printf ("ProcessKDP::%s (arg = %p, pid = %i) got eBroadcastBitAsyncThreadShouldExit...", __FUNCTION__, arg, process->GetID());
+ log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) got eBroadcastBitAsyncThreadShouldExit...", __FUNCTION__, arg, process->GetID());
done = true;
break;
default:
if (log)
- log->Printf ("ProcessKDP::%s (arg = %p, pid = %i) got unknown event 0x%8.8x", __FUNCTION__, arg, process->GetID(), event_type);
+ log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) got unknown event 0x%8.8x", __FUNCTION__, arg, process->GetID(), event_type);
done = true;
break;
}
@@ -795,14 +795,14 @@ ProcessKDP::AsyncThread (void *arg)
else
{
if (log)
- log->Printf ("ProcessKDP::%s (arg = %p, pid = %i) listener.WaitForEvent (NULL, event_sp) => false", __FUNCTION__, arg, process->GetID());
+ log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) listener.WaitForEvent (NULL, event_sp) => false", __FUNCTION__, arg, process->GetID());
done = true;
}
}
}
if (log)
- log->Printf ("ProcessKDP::%s (arg = %p, pid = %i) thread exiting...", __FUNCTION__, arg, process->GetID());
+ log->Printf ("ProcessKDP::%s (arg = %p, pid = %llu) thread exiting...", __FUNCTION__, arg, process->GetID());
process->m_async_thread = LLDB_INVALID_HOST_THREAD;
return NULL;
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
index 3b37d7866f3..6fb947087e5 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
@@ -76,7 +76,7 @@ ThreadKDP::WillResume (StateType resume_state)
lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
- log->Printf ("Resuming thread: %4.4x with state: %s.", GetID(), StateAsCString(resume_state));
+ log->Printf ("Resuming thread: %4.4llx with state: %s.", GetID(), StateAsCString(resume_state));
// ProcessKDP &process = GetKDPProcess();
// switch (resume_state)
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
index 7d9a146df70..18d42c83768 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -179,7 +179,7 @@ GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataE
{
// Get all registers in one packet
if (thread_suffix_supported)
- packet_len = ::snprintf (packet, sizeof(packet), "g;thread:%4.4x;", m_thread.GetID());
+ packet_len = ::snprintf (packet, sizeof(packet), "g;thread:%4.4llx;", m_thread.GetID());
else
packet_len = ::snprintf (packet, sizeof(packet), "g");
assert (packet_len < (sizeof(packet) - 1));
@@ -195,7 +195,7 @@ GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataE
// Get each register individually
if (thread_suffix_supported)
- packet_len = ::snprintf (packet, sizeof(packet), "p%x;thread:%4.4x;", reg, m_thread.GetID());
+ packet_len = ::snprintf (packet, sizeof(packet), "p%x;thread:%4.4llx;", reg, m_thread.GetID());
else
packet_len = ::snprintf (packet, sizeof(packet), "p%x", reg);
assert (packet_len < (sizeof(packet) - 1));
@@ -282,7 +282,7 @@ GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo *
lldb::endian::InlHostByteOrder());
if (thread_suffix_supported)
- packet.Printf (";thread:%4.4x;", m_thread.GetID());
+ packet.Printf (";thread:%4.4llx;", m_thread.GetID());
// Invalidate all register values
InvalidateIfNeeded (true);
@@ -309,7 +309,7 @@ GDBRemoteRegisterContext::WriteRegisterBytes (const lldb_private::RegisterInfo *
lldb::endian::InlHostByteOrder());
if (thread_suffix_supported)
- packet.Printf (";thread:%4.4x;", m_thread.GetID());
+ packet.Printf (";thread:%4.4llx;", m_thread.GetID());
// Invalidate just this register
m_reg_valid[reg] = false;
@@ -346,7 +346,7 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp)
{
int packet_len = 0;
if (thread_suffix_supported)
- packet_len = ::snprintf (packet, sizeof(packet), "g;thread:%4.4x", m_thread.GetID());
+ packet_len = ::snprintf (packet, sizeof(packet), "g;thread:%4.4llx", m_thread.GetID());
else
packet_len = ::snprintf (packet, sizeof(packet), "g");
assert (packet_len < (sizeof(packet) - 1));
@@ -363,7 +363,7 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp)
if (thread_suffix_supported)
{
char thread_id_cstr[64];
- ::snprintf (thread_id_cstr, sizeof(thread_id_cstr), ";thread:%4.4x;", m_thread.GetID());
+ ::snprintf (thread_id_cstr, sizeof(thread_id_cstr), ";thread:%4.4llx;", m_thread.GetID());
response_str.append (thread_id_cstr);
}
data_sp.reset (new DataBufferHeap (response_str.c_str(), response_str.size()));
@@ -457,7 +457,7 @@ GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data
lldb::endian::InlHostByteOrder());
if (thread_suffix_supported)
- packet.Printf (";thread:%4.4x;", m_thread.GetID());
+ packet.Printf (";thread:%4.4llx;", m_thread.GetID());
m_reg_valid[reg] = false;
if (gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(),
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 7e2ad1c3b22..70147d4dce5 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1082,7 +1082,7 @@ ProcessGDBRemote::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new
// locker will keep a mutex locked until it goes out of scope
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD));
if (log && log->GetMask().Test(GDBR_LOG_VERBOSE))
- log->Printf ("ProcessGDBRemote::%s (pid = %i)", __FUNCTION__, GetID());
+ log->Printf ("ProcessGDBRemote::%s (pid = %llu)", __FUNCTION__, GetID());
// Update the thread list's stop id immediately so we don't recurse into this function.
std::vector<lldb::tid_t> thread_ids;
@@ -1798,12 +1798,12 @@ ProcessGDBRemote::EnableBreakpoint (BreakpointSite *bp_site)
user_id_t site_id = bp_site->GetID();
const addr_t addr = bp_site->GetLoadAddress();
if (log)
- log->Printf ("ProcessGDBRemote::EnableBreakpoint (size_id = %d) address = 0x%llx", site_id, (uint64_t)addr);
+ log->Printf ("ProcessGDBRemote::EnableBreakpoint (size_id = %llu) address = 0x%llx", site_id, (uint64_t)addr);
if (bp_site->IsEnabled())
{
if (log)
- log->Printf ("ProcessGDBRemote::EnableBreakpoint (size_id = %d) address = 0x%llx -- SUCCESS (already enabled)", site_id, (uint64_t)addr);
+ log->Printf ("ProcessGDBRemote::EnableBreakpoint (size_id = %llu) address = 0x%llx -- SUCCESS (already enabled)", site_id, (uint64_t)addr);
return error;
}
else
@@ -1860,7 +1860,7 @@ ProcessGDBRemote::DisableBreakpoint (BreakpointSite *bp_site)
user_id_t site_id = bp_site->GetID();
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS));
if (log)
- log->Printf ("ProcessGDBRemote::DisableBreakpoint (site_id = %d) addr = 0x%8.8llx", site_id, (uint64_t)addr);
+ log->Printf ("ProcessGDBRemote::DisableBreakpoint (site_id = %llu) addr = 0x%8.8llx", site_id, (uint64_t)addr);
if (bp_site->IsEnabled())
{
@@ -1889,7 +1889,7 @@ ProcessGDBRemote::DisableBreakpoint (BreakpointSite *bp_site)
else
{
if (log)
- log->Printf ("ProcessGDBRemote::DisableBreakpoint (site_id = %d) addr = 0x%8.8llx -- SUCCESS (already disabled)", site_id, (uint64_t)addr);
+ log->Printf ("ProcessGDBRemote::DisableBreakpoint (site_id = %llu) addr = 0x%8.8llx -- SUCCESS (already disabled)", site_id, (uint64_t)addr);
return error;
}
@@ -1926,11 +1926,11 @@ ProcessGDBRemote::EnableWatchpoint (Watchpoint *wp)
addr_t addr = wp->GetLoadAddress();
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS));
if (log)
- log->Printf ("ProcessGDBRemote::EnableWatchpoint(watchID = %d)", watchID);
+ log->Printf ("ProcessGDBRemote::EnableWatchpoint(watchID = %llu)", watchID);
if (wp->IsEnabled())
{
if (log)
- log->Printf("ProcessGDBRemote::EnableWatchpoint(watchID = %d) addr = 0x%8.8llx: watchpoint already enabled.", watchID, (uint64_t)addr);
+ log->Printf("ProcessGDBRemote::EnableWatchpoint(watchID = %llu) addr = 0x%8.8llx: watchpoint already enabled.", watchID, (uint64_t)addr);
return error;
}
@@ -1970,12 +1970,12 @@ ProcessGDBRemote::DisableWatchpoint (Watchpoint *wp)
addr_t addr = wp->GetLoadAddress();
if (log)
- log->Printf ("ProcessGDBRemote::DisableWatchpoint (watchID = %d) addr = 0x%8.8llx", watchID, (uint64_t)addr);
+ log->Printf ("ProcessGDBRemote::DisableWatchpoint (watchID = %llu) addr = 0x%8.8llx", watchID, (uint64_t)addr);
if (!wp->IsEnabled())
{
if (log)
- log->Printf ("ProcessGDBRemote::DisableWatchpoint (watchID = %d) addr = 0x%8.8llx -- SUCCESS (already disabled)", watchID, (uint64_t)addr);
+ log->Printf ("ProcessGDBRemote::DisableWatchpoint (watchID = %llu) addr = 0x%8.8llx -- SUCCESS (already disabled)", watchID, (uint64_t)addr);
return error;
}
@@ -2307,7 +2307,7 @@ ProcessGDBRemote::AsyncThread (void *arg)
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
if (log)
- log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) thread starting...", __FUNCTION__, arg, process->GetID());
+ log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %llu) thread starting...", __FUNCTION__, arg, process->GetID());
Listener listener ("ProcessGDBRemote::AsyncThread");
EventSP event_sp;
@@ -2322,14 +2322,14 @@ ProcessGDBRemote::AsyncThread (void *arg)
while (!done)
{
if (log)
- log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) listener.WaitForEvent (NULL, event_sp)...", __FUNCTION__, arg, process->GetID());
+ log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %llu) listener.WaitForEvent (NULL, event_sp)...", __FUNCTION__, arg, process->GetID());
if (listener.WaitForEvent (NULL, event_sp))
{
const uint32_t event_type = event_sp->GetType();
if (event_sp->BroadcasterIs (&process->m_async_broadcaster))
{
if (log)
- log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) Got an event of type: %d...", __FUNCTION__, arg, process->GetID(), event_type);
+ log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %llu) Got an event of type: %d...", __FUNCTION__, arg, process->GetID(), event_type);
switch (event_type)
{
@@ -2342,7 +2342,7 @@ ProcessGDBRemote::AsyncThread (void *arg)
const char *continue_cstr = (const char *)continue_packet->GetBytes ();
const size_t continue_cstr_len = continue_packet->GetByteSize ();
if (log)
- log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got eBroadcastBitAsyncContinue: %s", __FUNCTION__, arg, process->GetID(), continue_cstr);
+ log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %llu) got eBroadcastBitAsyncContinue: %s", __FUNCTION__, arg, process->GetID(), continue_cstr);
if (::strstr (continue_cstr, "vAttach") == NULL)
process->SetPrivateState(eStateRunning);
@@ -2379,13 +2379,13 @@ ProcessGDBRemote::AsyncThread (void *arg)
case eBroadcastBitAsyncThreadShouldExit:
if (log)
- log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got eBroadcastBitAsyncThreadShouldExit...", __FUNCTION__, arg, process->GetID());
+ log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %llu) got eBroadcastBitAsyncThreadShouldExit...", __FUNCTION__, arg, process->GetID());
done = true;
break;
default:
if (log)
- log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) got unknown event 0x%8.8x", __FUNCTION__, arg, process->GetID(), event_type);
+ log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %llu) got unknown event 0x%8.8x", __FUNCTION__, arg, process->GetID(), event_type);
done = true;
break;
}
@@ -2402,14 +2402,14 @@ ProcessGDBRemote::AsyncThread (void *arg)
else
{
if (log)
- log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) listener.WaitForEvent (NULL, event_sp) => false", __FUNCTION__, arg, process->GetID());
+ log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %llu) listener.WaitForEvent (NULL, event_sp) => false", __FUNCTION__, arg, process->GetID());
done = true;
}
}
}
if (log)
- log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) thread exiting...", __FUNCTION__, arg, process->GetID());
+ log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %llu) thread exiting...", __FUNCTION__, arg, process->GetID());
process->m_async_thread = LLDB_INVALID_HOST_THREAD;
return NULL;
diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
index 7fe8cdeed3e..49385916ad6 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -77,7 +77,7 @@ ThreadGDBRemote::WillResume (StateType resume_state)
int signo = GetResumeSignal();
lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (GDBR_LOG_THREAD));
if (log)
- log->Printf ("Resuming thread: %4.4x with state: %s.", GetID(), StateAsCString(resume_state));
+ log->Printf ("Resuming thread: %4.4llx with state: %s.", GetID(), StateAsCString(resume_state));
ProcessGDBRemote &process = GetGDBProcess();
switch (resume_state)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index bd68518933f..0bbb27fa0b8 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -163,6 +163,7 @@ GetParentSymbolContextDIE(const DWARFDebugInfoEntry *child_die)
SymbolFileDWARF::SymbolFileDWARF(ObjectFile* objfile) :
SymbolFile (objfile),
+ UserID (0), // Used by SymbolFileDWARFDebugMap to when this class parses .o files to contain the .o file index/ID
m_debug_map_symfile (NULL),
m_clang_tu_decl (NULL),
m_flags(),
@@ -551,8 +552,8 @@ DWARFCompileUnit*
SymbolFileDWARF::GetDWARFCompileUnitForUID(lldb::user_id_t cu_uid)
{
DWARFDebugInfo* info = DebugInfo();
- if (info)
- return info->GetCompileUnit(cu_uid).get();
+ if (info && UserIDMatches(cu_uid))
+ return info->GetCompileUnit((dw_offset_t)cu_uid).get();
return NULL;
}
@@ -609,7 +610,11 @@ SymbolFileDWARF::ParseCompileUnit (DWARFCompileUnit* curr_cu, CompUnitSP& compil
cu_file_spec.SetFile (fullpath.c_str(), false);
}
- compile_unit_sp.reset(new CompileUnit(m_obj_file->GetModule(), curr_cu, cu_file_spec, curr_cu->GetOffset(), cu_language));
+ compile_unit_sp.reset(new CompileUnit (m_obj_file->GetModule(),
+ curr_cu,
+ cu_file_spec,
+ MakeUserID(curr_cu->GetOffset()),
+ cu_language));
if (compile_unit_sp.get())
{
curr_cu->SetUserData(compile_unit_sp.get());
@@ -722,9 +727,10 @@ SymbolFileDWARF::ParseCompileUnitFunction (const SymbolContext& sc, DWARFCompile
func_range.GetBaseAddress().ResolveLinkedAddress();
+ const user_id_t func_user_id = MakeUserID(die->GetOffset());
func_sp.reset(new Function (sc.comp_unit,
- die->GetOffset(), // UserID is the DIE offset
- die->GetOffset(),
+ func_user_id, // UserID is the DIE offset
+ func_user_id,
func_name,
func_type,
func_range)); // first address range
@@ -755,7 +761,7 @@ SymbolFileDWARF::ParseCompileUnitFunctions(const SymbolContext &sc)
for (func_idx = 0; func_idx < num_funtions; ++func_idx)
{
const DWARFDebugInfoEntry *die = function_dies.GetDIEPtrAtIndex(func_idx);
- if (sc.comp_unit->FindFunctionByUID (die->GetOffset()).get() == NULL)
+ if (sc.comp_unit->FindFunctionByUID (MakeUserID(die->GetOffset())).get() == NULL)
{
if (ParseCompileUnitFunction(sc, dwarf_cu, die))
++functions_added;
@@ -1030,7 +1036,7 @@ SymbolFileDWARF::ParseFunctionBlocks
}
else
{
- BlockSP block_sp(new Block (die->GetOffset()));
+ BlockSP block_sp(new Block (MakeUserID(die->GetOffset())));
parent_block->AddChild(block_sp);
block = block_sp.get();
}
@@ -1248,13 +1254,13 @@ SymbolFileDWARF::ParseChildMembers
else
{
if (name)
- ReportError ("0x%8.8x: DW_TAG_member '%s' refers to type 0x%8.8x which was unable to be parsed",
- die->GetOffset(),
+ ReportError ("0x%8.8llx: DW_TAG_member '%s' refers to type 0x%8.8llx which was unable to be parsed",
+ MakeUserID(die->GetOffset()),
name,
encoding_uid);
else
- ReportError ("0x%8.8x: DW_TAG_member refers to type 0x%8.8x which was unable to be parsed",
- die->GetOffset(),
+ ReportError ("0x%8.8llx: DW_TAG_member refers to type 0x%8.8llx which was unable to be parsed",
+ MakeUserID(die->GetOffset()),
encoding_uid);
}
}
@@ -1371,7 +1377,7 @@ clang::DeclContext*
SymbolFileDWARF::GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid)
{
DWARFDebugInfo* debug_info = DebugInfo();
- if (debug_info)
+ if (debug_info && UserIDMatches(type_uid))
{
DWARFCompileUnitSP cu_sp;
const DWARFDebugInfoEntry* die = debug_info->GetDIEPtr(type_uid, &cu_sp);
@@ -1384,32 +1390,37 @@ SymbolFileDWARF::GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid)
clang::DeclContext*
SymbolFileDWARF::GetClangDeclContextForTypeUID (const lldb_private::SymbolContext &sc, lldb::user_id_t type_uid)
{
- return GetClangDeclContextForDIEOffset (sc, type_uid);
+ if (UserIDMatches(type_uid))
+ return GetClangDeclContextForDIEOffset (sc, type_uid);
+ return NULL;
}
Type*
SymbolFileDWARF::ResolveTypeUID (lldb::user_id_t type_uid)
{
- DWARFDebugInfo* debug_info = DebugInfo();
- if (debug_info)
+ if (UserIDMatches(type_uid))
{
- DWARFCompileUnitSP cu_sp;
- const DWARFDebugInfoEntry* type_die = debug_info->GetDIEPtr(type_uid, &cu_sp);
- if (type_die != NULL)
+ DWARFDebugInfo* debug_info = DebugInfo();
+ if (debug_info)
{
- // We might be coming in in the middle of a type tree (a class
- // withing a class, an enum within a class), so parse any needed
- // parent DIEs before we get to this one...
- const DWARFDebugInfoEntry *decl_ctx_die = GetDeclContextDIEContainingDIE (cu_sp.get(), type_die);
- switch (decl_ctx_die->Tag())
+ DWARFCompileUnitSP cu_sp;
+ const DWARFDebugInfoEntry* type_die = debug_info->GetDIEPtr(type_uid, &cu_sp);
+ if (type_die != NULL)
{
- case DW_TAG_structure_type:
- case DW_TAG_union_type:
- case DW_TAG_class_type:
- ResolveType(cu_sp.get(), decl_ctx_die);
- break;
+ // We might be coming in in the middle of a type tree (a class
+ // withing a class, an enum within a class), so parse any needed
+ // parent DIEs before we get to this one...
+ const DWARFDebugInfoEntry *decl_ctx_die = GetDeclContextDIEContainingDIE (cu_sp.get(), type_die);
+ switch (decl_ctx_die->Tag())
+ {
+ case DW_TAG_structure_type:
+ case DW_TAG_union_type:
+ case DW_TAG_class_type:
+ ResolveType(cu_sp.get(), decl_ctx_die);
+ break;
+ }
+ return ResolveType (cu_sp.get(), type_die);
}
- return ResolveType (cu_sp.get(), type_die);
}
}
return NULL;
@@ -1456,8 +1467,8 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_type
const dw_tag_t tag = die->Tag();
- DEBUG_PRINTF ("0x%8.8x: %s (\"%s\") - resolve forward declaration...\n",
- die->GetOffset(),
+ DEBUG_PRINTF ("0x%8.8llx: %s (\"%s\") - resolve forward declaration...\n",
+ MakeUserID(die->GetOffset()),
DW_TAG_value_to_name(tag),
type->GetName().AsCString());
assert (clang_type);
@@ -1657,7 +1668,7 @@ SymbolFileDWARF::GetFunction (DWARFCompileUnit* curr_cu, const DWARFDebugInfoEnt
// Check if the symbol vendor already knows about this compile unit?
sc.comp_unit = GetCompUnitForDWARFCompUnit(curr_cu, UINT32_MAX);
- sc.function = sc.comp_unit->FindFunctionByUID (func_die->GetOffset()).get();
+ sc.function = sc.comp_unit->FindFunctionByUID (MakeUserID(func_die->GetOffset())).get();
if (sc.function == NULL)
sc.function = ParseCompileUnitFunction(sc, curr_cu, func_die);
@@ -1741,7 +1752,7 @@ SymbolFileDWARF::ResolveSymbolContext (const Address& so_addr, uint32_t resolve_
if (function_die != NULL)
{
- sc.function = sc.comp_unit->FindFunctionByUID (function_die->GetOffset()).get();
+ sc.function = sc.comp_unit->FindFunctionByUID (MakeUserID(function_die->GetOffset())).get();
if (sc.function == NULL)
sc.function = ParseCompileUnitFunction(sc, curr_cu, function_die);
}
@@ -1755,9 +1766,9 @@ SymbolFileDWARF::ResolveSymbolContext (const Address& so_addr, uint32_t resolve_
Block& block = sc.function->GetBlock (true);
if (block_die != NULL)
- sc.block = block.FindBlockByID (block_die->GetOffset());
+ sc.block = block.FindBlockByID (MakeUserID(block_die->GetOffset()));
else
- sc.block = block.FindBlockByID (function_die->GetOffset());
+ sc.block = block.FindBlockByID (MakeUserID(function_die->GetOffset()));
if (sc.block)
resolved |= eSymbolContextBlock;
}
@@ -1837,7 +1848,7 @@ SymbolFileDWARF::ResolveSymbolContext(const FileSpec& file_spec, uint32_t line,
if (function_die != NULL)
{
- sc.function = sc.comp_unit->FindFunctionByUID (function_die->GetOffset()).get();
+ sc.function = sc.comp_unit->FindFunctionByUID (MakeUserID(function_die->GetOffset())).get();
if (sc.function == NULL)
sc.function = ParseCompileUnitFunction(sc, curr_cu, function_die);
}
@@ -1847,9 +1858,9 @@ SymbolFileDWARF::ResolveSymbolContext(const FileSpec& file_spec, uint32_t line,
Block& block = sc.function->GetBlock (true);
if (block_die != NULL)
- sc.block = block.FindBlockByID (block_die->GetOffset());
+ sc.block = block.FindBlockByID (MakeUserID(block_die->GetOffset()));
else
- sc.block = block.FindBlockByID (function_die->GetOffset());
+ sc.block = block.FindBlockByID (MakeUserID(function_die->GetOffset()));
}
}
}
@@ -2219,7 +2230,7 @@ SymbolFileDWARF::ResolveFunction (DWARFCompileUnit *cu,
// Parse all blocks if needed
if (inlined_die)
{
- sc.block = sc.function->GetBlock (true).FindBlockByID (inlined_die->GetOffset());
+ sc.block = sc.function->GetBlock (true).FindBlockByID (MakeUserID(inlined_die->GetOffset()));
assert (sc.block != NULL);
if (sc.block->GetStartAddress (addr) == false)
addr.Clear();
@@ -3319,9 +3330,9 @@ SymbolFileDWARF::ResolveNamespaceDIE (DWARFCompileUnit *curr_cu, const DWARFDebu
if (log)
{
const char *object_name = m_obj_file->GetModule()->GetObjectName().GetCString();
- log->Printf ("ASTContext => %p: 0x%8.8x: DW_TAG_namespace with DW_AT_name(\"%s\") => clang::NamespaceDecl * %p in %s/%s%s%s%s (original = %p)",
+ log->Printf ("ASTContext => %p: 0x%8.8llx: DW_TAG_namespace with DW_AT_name(\"%s\") => clang::NamespaceDecl * %p in %s/%s%s%s%s (original = %p)",
GetClangASTContext().getASTContext(),
- die->GetOffset(),
+ MakeUserID(die->GetOffset()),
namespace_name,
namespace_decl,
m_obj_file->GetFileSpec().GetDirectory().GetCString(),
@@ -3529,12 +3540,12 @@ SymbolFileDWARF::FindDefinitionTypeForDIE (DWARFCompileUnit* cu,
Type *resolved_type = ResolveType (type_cu, type_die, false);
if (resolved_type && resolved_type != DIE_IS_BEING_PARSED)
{
- DEBUG_PRINTF ("resolved 0x%8.8x (cu 0x%8.8x) from %s to 0x%8.8x (cu 0x%8.8x)\n",
- die->GetOffset(),
- curr_cu->GetOffset(),
+ DEBUG_PRINTF ("resolved 0x%8.8llx (cu 0x%8.8llx) from %s to 0x%8.8llx (cu 0x%8.8llx)\n",
+ MakeUserID(die->GetOffset()),
+ MakeUserID(curr_cu->GetOffset()),
m_obj_file->GetFileSpec().GetFilename().AsCString(),
- type_die->GetOffset(),
- type_cu->GetOffset());
+ MakeUserID(type_die->GetOffset()),
+ MakeUserID(type_cu->GetOffset()));
m_die_to_type[die] = resolved_type;
type_sp = resolved_type;
@@ -3646,7 +3657,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
}
}
- DEBUG_PRINTF ("0x%8.8x: %s (\"%s\") type => 0x%8.8x\n", die->GetOffset(), DW_TAG_value_to_name(tag), type_name_cstr, encoding_uid);
+ DEBUG_PRINTF ("0x%8.8llx: %s (\"%s\") type => 0x%8.8x\n", MakeUserID(die->GetOffset()), DW_TAG_value_to_name(tag), type_name_cstr, encoding_uid);
switch (tag)
{
@@ -3693,7 +3704,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
}
}
- type_sp.reset( new Type (die->GetOffset(),
+ type_sp.reset( new Type (MakeUserID(die->GetOffset()),
this,
type_name_const_str,
byte_size,
@@ -3811,7 +3822,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
}
}
- DEBUG_PRINTF ("0x%8.8x: %s (\"%s\")\n", die->GetOffset(), DW_TAG_value_to_name(tag), type_name_cstr);
+ DEBUG_PRINTF ("0x%8.8llx: %s (\"%s\")\n", MakeUserID(die->GetOffset()), DW_TAG_value_to_name(tag), type_name_cstr);
int tag_decl_kind = -1;
AccessType default_accessibility = eAccessNone;
@@ -3875,7 +3886,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
// parameters in any class methods need it for the clang
// types for function prototypes.
LinkDeclContextToDIE(ClangASTContext::GetDeclContextForType(clang_type), die);
- type_sp.reset (new Type (die->GetOffset(),
+ type_sp.reset (new Type (MakeUserID(die->GetOffset()),
this,
type_name_const_str,
byte_size,
@@ -3965,7 +3976,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
}
}
- DEBUG_PRINTF ("0x%8.8x: %s (\"%s\")\n", die->GetOffset(), DW_TAG_value_to_name(tag), type_name_cstr);
+ DEBUG_PRINTF ("0x%8.8llx: %s (\"%s\")\n", MakeUserID(die->GetOffset()), DW_TAG_value_to_name(tag), type_name_cstr);
clang_type_t enumerator_clang_type = NULL;
clang_type = m_forward_decl_die_to_clang_type.lookup (die);
@@ -3987,7 +3998,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
LinkDeclContextToDIE(ClangASTContext::GetDeclContextForType(clang_type), die);
- type_sp.reset( new Type (die->GetOffset(),
+ type_sp.reset( new Type (MakeUserID(die->GetOffset()),
this,
type_name_const_str,
byte_size,
@@ -4108,7 +4119,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
}
}
- DEBUG_PRINTF ("0x%8.8x: %s (\"%s\")\n", die->GetOffset(), DW_TAG_value_to_name(tag), type_name_cstr);
+ DEBUG_PRINTF ("0x%8.8llx: %s (\"%s\")\n", MakeUserID(die->GetOffset()), DW_TAG_value_to_name(tag), type_name_cstr);
clang_type_t return_clang_type = NULL;
Type *func_type = NULL;
@@ -4236,8 +4247,8 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
}
else
{
- ReportWarning ("0x%8.8x: DW_AT_specification(0x%8.8x) has no decl\n",
- die->GetOffset(),
+ ReportWarning ("0x%8.8llx: DW_AT_specification(0x%8.8x) has no decl\n",
+ MakeUserID(die->GetOffset()),
specification_die_offset);
}
type_handled = true;
@@ -4259,8 +4270,8 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
}
else
{
- ReportWarning ("0x%8.8x: DW_AT_abstract_origin(0x%8.8x) has no decl\n",
- die->GetOffset(),
+ ReportWarning ("0x%8.8llx: DW_AT_abstract_origin(0x%8.8x) has no decl\n",
+ MakeUserID(die->GetOffset()),
abstract_origin_die_offset);
}
type_handled = true;
@@ -4288,10 +4299,10 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
{
clang::CXXMethodDecl *cxx_method_decl;
// REMOVE THE CRASH DESCRIPTION BELOW
- Host::SetCrashDescriptionWithFormat ("SymbolFileDWARF::ParseType() is adding a method %s to class %s in DIE 0x%8.8x from %s/%s",
+ Host::SetCrashDescriptionWithFormat ("SymbolFileDWARF::ParseType() is adding a method %s to class %s in DIE 0x%8.8llx from %s/%s",
type_name_cstr,
class_type->GetName().GetCString(),
- die->GetOffset(),
+ MakeUserID(die->GetOffset()),
m_obj_file->GetFileSpec().GetDirectory().GetCString(),
m_obj_file->GetFileSpec().GetFilename().GetCString());
@@ -4356,7 +4367,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
function_param_decls.size());
}
}
- type_sp.reset( new Type (die->GetOffset(),
+ type_sp.reset( new Type (MakeUserID(die->GetOffset()),
this,
type_name_const_str,
0,
@@ -4421,7 +4432,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
}
}
- DEBUG_PRINTF ("0x%8.8x: %s (\"%s\")\n", die->GetOffset(), DW_TAG_value_to_name(tag), type_name_cstr);
+ DEBUG_PRINTF ("0x%8.8llx: %s (\"%s\")\n", MakeUserID(die->GetOffset()), DW_TAG_value_to_name(tag), type_name_cstr);
Type *element_type = ResolveTypeUID(type_die_offset);
@@ -4449,7 +4460,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
array_element_bit_stride = array_element_bit_stride * num_elements;
}
ConstString empty_name;
- type_sp.reset( new Type (die->GetOffset(),
+ type_sp.reset( new Type (MakeUserID(die->GetOffset()),
this,
empty_name,
array_element_bit_stride / 8,
@@ -4502,7 +4513,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
byte_size = ClangASTType::GetClangTypeBitWidth (ast.getASTContext(),
clang_type) / 8;
- type_sp.reset( new Type (die->GetOffset(),
+ type_sp.reset( new Type (MakeUserID(die->GetOffset()),
this,
type_name_const_str,
byte_size,
@@ -4533,7 +4544,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
}
else if (sc.function != NULL)
{
- symbol_context_scope = sc.function->GetBlock(true).FindBlockByID(sc_parent_die->GetOffset());
+ symbol_context_scope = sc.function->GetBlock(true).FindBlockByID(MakeUserID(sc_parent_die->GetOffset()));
if (symbol_context_scope == NULL)
symbol_context_scope = sc.function;
}
@@ -4582,7 +4593,7 @@ SymbolFileDWARF::ParseTypes
if (die->Tag() == DW_TAG_subprogram)
{
SymbolContext child_sc(sc);
- child_sc.function = sc.comp_unit->FindFunctionByUID(die->GetOffset()).get();
+ child_sc.function = sc.comp_unit->FindFunctionByUID(MakeUserID(die->GetOffset())).get();
types_added += ParseTypes(child_sc, dwarf_cu, die->GetFirstChild(), true, true);
}
else
@@ -4854,7 +4865,7 @@ SymbolFileDWARF::ParseVariableDIE
case DW_TAG_lexical_block:
if (sc.function)
{
- symbol_context_scope = sc.function->GetBlock(true).FindBlockByID(sc_parent_die->GetOffset());
+ symbol_context_scope = sc.function->GetBlock(true).FindBlockByID(MakeUserID(sc_parent_die->GetOffset()));
if (symbol_context_scope == NULL)
symbol_context_scope = sc.function;
}
@@ -4867,16 +4878,16 @@ SymbolFileDWARF::ParseVariableDIE
if (symbol_context_scope)
{
- var_sp.reset (new Variable(die->GetOffset(),
- name,
- mangled,
- var_type,
- scope,
- symbol_context_scope,
- &decl,
- location,
- is_external,
- is_artificial));
+ var_sp.reset (new Variable (MakeUserID(die->GetOffset()),
+ name,
+ mangled,
+ var_type,
+ scope,
+ symbol_context_scope,
+ &decl,
+ location,
+ is_external,
+ is_artificial));
var_sp->SetLocationIsConstantValueData (location_is_const_value_data);
}
@@ -5020,11 +5031,11 @@ SymbolFileDWARF::ParseVariables
}
else
{
- ReportError ("parent 0x%8.8x %s with no valid compile unit in symbol context for 0x%8.8x %s.\n",
- sc_parent_die->GetOffset(),
- DW_TAG_value_to_name (parent_tag),
- orig_die->GetOffset(),
- DW_TAG_value_to_name (orig_die->Tag()));
+ ReportError ("parent 0x%8.8llx %s with no valid compile unit in symbol context for 0x%8.8llx %s.\n",
+ MakeUserID(sc_parent_die->GetOffset()),
+ DW_TAG_value_to_name (parent_tag),
+ MakeUserID(orig_die->GetOffset()),
+ DW_TAG_value_to_name (orig_die->Tag()));
}
break;
@@ -5035,7 +5046,7 @@ SymbolFileDWARF::ParseVariables
{
// Check to see if we already have parsed the variables for the given scope
- Block *block = sc.function->GetBlock(true).FindBlockByID(sc_parent_die->GetOffset());
+ Block *block = sc.function->GetBlock(true).FindBlockByID(MakeUserID(sc_parent_die->GetOffset()));
if (block == NULL)
{
// This must be a specification or abstract origin with
@@ -5047,7 +5058,7 @@ SymbolFileDWARF::ParseVariables
sc_parent_die->GetOffset(),
&concrete_block_die_cu);
if (concrete_block_die)
- block = sc.function->GetBlock(true).FindBlockByID(concrete_block_die->GetOffset());
+ block = sc.function->GetBlock(true).FindBlockByID(MakeUserID(concrete_block_die->GetOffset()));
}
if (block != NULL)
@@ -5064,9 +5075,9 @@ SymbolFileDWARF::ParseVariables
break;
default:
- ReportError ("didn't find appropriate parent DIE for variable list for 0x%8.8x %s.\n",
- orig_die->GetOffset(),
- DW_TAG_value_to_name (orig_die->Tag()));
+ ReportError ("didn't find appropriate parent DIE for variable list for 0x%8.8llx %s.\n",
+ MakeUserID(orig_die->GetOffset()),
+ DW_TAG_value_to_name (orig_die->Tag()));
break;
}
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 15f3147f1b0..89db5f5700a 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -55,7 +55,7 @@ class DWARFDIECollection;
class DWARFFormValue;
class SymbolFileDWARFDebugMap;
-class SymbolFileDWARF : public lldb_private::SymbolFile
+class SymbolFileDWARF : public lldb_private::SymbolFile, public lldb_private::UserID
{
public:
friend class SymbolFileDWARFDebugMap;
@@ -411,6 +411,21 @@ protected:
m_decl_ctx_to_die[decl_ctx].insert(die);
}
+ bool
+ UserIDMatches (lldb::user_id_t uid) const
+ {
+ const lldb::user_id_t high_uid = uid & 0xffffffff00000000ull;
+ if (high_uid)
+ return high_uid == GetID();
+ return true;
+ }
+
+ lldb::user_id_t
+ MakeUserID (dw_offset_t die_offset) const
+ {
+ return GetID() | die_offset;
+ }
+
void
ReportError (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
void
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 2d702bc57f1..123e06a98d3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -231,6 +231,20 @@ SymbolFileDWARFDebugMap::GetObjectFileByCompUnitInfo (CompileUnitInfo *comp_unit
return NULL;
}
+
+uint32_t
+SymbolFileDWARFDebugMap::GetCompUnitInfoIndex (const CompileUnitInfo *comp_unit_info)
+{
+ if (!m_compile_unit_infos.empty())
+ {
+ const CompileUnitInfo *first_comp_unit_info = &m_compile_unit_infos.front();
+ const CompileUnitInfo *last_comp_unit_info = &m_compile_unit_infos.back();
+ if (first_comp_unit_info <= comp_unit_info && comp_unit_info <= last_comp_unit_info)
+ return comp_unit_info - first_comp_unit_info;
+ }
+ return UINT32_MAX;
+}
+
SymbolFileDWARF *
SymbolFileDWARFDebugMap::GetSymbolFileByOSOIndex (uint32_t oso_idx)
{
@@ -256,7 +270,12 @@ SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit
// Set a a pointer to this class to set our OSO DWARF file know
// that the DWARF is being used along with a debug map and that
// it will have the remapped sections that we do below.
- ((SymbolFileDWARF *)comp_unit_info->oso_symbol_vendor->GetSymbolFile())->SetDebugMapSymfile(this);
+ SymbolFileDWARF *oso_symfile = (SymbolFileDWARF *)comp_unit_info->oso_symbol_vendor->GetSymbolFile();
+ oso_symfile->SetDebugMapSymfile(this);
+ // Set the ID of the symbol file DWARF to the index of the OSO
+ // shifted left by 32 bits to provide a unique prefix for any
+ // UserID's that get created in the symbol file.
+ oso_symfile->SetID (((uint64_t)GetCompUnitInfoIndex(comp_unit_info) + 1ull) << 32ull);
comp_unit_info->debug_map_sections_sp.reset(new SectionList);
Symtab *exe_symtab = m_obj_file->GetSymtab();
@@ -622,11 +641,15 @@ SymbolFileDWARFDebugMap::ParseVariablesForContext (const SymbolContext& sc)
Type*
SymbolFileDWARFDebugMap::ResolveTypeUID(lldb::user_id_t type_uid)
{
+ const uint64_t oso_idx = GetOSOIndexFromUserID (type_uid);
+ SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx);
+ if (oso_dwarf)
+ oso_dwarf->ResolveTypeUID (type_uid);
return NULL;
}
lldb::clang_type_t
-SymbolFileDWARFDebugMap::ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_Type)
+SymbolFileDWARFDebugMap::ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_type)
{
// We have a struct/union/class/enum that needs to be fully resolved.
return NULL;
@@ -1149,3 +1172,24 @@ SymbolFileDWARFDebugMap::CompleteObjCInterfaceDecl (void *baton, clang::ObjCInte
}
}
+clang::DeclContext*
+SymbolFileDWARFDebugMap::GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid)
+{
+ const uint64_t oso_idx = GetOSOIndexFromUserID (type_uid);
+ SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx);
+ if (oso_dwarf)
+ return oso_dwarf->GetClangDeclContextContainingTypeUID (type_uid);
+ return NULL;
+}
+
+clang::DeclContext*
+SymbolFileDWARFDebugMap::GetClangDeclContextForTypeUID (const lldb_private::SymbolContext &sc, lldb::user_id_t type_uid)
+{
+ const uint64_t oso_idx = GetOSOIndexFromUserID (type_uid);
+ SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx);
+ if (oso_dwarf)
+ return oso_dwarf->GetClangDeclContextForTypeUID (sc, type_uid);
+ return NULL;
+}
+
+
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 8d722a1a4a8..ec7dae44794 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -66,6 +66,8 @@ public:
virtual size_t ParseVariablesForContext (const lldb_private::SymbolContext& sc);
virtual lldb_private::Type* ResolveTypeUID (lldb::user_id_t type_uid);
+ virtual clang::DeclContext* GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid);
+ virtual clang::DeclContext* GetClangDeclContextForTypeUID (const lldb_private::SymbolContext &sc, lldb::user_id_t type_uid);
virtual lldb::clang_type_t ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_Type);
virtual uint32_t ResolveSymbolContext (const lldb_private::Address& so_addr, uint32_t resolve_scope, lldb_private::SymbolContext& sc);
virtual uint32_t ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list);
@@ -151,6 +153,11 @@ protected:
void
InitOSO ();
+ static uint32_t
+ GetOSOIndexFromUserID (lldb::user_id_t uid)
+ {
+ return (uint32_t)((uid >> 32ull) - 1ull);
+ }
bool
GetFileSpecForSO (uint32_t oso_idx, lldb_private::FileSpec &file_spec);
@@ -169,6 +176,9 @@ protected:
lldb_private::ObjectFile *
GetObjectFileByOSOIndex (uint32_t oso_idx);
+ uint32_t
+ GetCompUnitInfoIndex (const CompileUnitInfo *comp_unit_info);
+
SymbolFileDWARF *
GetSymbolFile (const lldb_private::SymbolContext& sc);
OpenPOWER on IntegriCloud