[Lldb-commits] [lldb] r296504 - Fix a bug in r294611 w.r.t. Darwin Kernel debugging.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 28 10:57:54 PST 2017


Author: jingham
Date: Tue Feb 28 12:57:54 2017
New Revision: 296504

URL: http://llvm.org/viewvc/llvm-project?rev=296504&view=rev
Log:
Fix a bug in r294611 w.r.t. Darwin Kernel debugging.

<rdar://problem/30735021>

Modified:
    lldb/trunk/include/lldb/Target/DynamicLoader.h
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/source/Core/DynamicLoader.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

Modified: lldb/trunk/include/lldb/Target/DynamicLoader.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/DynamicLoader.h?rev=296504&r1=296503&r2=296504&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/DynamicLoader.h (original)
+++ lldb/trunk/include/lldb/Target/DynamicLoader.h Tue Feb 28 12:57:54 2017
@@ -331,6 +331,10 @@ protected:
   // Read a pointer from memory at the given addr.
   // Return LLDB_INVALID_ADDRESS if the read fails.
   lldb::addr_t ReadPointer(lldb::addr_t addr);
+  
+  // Calls into the Process protected method LoadOperatingSystemPlugin:
+  void LoadOperatingSystemPlugin(bool flush);
+
 
   //------------------------------------------------------------------
   // Member variables.

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=296504&r1=296503&r2=296504&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Tue Feb 28 12:57:54 2017
@@ -505,6 +505,7 @@ class Process : public std::enable_share
                 public PluginInterface {
   friend class FunctionCaller; // For WaitForStateChangeEventsPrivate
   friend class Debugger; // For PopProcessIOHandler and ProcessIOHandlerIsActive
+  friend class DynamicLoader; // For LoadOperatingSystemPlugin
   friend class ProcessEventData;
   friend class StopInfo;
   friend class Target;

Modified: lldb/trunk/source/Core/DynamicLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DynamicLoader.cpp?rev=296504&r1=296503&r2=296504&view=diff
==============================================================================
--- lldb/trunk/source/Core/DynamicLoader.cpp (original)
+++ lldb/trunk/source/Core/DynamicLoader.cpp Tue Feb 28 12:57:54 2017
@@ -233,3 +233,10 @@ addr_t DynamicLoader::ReadPointer(addr_t
   else
     return value;
 }
+
+void DynamicLoader::LoadOperatingSystemPlugin(bool flush)
+{
+    if (m_process)
+        m_process->LoadOperatingSystemPlugin(flush);
+}
+

Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=296504&r1=296503&r2=296504&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Tue Feb 28 12:57:54 2017
@@ -25,6 +25,7 @@
 #include "lldb/Host/Symbols.h"
 #include "lldb/Interpreter/OptionValueProperties.h"
 #include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/OperatingSystem.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
@@ -1026,6 +1027,12 @@ void DynamicLoaderDarwinKernel::LoadKern
         m_kernel.LoadImageAtFileAddress(m_process);
       }
     }
+    
+    // The operating system plugin gets loaded and initialized in 
+    // LoadImageUsingMemoryModule when we discover the kernel dSYM.  For a
+    // core file in particular, that's the wrong place to do this, since 
+    // we haven't fixed up the section addresses yet.  So let's redo it here.
+    LoadOperatingSystemPlugin(false);
 
     if (m_kernel.IsLoaded() && m_kernel.GetModule()) {
       static ConstString kext_summary_symbol("gLoadedKextSummaries");




More information about the lldb-commits mailing list