<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi,<div><br></div><div>LLDB 3.8 has much better support for core load on Linux than 3.7 - thanks a lot! But there are still two problems.</div><div><br></div><div>1. The thread ID are lost and there is FIXME in the code</div><div>2. If core dump is obtained from live process (i.e. gdb attach, gcore, detach) then there is no thread that has any reason to stop. LLDB hangs forever on such a core.</div><div><br></div><div>Here is the fix that works for me for both problems.</div><div><br></div><div>Thanks,</div><div>Eugene</div><div><br></div><div><p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">diff --git a/include/lldb/Target/Process.h
b/include/lldb/Target/Process.h<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">index 6bb7a3d..915ca15 100644<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">--- a/include/lldb/Target/Process.h<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+++ b/include/lldb/Target/Process.h<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">@@ -3401,6 +3401,7 @@ protected:<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
std::map<lldb::addr_t,lldb::addr_t> m_resolved_indirect_addresses;<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> bool m_destroy_in_process;<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> bool m_can_interpret_function_calls; //
Some targets, e.g the OSX kernel, don't support the ability to modify the
stack.<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+ bool m_load_core; // True if we are looking at a core dump, not at a running program<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
WarningsCollection
m_warnings_issued; // A set of object pointers which have already had
warnings printed<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> </font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> enum {<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">diff --git a/source/Plugins/Process/elf-core/ProcessElfCore.cpp
b/source/Plugins/Process/elf-core/ProcessElfCore.cpp<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">index 5b5d98a..fa057f1 100644<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">--- a/source/Plugins/Process/elf-core/ProcessElfCore.cpp<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+++ b/source/Plugins/Process/elf-core/ProcessElfCore.cpp<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">@@ -559,11 +559,10 @@ ProcessElfCore::ParseThreadContextsFromNoteSegment(const
elf::ELFProgramHeader *<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
have_prstatus = true;<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
prstatus.Parse(note_data, arch);<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
thread_data->signo = prstatus.pr_cursig;<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+
thread_data->tid = prstatus.pr_pid;<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
header_size = ELFLinuxPrStatus::GetSize(arch);<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
len = note_data.GetByteSize() - header_size;<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
thread_data->gpregset = DataExtractor(note_data, header_size, len);<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">-
// FIXME: Obtain actual tid on Linux<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">-
thread_data->tid = m_thread_data.size();<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
break;<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
case NT_FPREGSET:<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
thread_data->fpregset = note_data;<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">diff --git a/source/Target/Process.cpp
b/source/Target/Process.cpp<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">index e4fe419..489b307 100644<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">--- a/source/Target/Process.cpp<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+++ b/source/Target/Process.cpp<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">@@ -767,6 +767,7 @@ Process::Process(lldb::TargetSP target_sp,
Listener &listener, const UnixSignals<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> m_last_broadcast_state (eStateInvalid),<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> m_destroy_in_process (false),<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> m_can_interpret_function_calls(false),<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+ m_load_core(false),<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> m_warnings_issued (),<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> m_can_jit(eCanJITDontKnow)<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">{<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">@@ -3088,6 +3089,7 @@ Process::LoadCore ()<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> // We
successfully loaded a core file, now pretend we stopped so we can<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> // show all of
the threads in the core file and explore the crashed<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> // state.<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+ m_load_core = true;<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> SetPrivateState
(eStateStopped);<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> </font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> // Wait indefinitely
for a stopped event since we just posted one above...<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">@@ -3975,6 +3977,11 @@ Process::ShouldBroadcastEvent (Event
*event_ptr)<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> </font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
if (!was_restarted)<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
should_resume = m_thread_list.ShouldStop (event_ptr) == false;<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+
// ShouldStop() above has some side effects besides calculating return value,<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+
// so we better not skip it. But if we are loading core we should not resume.<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+
if (m_load_core)<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">+
should_resume = false;<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2"> </font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
if (was_restarted || should_resume || m_resume_requested)<o:p></o:p></font></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><font face="Courier New, sans-serif" size="2">
{</font><span style="font-size: 11pt;"><o:p></o:p></span></span></p></div> </div></body>
</html>