[Lldb-commits] [lldb] r175491 - Always print the kernel UUID and load address if we are working with

Jason Molenda jmolenda at apple.com
Mon Feb 18 22:11:13 PST 2013


Author: jmolenda
Date: Tue Feb 19 00:11:13 2013
New Revision: 175491

URL: http://llvm.org/viewvc/llvm-project?rev=175491&view=rev
Log:
Always print the kernel UUID and load address if we are working with
a kernel binary - even if we can't find the symbol-rich binary or 
dSYM on the debugger-system.  Print a warning if the symbol-rich binary
cannot be located.  This more closely emulates the gdb behavior when
a kernel debug session failed to locate a kernel binary.

<rdar://problem/13016095> 

Modified:
    lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

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=175491&r1=175490&r2=175491&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Tue Feb 19 00:11:13 2013
@@ -734,6 +734,17 @@ DynamicLoaderDarwinKernel::KextImageInfo
 
     bool uuid_is_valid = m_uuid.IsValid();
 
+    if (IsKernel() && uuid_is_valid && m_memory_module_sp.get())
+    {
+        Stream *s = &target.GetDebugger().GetOutputStream();
+        if (s)
+        {
+            char uuidbuf[64];
+            s->Printf ("Kernel UUID: %s\n", m_memory_module_sp->GetUUID().GetAsCString(uuidbuf, sizeof (uuidbuf)));
+            s->Printf ("Load Address: 0x%" PRIx64 "\n", m_load_address);
+        }
+    }
+
     if (!m_module_sp)
     {
         // See if the kext has already been loaded into the target, probably by the user doing target modules add.
@@ -777,6 +788,15 @@ DynamicLoaderDarwinKernel::KextImageInfo
             {
                 m_module_sp = target.GetSharedModule (module_spec);
             }
+
+            if (force_symbols_search && !m_module_sp)
+            {
+                Stream *s = &target.GetDebugger().GetOutputStream();
+                if (s)
+                {
+                    s->Printf ("WARNING: Unable to locate symbol rich version of kernel binary.\n");
+                }
+            }
         }
 
         // If we managed to find a module, append it to the target's list of images.
@@ -876,9 +896,6 @@ DynamicLoaderDarwinKernel::KextImageInfo
         Stream *s = &target.GetDebugger().GetOutputStream();
         if (s)
         {
-            char uuidbuf[64];
-            s->Printf ("Kernel UUID: %s\n", m_module_sp->GetUUID().GetAsCString(uuidbuf, sizeof (uuidbuf)));
-            s->Printf ("Load Address: 0x%" PRIx64 "\n", m_load_address);
             if (m_module_sp->GetFileSpec().GetDirectory().IsEmpty())
             {
                 s->Printf ("Loaded kernel file %s\n", m_module_sp->GetFileSpec().GetFilename().AsCString());





More information about the lldb-commits mailing list