<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Dawn,</div><div><br></div><div>Patch submitted. Thanks!</div><div><br></div>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=141593&view=rev">http://llvm.org/viewvc/llvm-project?rev=141593&view=rev</a><br>Log:<br>Patch from <a href="mailto:dawn@burble.org">dawn@burble.org</a> to build on linux!<br><div><div><br></div><div>On Oct 10, 2011, at 3:37 PM, <a href="mailto:dawn@burble.org">dawn@burble.org</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>This patch fixes the Linux build and has been updated to work <br>with the latest sources of llvm, clang and lldb.<br>Please review.<br><br>Note: while it fixes the build on Linux, lldb is still crashing in<br>pthread_mutex_lock() as it did before.<br><br>Thanks in advance,<br> -Dawn<br><br>On Thu, Oct 06, 2011 at 07:54:01PM -0700, <a href="mailto:dawn@burble.org">dawn@burble.org</a> wrote:<br><blockquote type="cite"><br></blockquote><blockquote type="cite">The attached patch fixes the Linux build for llvm and clang revs 137311<br></blockquote><blockquote type="cite">(the revs documented in lldb/scripts/build-llvm.pl),<br></blockquote><blockquote type="cite">and is based on lldb rev 141349 (current rev as of this email).<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Would it be OK to commit this?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thanks,<br></blockquote><blockquote type="cite"> -Dawn<br></blockquote><br><blockquote type="cite">Index: source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">--- source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(revision 141349)<br></blockquote><blockquote type="cite">+++ source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(working copy)<br></blockquote><blockquote type="cite">@@ -112,7 +112,7 @@<br></blockquote><blockquote type="cite"> executable = m_process->GetTarget().GetExecutableModule();<br></blockquote><blockquote type="cite"> load_offset = ComputeLoadOffset();<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">- if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS)<br></blockquote><blockquote type="cite">+ if (executable.get() && load_offset != LLDB_INVALID_ADDRESS)<br></blockquote><blockquote type="cite"> {<br></blockquote><blockquote type="cite"> ModuleList module_list;<br></blockquote><blockquote type="cite"> module_list.Append(executable);<br></blockquote><blockquote type="cite">@@ -132,7 +132,7 @@<br></blockquote><blockquote type="cite"> executable = m_process->GetTarget().GetExecutableModule();<br></blockquote><blockquote type="cite"> load_offset = ComputeLoadOffset();<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">- if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS)<br></blockquote><blockquote type="cite">+ if (executable.get() && load_offset != LLDB_INVALID_ADDRESS)<br></blockquote><blockquote type="cite"> {<br></blockquote><blockquote type="cite"> ModuleList module_list;<br></blockquote><blockquote type="cite"> module_list.Append(executable);<br></blockquote><blockquote type="cite">@@ -264,7 +264,7 @@<br></blockquote><blockquote type="cite"> {<br></blockquote><blockquote type="cite"> FileSpec file(I->path.c_str(), true);<br></blockquote><blockquote type="cite"> ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr);<br></blockquote><blockquote type="cite">- if (!module_sp.empty())<br></blockquote><blockquote type="cite">+ if (module_sp.get())<br></blockquote><blockquote type="cite"> new_modules.Append(module_sp);<br></blockquote><blockquote type="cite"> }<br></blockquote><blockquote type="cite"> m_process->GetTarget().ModulesDidLoad(new_modules);<br></blockquote><blockquote type="cite">@@ -280,7 +280,7 @@<br></blockquote><blockquote type="cite"> FileSpec file(I->path.c_str(), true);<br></blockquote><blockquote type="cite"> ModuleSP module_sp = <br></blockquote><blockquote type="cite"> loaded_modules.FindFirstModuleForFileSpec(file, NULL, NULL);<br></blockquote><blockquote type="cite">- if (!module_sp.empty())<br></blockquote><blockquote type="cite">+ if (module_sp.get())<br></blockquote><blockquote type="cite"> old_modules.Append(module_sp);<br></blockquote><blockquote type="cite"> }<br></blockquote><blockquote type="cite"> m_process->GetTarget().ModulesDidUnload(old_modules);<br></blockquote><blockquote type="cite">@@ -355,7 +355,7 @@<br></blockquote><blockquote type="cite"> {<br></blockquote><blockquote type="cite"> FileSpec file(I->path.c_str(), false);<br></blockquote><blockquote type="cite"> ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr);<br></blockquote><blockquote type="cite">- if (!module_sp.empty())<br></blockquote><blockquote type="cite">+ if (module_sp.get())<br></blockquote><blockquote type="cite"> module_list.Append(module_sp);<br></blockquote><blockquote type="cite"> }<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Index: source/Plugins/Process/Linux/ProcessLinux.cpp<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">--- source/Plugins/Process/Linux/ProcessLinux.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(revision 141349)<br></blockquote><blockquote type="cite">+++ source/Plugins/Process/Linux/ProcessLinux.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(working copy)<br></blockquote><blockquote type="cite">@@ -437,6 +437,35 @@<br></blockquote><blockquote type="cite"> return m_thread_list.GetSize(false);<br></blockquote><blockquote type="cite"> }<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">+uint32_t<br></blockquote><blockquote type="cite">+ProcessLinux::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list)<br></blockquote><blockquote type="cite">+{<br></blockquote><blockquote type="cite">+#if 0 // GetLogIfAllCategoriesSet is in lldb_private<br></blockquote><blockquote type="cite">+ // locker will keep a mutex locked until it goes out of scope<br></blockquote><blockquote type="cite">+ LogSP log (ProcessLinuxLog::GetLogIfAllCategoriesSet (Linux_LOG_THREAD));<br></blockquote><blockquote type="cite">+ if (log && log->GetMask().Test(Linux_LOG_VERBOSE))<br></blockquote><blockquote type="cite">+ log->Printf ("ProcessLinux::%s (pid = %i)", __FUNCTION__, GetID());<br></blockquote><blockquote type="cite">+ <br></blockquote><blockquote type="cite">+ // We currently are making only one thread per core and we<br></blockquote><blockquote type="cite">+ // actually don't know about actual threads. Eventually we<br></blockquote><blockquote type="cite">+ // want to get the thread list from memory and note which<br></blockquote><blockquote type="cite">+ // threads are on CPU as those are the only ones that we <br></blockquote><blockquote type="cite">+ // will be able to resume.<br></blockquote><blockquote type="cite">+ const uint32_t cpu_mask = m_comm.GetCPUMask();<br></blockquote><blockquote type="cite">+ for (uint32_t cpu_mask_bit = 1; cpu_mask_bit & cpu_mask; cpu_mask_bit <<= 1)<br></blockquote><blockquote type="cite">+ {<br></blockquote><blockquote type="cite">+ lldb::tid_t tid = cpu_mask_bit;<br></blockquote><blockquote type="cite">+ ThreadSP thread_sp (old_thread_list.FindThreadByID (tid, false));<br></blockquote><blockquote type="cite">+ if (!thread_sp)<br></blockquote><blockquote type="cite">+ thread_sp.reset(new ThreadLinux (*this, tid));<br></blockquote><blockquote type="cite">+ new_thread_list.AddThread(thread_sp);<br></blockquote><blockquote type="cite">+ }<br></blockquote><blockquote type="cite">+ return new_thread_list.GetSize(false);<br></blockquote><blockquote type="cite">+#else<br></blockquote><blockquote type="cite">+ return 0;<br></blockquote><blockquote type="cite">+#endif<br></blockquote><blockquote type="cite">+}<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite"> ByteOrder<br></blockquote><blockquote type="cite"> ProcessLinux::GetByteOrder() const<br></blockquote><blockquote type="cite"> {<br></blockquote><blockquote type="cite">Index: source/Plugins/Process/Linux/ProcessLinux.h<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">--- source/Plugins/Process/Linux/ProcessLinux.h<span class="Apple-tab-span" style="white-space:pre"> </span>(revision 141349)<br></blockquote><blockquote type="cite">+++ source/Plugins/Process/Linux/ProcessLinux.h<span class="Apple-tab-span" style="white-space:pre"> </span>(working copy)<br></blockquote><blockquote type="cite">@@ -129,6 +129,10 @@<br></blockquote><blockquote type="cite"> virtual uint32_t<br></blockquote><blockquote type="cite"> UpdateThreadListIfNeeded();<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">+ uint32_t<br></blockquote><blockquote type="cite">+ UpdateThreadList(lldb_private::ThreadList &old_thread_list, <br></blockquote><blockquote type="cite">+ lldb_private::ThreadList &new_thread_list);<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite"> virtual lldb::ByteOrder<br></blockquote><blockquote type="cite"> GetByteOrder() const;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Index: source/Plugins/Process/Linux/ProcessMonitor.cpp<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">--- source/Plugins/Process/Linux/ProcessMonitor.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(revision 141349)<br></blockquote><blockquote type="cite">+++ source/Plugins/Process/Linux/ProcessMonitor.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(working copy)<br></blockquote><blockquote type="cite">@@ -241,7 +241,7 @@<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> // Set errno to zero so that we can detect a failed peek.<br></blockquote><blockquote type="cite"> errno = 0;<br></blockquote><blockquote type="cite">- unsigned long data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL);<br></blockquote><blockquote type="cite">+ uint32_t data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL);<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> if (data == -1UL && errno)<br></blockquote><blockquote type="cite"> m_result = false;<br></blockquote><blockquote type="cite">Index: source/lldb.cpp<br></blockquote><blockquote type="cite">===================================================================<br></blockquote><blockquote type="cite">--- source/lldb.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(revision 141349)<br></blockquote><blockquote type="cite">+++ source/lldb.cpp<span class="Apple-tab-span" style="white-space:pre"> </span>(working copy)<br></blockquote><blockquote type="cite">@@ -94,7 +94,9 @@<br></blockquote><blockquote type="cite"> UnwindAssemblyInstEmulation::Initialize();<br></blockquote><blockquote type="cite"> UnwindAssembly_x86::Initialize();<br></blockquote><blockquote type="cite"> EmulateInstructionARM::Initialize ();<br></blockquote><blockquote type="cite">+#if !defined (__linux__)<br></blockquote><blockquote type="cite"> ObjectFilePECOFF::Initialize ();<br></blockquote><blockquote type="cite">+#endif<br></blockquote><blockquote type="cite"> #if defined (__APPLE__)<br></blockquote><blockquote type="cite"> //----------------------------------------------------------------------<br></blockquote><blockquote type="cite"> // Apple/Darwin hosted plugins<br></blockquote><blockquote type="cite">@@ -166,7 +168,9 @@<br></blockquote><blockquote type="cite"> UnwindAssembly_x86::Terminate();<br></blockquote><blockquote type="cite"> UnwindAssemblyInstEmulation::Terminate();<br></blockquote><blockquote type="cite"> EmulateInstructionARM::Terminate ();<br></blockquote><blockquote type="cite">+#if !defined (__linux__)<br></blockquote><blockquote type="cite"> ObjectFilePECOFF::Terminate ();<br></blockquote><blockquote type="cite">+#endif<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> #if defined (__APPLE__)<br></blockquote><blockquote type="cite"> DynamicLoaderMacOSXDYLD::Terminate();<br></blockquote><br><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">lldb-commits mailing list<br></blockquote><blockquote type="cite"><a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br></blockquote><blockquote type="cite"><a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br></blockquote><br><span><lldbR141569_llvmR141579.diff></span>_______________________________________________<br>lldb-commits mailing list<br><a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits<br></div></blockquote></div><br></body></html>