<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'>No response. I filed a bug, hopefully somebody will pay attention.<div><br></div><div><a href="https://llvm.org/bugs/show_bug.cgi?id=26322" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=26322</a></div><div><br><br><div><hr id="stopSpelling">From: mikem@microsoft.com<br>To: eugenebi@hotmail.com; lldb-dev@lists.llvm.org<br>Subject: RE: Problems with core load on Linux and proposed solution<br>Date: Thu, 25 Feb 2016 22:37:45 +0000<br><br>



<style><!--
.ExternalClass p.ecxMsoNormal, .ExternalClass li.ecxMsoNormal, .ExternalClass div.ecxMsoNormal {
font-size:12.0pt;
font-family:"Times New Roman",serif;
}

.ExternalClass a:link, .ExternalClass span.ecxMsoHyperlink {
color:#0563C1;
text-decoration:underline;
}

.ExternalClass span.ecxMsoHyperlinkFollowed {
color:#954F72;
text-decoration:underline;
}

.ExternalClass p {
font-size:12.0pt;
font-family:"Times New Roman",serif;
}

.ExternalClass p.ecxmsonormal0, .ExternalClass li.ecxmsonormal0, .ExternalClass div.ecxmsonormal0 {
font-size:12.0pt;
font-family:"Times New Roman",serif;
}

.ExternalClass span.ecxEmailStyle19 {
font-family:"Calibri",sans-serif;
color:#1F497D;
}

.ExternalClass .ecxMsoChpDefault {
font-size:10.0pt;
}

.ExternalClass div.ecxWordSection1 {
}

--></style>


<div class="ecxWordSection1">
<p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">Eugene, do you know if they have taken these changes? Have you heard from anybody on lldb-dev?</span></p>
<p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;"> </span></p>
<p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">mikem</span></p>
<p class="ecxMsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;"> </span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in;">
<p class="ecxMsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;"> Eugene Birukov [mailto:eugenebi@hotmail.com]
<br>
<b>Sent:</b> Thursday, January 21, 2016 10:46 AM<br>
<b>To:</b> LLDB <lldb-dev@lists.llvm.org><br>
<b>Subject:</b> Problems with core load on Linux and proposed solution</span></p>
</div>
</div>
<p class="ecxMsoNormal"> </p>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;">Hi,</span></p>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;"> </span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;">LLDB 3.8 has much better support for core load on Linux than 3.7 - thanks a lot! But there are still two problems.</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;"> </span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;">1. The thread ID are lost and there is FIXME in the code</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;">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.</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;"> </span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;">Here is the fix that works for me for both problems.</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;"> </span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;">Thanks,</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;">Eugene</span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-family:"Calibri",sans-serif;"> </span></p>
</div>
<div>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">index 6bb7a3d..915ca15 100644</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">--- a/include/lldb/Target/Process.h</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+++ b/include/lldb/Target/Process.h</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">@@ -3401,6 +3401,7 @@ protected:</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">     std::map<lldb::addr_t,lldb::addr_t> m_resolved_indirect_addresses;</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">     bool m_destroy_in_process;</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">     bool m_can_interpret_function_calls; // Some targets, e.g the OSX kernel, don't support the ability to modify the stack.</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+    bool m_load_core; // True if we are looking at a core dump, not at a running program</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">     WarningsCollection          m_warnings_issued;  // A set of object pointers which have already had warnings printed</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;"> </span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">     enum {</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">diff --git a/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/source/Plugins/Process/elf-core/ProcessElfCore.cpp</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">index 5b5d98a..fa057f1 100644</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">--- a/source/Plugins/Process/elf-core/ProcessElfCore.cpp</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+++ b/source/Plugins/Process/elf-core/ProcessElfCore.cpp</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">@@ -559,11 +559,10 @@ ProcessElfCore::ParseThreadContextsFromNoteSegment(const elf::ELFProgramHeader *</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                     have_prstatus = true;</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                     prstatus.Parse(note_data, arch);</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                     thread_data->signo = prstatus.pr_cursig;</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+                    thread_data->tid = prstatus.pr_pid;</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                     header_size = ELFLinuxPrStatus::GetSize(arch);</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                     len = note_data.GetByteSize() - header_size;</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                     thread_data->gpregset = DataExtractor(note_data, header_size, len);</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">-                    // FIXME: Obtain actual tid on Linux</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">-                    thread_data->tid = m_thread_data.size();</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                     break;</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                 case NT_FPREGSET:</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                     thread_data->fpregset = note_data;</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">diff --git a/source/Target/Process.cpp b/source/Target/Process.cpp</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">index e4fe419..489b307 100644</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">--- a/source/Target/Process.cpp</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+++ b/source/Target/Process.cpp</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">@@ -767,6 +767,7 @@ Process::Process(lldb::TargetSP target_sp, Listener &listener, const UnixSignals</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">     m_last_broadcast_state (eStateInvalid),</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">     m_destroy_in_process (false),</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">     m_can_interpret_function_calls(false),</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+    m_load_core(false),</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">     m_warnings_issued (),</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">     m_can_jit(eCanJITDontKnow)</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">{</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">@@ -3088,6 +3089,7 @@ Process::LoadCore ()</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">         // We successfully loaded a core file, now pretend we stopped so we can</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">         // show all of the threads in the core file and explore the crashed</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">         // state.</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+        m_load_core = true;</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">         SetPrivateState (eStateStopped);</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;"> </span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">         // Wait indefinitely for a stopped event since we just posted one above...</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">@@ -3975,6 +3977,11 @@ Process::ShouldBroadcastEvent (Event *event_ptr)</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;"> </span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                 if (!was_restarted)</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                     should_resume = m_thread_list.ShouldStop (event_ptr) == false;</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+                 // ShouldStop() above has some side effects besides calculating return value,</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+                 // so we better not skip it. But if we are loading core we should not resume.</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+                 if (m_load_core)</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">+                     should_resume = false;</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;"> </span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                 if (was_restarted || should_resume || m_resume_requested)</span><span style="font-family:"Calibri",sans-serif;"></span></p>
<p class="ecxMsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F497D;">                 {</span><span style="font-family:"Calibri",sans-serif;"></span></p>
</div>
</div>
</div></div></div>                                      </div></body>
</html>