[Lldb-commits] [lldb] r178812 - <rdar://problem/13477795>

Greg Clayton gclayton at apple.com
Thu Apr 4 16:36:51 PDT 2013


Author: gclayton
Date: Thu Apr  4 18:36:51 2013
New Revision: 178812

URL: http://llvm.org/viewvc/llvm-project?rev=178812&view=rev
Log:
<rdar://problem/13477795>

crashlog.py was always subtracting 1 to point to the previous instruction when symbolicating ARM backtraces. Many times the backtraces will include bit zero set to 1 to indicate thumb, so we need to make sure we mask the address and then backup one for non frame zero frames.


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

Modified: lldb/trunk/examples/python/crashlog.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/crashlog.py?rev=178812&r1=178811&r2=178812&view=diff
==============================================================================
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Thu Apr  4 18:36:51 2013
@@ -680,10 +680,10 @@ def SymbolicateCrashLog(crash_log, optio
         for frame_idx, frame in enumerate(thread.frames):
             disassemble = (this_thread_crashed or options.disassemble_all_threads) and frame_idx < options.disassemble_depth;
             if frame_idx == 0:
-                symbolicated_frame_addresses = crash_log.symbolicate (frame.pc, options.verbose)
+                symbolicated_frame_addresses = crash_log.symbolicate (frame.pc & crash_log.addr_mask, options.verbose)
             else:
                 # Any frame above frame zero and we have to subtract one to get the previous line entry
-                symbolicated_frame_addresses = crash_log.symbolicate (frame.pc - 1, options.verbose)
+                symbolicated_frame_addresses = crash_log.symbolicate ((frame.pc & crash_log.addr_mask) - 1, options.verbose)
             
             if symbolicated_frame_addresses:
                 symbolicated_frame_address_idx = 0

Modified: lldb/trunk/examples/python/symbolication.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/symbolication.py?rev=178812&r1=178811&r2=178812&view=diff
==============================================================================
--- lldb/trunk/examples/python/symbolication.py (original)
+++ lldb/trunk/examples/python/symbolication.py Thu Apr  4 18:36:51 2013
@@ -211,6 +211,7 @@ class Image:
         self.module = None
         self.symfile = None
         self.slide = None
+        
     
     def dump(self, prefix):
         print "%s%s" % (prefix, self)
@@ -377,7 +378,7 @@ class Symbolicator:
         """A class the represents the information needed to symbolicate addresses in a program"""
         self.target = None
         self.images = list() # a list of images to be used when symbolicating
-
+        self.addr_mask = 0xffffffffffffffff
     
     def __str__(self):
         s = "Symbolicator:\n"
@@ -412,6 +413,12 @@ class Symbolicator:
             for image in self.images:
                 self.target = image.create_target ()
                 if self.target:
+                    if self.target.GetAddressByteSize() == 4:
+                        triple = self.target.triple
+                        if triple:
+                            arch = triple.split('-')[0]
+                            if "arm" in arch:
+                                self.addr_mask = 0xfffffffffffffffe
                     return self.target
         return None
     





More information about the lldb-commits mailing list