[Lldb-commits] [lldb] r159363 - in /lldb/trunk/examples/python: crashlog.py symbolication.py
Greg Clayton
gclayton at apple.com
Thu Jun 28 11:10:14 PDT 2012
Author: gclayton
Date: Thu Jun 28 13:10:14 2012
New Revision: 159363
URL: http://llvm.org/viewvc/llvm-project?rev=159363&view=rev
Log:
Listen to the "--verbose" flag when running "crashlog" and if verbose is enabled, then dump full paths to source files and modules.
Changed much of the output that was coming out with "--verbose" over to use the new "--debug" flag.
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=159363&r1=159362&r2=159363&view=diff
==============================================================================
--- lldb/trunk/examples/python/crashlog.py (original)
+++ lldb/trunk/examples/python/crashlog.py Thu Jun 28 13:10:14 2012
@@ -469,7 +469,7 @@
if crash_log.error:
print crash_log.error
continue
- if options.verbose:
+ if options.debug:
crash_log.dump()
if not crash_log.images:
print 'error: no images in crash log "%s"' % (crash_log)
@@ -570,7 +570,7 @@
if crash_log.error:
print crash_log.error
return
- if options.verbose:
+ if options.debug:
crash_log.dump()
if not crash_log.images:
print 'error: no images in crash log'
@@ -616,10 +616,10 @@
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)
+ symbolicated_frame_addresses = crash_log.symbolicate (frame.pc, 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)
+ symbolicated_frame_addresses = crash_log.symbolicate (frame.pc - 1, options.verbose)
if symbolicated_frame_addresses:
symbolicated_frame_address_idx = 0
@@ -651,9 +651,10 @@
usage = "usage: %prog [options] <FILE> [FILE ...]"
option_parser = optparse.OptionParser(description=description, prog='crashlog',usage=usage)
option_parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False)
+ option_parser.add_option('-g', '--debug', action='store_true', dest='debug', help='display verbose debug logging', default=False)
option_parser.add_option('-a', '--load-all', action='store_true', dest='load_all_images', help='load all executable images, not just the images found in the crashed stack frames', default=False)
option_parser.add_option('--images', action='store_true', dest='dump_image_list', help='show image list', default=False)
- option_parser.add_option('-g', '--debug-delay', type='int', dest='debug_delay', metavar='NSEC', help='pause for NSEC seconds for debugger', default=0)
+ option_parser.add_option('--debug-delay', type='int', dest='debug_delay', metavar='NSEC', help='pause for NSEC seconds for debugger', default=0)
option_parser.add_option('-c', '--crashed-only', action='store_true', dest='crashed_only', help='only symbolicate the crashed thread', default=False)
option_parser.add_option('-d', '--disasm-depth', type='int', dest='disassemble_depth', help='set the depth in stack frames that should be disassembled (default is 1)', default=1)
option_parser.add_option('-D', '--disasm-all', action='store_true', dest='disassemble_all_threads', help='enabled disassembly of frames on all threads (not just the crashed thread)', default=False)
@@ -678,7 +679,7 @@
except:
return
- if options.verbose:
+ if options.debug:
print 'command_args = %s' % command_args
print 'options', options
print 'args', args
Modified: lldb/trunk/examples/python/symbolication.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/symbolication.py?rev=159363&r1=159362&r2=159363&view=diff
==============================================================================
--- lldb/trunk/examples/python/symbolication.py (original)
+++ lldb/trunk/examples/python/symbolication.py Thu Jun 28 13:10:14 2012
@@ -83,7 +83,7 @@
return sym_ctx.GetSymbol().GetInstructions(self.target)
return None
- def symbolicate(self):
+ def symbolicate(self, verbose = False):
if self.symbolication == None:
self.symbolication = ''
self.inlined = False
@@ -91,7 +91,11 @@
if sym_ctx:
module = sym_ctx.GetModule()
if module:
- self.symbolication += module.GetFileSpec().GetFilename() + '`'
+ # Print full source file path in verbose mode
+ if verbose:
+ self.symbolication += str(module.GetFileSpec()) + '`'
+ else:
+ self.symbolication += module.GetFileSpec().GetFilename() + '`'
function_start_load_addr = -1
function = sym_ctx.GetFunction()
block = sym_ctx.GetBlock()
@@ -126,11 +130,15 @@
# Print out any line information if any is available
if line_entry.GetFileSpec():
+ # Print full source file path in verbose mode
+ if verbose:
+ self.symbolication += ' at %s' % line_entry.GetFileSpec()
+ else:
self.symbolication += ' at %s' % line_entry.GetFileSpec().GetFilename()
- self.symbolication += ':%u' % line_entry.GetLine ()
- column = line_entry.GetColumn()
- if column > 0:
- self.symbolication += ':%u' % column
+ self.symbolication += ':%u' % line_entry.GetLine ()
+ column = line_entry.GetColumn()
+ if column > 0:
+ self.symbolication += ':%u' % column
return True
return False
@@ -393,7 +401,7 @@
return self.target
return None
- def symbolicate(self, load_addr):
+ def symbolicate(self, load_addr, verbose = False):
if not self.target:
self.create_target()
if self.target:
@@ -401,7 +409,7 @@
if image:
image.add_module (self.target)
symbolicated_address = Address(self.target, load_addr)
- if symbolicated_address.symbolicate ():
+ if symbolicated_address.symbolicate (verbose):
if symbolicated_address.so_addr:
symbolicated_addresses = list()
@@ -418,7 +426,7 @@
symbolicated_address = Address(self.target, inlined_parent_so_addr.GetLoadAddress(self.target))
symbolicated_address.sym_ctx = inlined_parent_sym_ctx
symbolicated_address.so_addr = inlined_parent_so_addr
- symbolicated_address.symbolicate ()
+ symbolicated_address.symbolicate (verbose)
# push the new frame onto the new frame stack
symbolicated_addresses.append (symbolicated_address)
@@ -532,7 +540,7 @@
if target:
for addr_str in args:
addr = int(addr_str, 0)
- symbolicated_addrs = symbolicator.symbolicate(addr)
+ symbolicated_addrs = symbolicator.symbolicate(addr, options.verbose)
for symbolicated_addr in symbolicated_addrs:
print symbolicated_addr
print
More information about the lldb-commits
mailing list