<div style="white-space:pre-wrap">Cced some people who work on Linux.<br><br>Not sure how this slipped through the cracks, but sometimes you can have better results by just posting a patch to lldb-commits and ccing the right person (check owners file to find out who the right person is)</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Feb 25, 2016 at 5:18 PM Eugene Birukov via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><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>From: <a href="mailto:mikem@microsoft.com" target="_blank">mikem@microsoft.com</a><br>To: <a href="mailto:eugenebi@hotmail.com" target="_blank">eugenebi@hotmail.com</a>; <a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br>Subject: RE: Problems with core load on Linux and proposed solution<br>Date: Thu, 25 Feb 2016 22:37:45 +0000</div></div></div></div><div><div dir="ltr"><div><div><br><br>
<div>
<p><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><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span></p>
<p><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">mikem</span></p>
<p><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><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:<a href="mailto:eugenebi@hotmail.com" target="_blank">eugenebi@hotmail.com</a>]
<br>
<b>Sent:</b> Thursday, January 21, 2016 10:46 AM<br>
<b>To:</b> LLDB <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>><br>
<b>Subject:</b> Problems with core load on Linux and proposed solution</span></p>
</div>
</div>
<p> </p>
<div>
<p><span style="font-family:"Calibri",sans-serif">Hi,</span></p>
<div>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
</div>
<div>
<p><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><span style="font-family:"Calibri",sans-serif"> </span></p>
</div>
<div>
<p><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><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><span style="font-family:"Calibri",sans-serif"> </span></p>
</div>
<div>
<p><span style="font-family:"Calibri",sans-serif">Here is the fix that works for me for both problems.</span></p>
</div>
<div>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
</div>
<div>
<p><span style="font-family:"Calibri",sans-serif">Thanks,</span></p>
</div>
<div>
<p><span style="font-family:"Calibri",sans-serif">Eugene</span></p>
</div>
<div>
<p><span style="font-family:"Calibri",sans-serif"> </span></p>
</div>
<div>
<p><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><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><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><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><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><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><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><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><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><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><span style="font-size:10.0pt;font-family:"Courier New";color:#1f497d"> </span><span style="font-family:"Calibri",sans-serif"></span></p>
<p><span style="font-size:10.0pt;font-family:"Courier New";color:#1f497d"> enum {</span><span style="font-family:"Calibri",sans-serif"></span></p>
<p><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><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><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><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><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><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><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><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><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><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><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><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><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><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><span style="font-size:10.0pt;font-family:"Courier New";color:#1f497d"> break;</span><span style="font-family:"Calibri",sans-serif"></span></p>
<p><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><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><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><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><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><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><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><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><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><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><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><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><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><span style="font-size:10.0pt;font-family:"Courier New";color:#1f497d">{</span><span style="font-family:"Calibri",sans-serif"></span></p>
<p><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><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><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><span style="font-size:10.0pt;font-family:"Courier New";color:#1f497d"> // state.</span><span style="font-family:"Calibri",sans-serif"></span></p>
<p><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><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><span style="font-size:10.0pt;font-family:"Courier New";color:#1f497d"> </span><span style="font-family:"Calibri",sans-serif"></span></p>
<p><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><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><span style="font-size:10.0pt;font-family:"Courier New";color:#1f497d"> </span><span style="font-family:"Calibri",sans-serif"></span></p>
<p><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><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><span style="font-size:10.0pt;font-family:"Courier New";color:#1f497d">+</span><span style="font-family:"Calibri",sans-serif"></span></p>
<p><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><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><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><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><span style="font-size:10.0pt;font-family:"Courier New";color:#1f497d"> </span><span style="font-family:"Calibri",sans-serif"></span></p>
<p><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><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></div>
_______________________________________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
</blockquote></div>