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.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@153075 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/examples/python/crashlog.py b/examples/python/crashlog.py
index 3e8fab5..d5531de 100755
--- a/examples/python/crashlog.py
+++ b/examples/python/crashlog.py
@@ -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'