[Lldb-commits] [lldb] r153075 - /lldb/trunk/examples/python/crashlog.py

Greg Clayton gclayton at apple.com
Mon Mar 19 18:30:27 PDT 2012


Author: gclayton
Date: Mon Mar 19 20:30:27 2012
New Revision: 153075

URL: http://llvm.org/viewvc/llvm-project?rev=153075&view=rev
Log:
Added a fix to the crash log script that allows you to locate and load a binary from any location and _then_ do the symbolication. Something like:

(lldb) file /path/to/file.so
(lldb) crashlog crash.log
....

Then if the file.so has already been loaded it will use the one that is already in LLDB without trying to match up the paths.


Modified:
    lldb/trunk/examples/python/crashlog.py

Modified: lldb/trunk/examples/python/crashlog.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=153075&r1=153074&r2=153075&view=diff
==============================================================================
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Mon Mar 19 20:30:27 2012
@@ -195,7 +195,7 @@
                 if text_section:
                     error = lldb.target.SetSectionLoadAddress (text_section, self.text_addr_lo)
                     if error.Success():
-                        #print 'Success: loaded %s.__TEXT = 0x%x' % (self.basename(), self.text_addr_lo)
+                        #print 'Success: loaded %s.__TEXT = 0x%x' % (self.get_resolved_path_basename(), self.text_addr_lo)
                         return None
                     else:
                         return 'error: %s' % error.GetCString()
@@ -228,19 +228,22 @@
         
         def add_target_module(self):
             if lldb.target:
-                if self.fetch_symboled_executable_and_dsym ():
-                    resolved_path = self.get_resolved_path();
-                    path_spec = lldb.SBFileSpec (resolved_path)
-                    #print 'target.AddModule (path="%s", arch="%s", uuid=%s)' % (resolved_path, self.arch, self.uuid)
-                    self.module = lldb.target.AddModule (resolved_path, self.arch, self.uuid)
-                    if self.module:
-                        err = self.load_module()
-                        if err:
-                            print err;
-                        else:
-                            return None
+                # Check for the module by UUID first in case it has been already loaded in LLDB
+                self.module = lldb.target.AddModule (None, None, str(self.uuid))
+                if not self.module:
+                    if self.fetch_symboled_executable_and_dsym ():
+                        resolved_path = self.get_resolved_path();
+                        path_spec = lldb.SBFileSpec (resolved_path)
+                        #print 'target.AddModule (path="%s", arch="%s", uuid=%s)' % (resolved_path, self.arch, self.uuid)
+                        self.module = lldb.target.AddModule (resolved_path, self.arch, self.uuid)
+                if self.module:
+                    err = self.load_module()
+                    if err:
+                        print err;
                     else:
-                        return 'error: unable to get module for (%s) "%s"' % (self.arch, resolved_path)
+                        return None
+                else:
+                    return 'error: unable to get module for (%s) "%s"' % (self.arch, resolved_path)
             else:
                 return 'error: invalid target'
         





More information about the lldb-commits mailing list