Commit Graph

35 Commits

Author SHA1 Message Date
Greg Clayton a16cb16a58 <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.

llvm-svn: 178812
2013-04-04 23:36:51 +00:00
Sean Callanan c51cd47549 Made crashlog.py handle cases where a parent
process's name contains spaces.  Thanks to
Justin Seyster for the patch.

<rdar://problem/13002540>

llvm-svn: 172294
2013-01-12 02:11:49 +00:00
Greg Clayton aa4d45314c Added auto LLDB import to the crashlog script.
llvm-svn: 164192
2012-09-19 01:59:34 +00:00
Jason Molenda d204afaee8 Make the tab character in the thread frame lines optional.
llvm-svn: 163037
2012-08-31 23:27:24 +00:00
Greg Clayton 1f7460716b <rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". 
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()

Cleaned up header includes a bit as well.

llvm-svn: 162860
2012-08-29 21:13:06 +00:00
Jason Molenda e5ad3859eb Instead of using re.split and requiring two spaces between the "regname: regvalue" pairs,
use re.findall and specify the regexp of regname: regvalue that we're interested in.
<rdar://problem/12188752> 

llvm-svn: 162806
2012-08-28 23:46:12 +00:00
Greg Clayton 45b673dad5 <rdar://problem/12087275>
Make the crashlog parser able to deal with spaces in the process name.

llvm-svn: 161772
2012-08-13 18:48:03 +00:00
Greg Clayton 784933b791 Enable the "symbolicate" interactive command to symbolicate all crash logs if no indexes are supplied. This can be handy to use as:
(lldb) script import lldb.macosx.crashlog
(lldb) crashlog -i /tmp/*.crash
% symbolicate --crashed-only

This will symbolicate all of the crash logs only for the crashed thread.

Also print out the crash log index number in the output of the interactive "image" command:

(lldb) script import lldb.macosx.crashlog
(lldb) crashlog -i /tmp/*.crash
% image LLDB.framework
...

This then allows you to symbolicate a crash log by index accurately when you looked for an image of a specific version

llvm-svn: 160316
2012-07-16 20:40:20 +00:00
Greg Clayton c51d70d9d5 Show source by default for the first 4 frames of the crash thread. Also added options to allow showing source for all frames (--source-frames=NFRAMES) and for all threads (--source-all).
llvm-svn: 160175
2012-07-13 17:58:52 +00:00
Greg Clayton 563d03934c Added the ability to see source context with each frame in the "crashlog" command with the "--source-context" (-C for short to match grep) option.
Also made the symbolication of the crash logs more efficient when using the "--crashed-only" ("-c") option where only the crashed thread is symbolicated. We now only download the images for the frames in the crashed thread.

llvm-svn: 160160
2012-07-13 03:19:35 +00:00
Greg Clayton f7ab038ada Make the interactive command interpreter build into the "crashlog" command work correctly when run inside LLDB. Before this fix the "cmd.Cmd" object was trying to read from stdin itself and it was competing without command interpreter for the bytes.
llvm-svn: 159688
2012-07-03 21:40:18 +00:00
Greg Clayton a7fb1dcd4b 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.

llvm-svn: 159363
2012-06-28 18:10:14 +00:00
Greg Clayton f47b2c26bb Added a "save_crashlog" command to the lldb.macosx.crashlog package that allow you to dump your current process state out to a crash log file. This will dump all of the target module information with all load addresses, UUID values, and shared library paths, as well as all thread stacks and the crash log header. This will make it easy for us to save the current state of a process and then reload it later into LLDB.
llvm-svn: 159286
2012-06-27 20:02:04 +00:00
Greg Clayton f51a23fb6f Cleaned up some stuff in symbolication where we can now lazily get images when symbolicating after loading a crash log file.
Added colorization to the gdbremote.py output and also added the ability to symbolicate the addresses in registers.

llvm-svn: 157965
2012-06-04 23:22:17 +00:00
Greg Clayton eb749096e0 Added the ability to run "symbolicate [options] <crashlog-index>" in interactive mode.
llvm-svn: 157770
2012-05-31 21:21:08 +00:00
Greg Clayton f67002dd4c Make sure to subtract one from the PC when doing the symbolication of stack frames when it isn't the zero'th frame.
llvm-svn: 156974
2012-05-17 03:58:23 +00:00
Greg Clayton 563566c9dd Fixed an exception when parsing crash logs.
llvm-svn: 156945
2012-05-16 20:49:19 +00:00
Greg Clayton 60bb58f669 Modified the symbolication.Image object to store its uuid as a uuid.UUID object and made an accessor for getting a normalized UUID value out of the image object.
Modified the crashlog darwin module to always create a uuid.UUID object when making the symbolication.Image objects. Also modified it to handle some more types of crash log files and improved the register reading for thread registers of crashed threads.

llvm-svn: 156596
2012-05-11 00:30:14 +00:00
Johnny Chen afc98a6d7e Make crashlog.py more robust when dealing with the "Version: ..." header from the crash log file.
rdar://problem/11428134

llvm-svn: 156581
2012-05-10 22:45:54 +00:00
Greg Clayton c8f73d7b96 Added an interactive mode to the "crashlog" command so that we can look at multiple crash logs at once and do some data mining. Added an interactive command prompt that allows you to do:
% PYTHONPATH=./build/Debug/LLDB.framework/Resources/Python ; ./build/Debug//LLDB.framework/Resources/Python/lldb/macosx/crashlog.py -i ~/Downloads/crashes2/*.crash ) 

then you get an interactive prompt where you can search for data within all crash logs. For example you can do:

% list

which will list all crash logs

And you can search for all images given an image basename, or full path:

% image LLDB
% image /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
% image LLDB.framework

Which would all produce an output listing like:

40CD4430-7D27-3248-BE4C-71B1F36FC5D0 (1.132 - 132) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x000000011f8bc000 - 0x0000000120d3efbf)
B727A528-FF1F-3B20-9E4F-BBE96C7D922D (1.136 - 136) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x000000011e7f7000 - 0x000000011fc7ff87)
4D6F8DC2-5757-39C7-96B0-1A5B5171DC6B (1.137 - 137) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x000000012bd7f000 - 0x000000012d1fcfef)
FBF8786F-92B9-31E3-8BCD-A82148338966 (1.137 - 137) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x0000000122d78000 - 0x00000001241f5fd7)
7AE082E3-3BB7-3F64-A308-063E559DFC45 (1.143 - 143) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x0000000119b8d000 - 0x000000011b02ef5f)
7AE082E3-3BB7-3F64-A308-063E559DFC45 (1.143 - 143) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x0000000111497000 - 0x0000000112938f5f)
7AE082E3-3BB7-3F64-A308-063E559DFC45 (1.143 - 143) /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB, __TEXT=[0x0000000116680000 - 0x0000000117b21f5f)

llvm-svn: 156201
2012-05-04 20:44:14 +00:00
Johnny Chen 356782f5f6 Fix the following error when importing crashlog.py from a Python interactive session:
AttributeError: 'module' object has no attribute 'debugger'

llvm-svn: 156115
2012-05-03 22:31:30 +00:00
Johnny Chen 8e1fd43ad7 Fix AttributeError when using crashlog with verbose mode.
rdar://problem/11374653

llvm-svn: 156088
2012-05-03 18:46:28 +00:00
Greg Clayton d712ef0fd7 Remove the "-x" from the finish-swig-Python-LLDB.sh shell options so it doesn't print out all of the commands when executing the shell script.
Cleaned up the lldb.utils.symbolication, lldb.macosx.heap and lldb.macosx.crashlog. The lldb.macosx.heap can now build a dylib for the current triple into a temp directory and use it from there.

llvm-svn: 155577
2012-04-25 18:40:20 +00:00
Greg Clayton ed3eee6e55 Now that we have an LLDB package, make the "lldb.macosx.crashlog" module work with all of the new module paths.
llvm-svn: 155528
2012-04-25 01:49:50 +00:00
Greg Clayton f99295c3a6 Fixed some issues with symbolicating things. Fixed symbolication.add_module() to not use the resolved_path before we have tried to locate it. Fixed crashlog.locate_module_and_debug_symbols() to return true and false correctly.
llvm-svn: 155255
2012-04-20 23:31:27 +00:00
Greg Clayton 3c2c4bb2ce Added a platform agnostic symbolication python module that can be used by any targets. Then modified the darwin "crashlog.py" to use this agnostic info and the new functionality and classes.
llvm-svn: 153969
2012-04-03 21:35:43 +00:00
Greg Clayton 2b1bc868a0 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.

llvm-svn: 153075
2012-03-20 01:30:27 +00:00
Greg Clayton bc48f32d0a Added options to specify how many instructions before and after the frame
PC to disassemble. Users can also specify the frame depth to disassemble to
and also if disassembly should happen for all threads.

llvm-svn: 148627
2012-01-21 05:10:20 +00:00
Greg Clayton 53b43b0798 Use the "shlex" module to parse the command line that was passed down into
python so that single and double quotes and other standard shell like argument
parsing happens as expected before passing stuff along to option parsing.

Also handle exceptions so that we don't accidentally exit lldb if an uncaught
exception occurs.

llvm-svn: 148623
2012-01-21 04:26:24 +00:00
Greg Clayton 5c0f483ec1 Fixed it so the "--help" option works for the crashlog command. Corrected and
filled out the command help and removed unused options.

Updated the command to have a "--load-all" option that will cause the target
that gets created to locate and load all images specified in the Binary Images
section of the crash log to allow for complete program state to be matched
to that of the crash log, not just the images that were in the stack frames
(the default).

llvm-svn: 148605
2012-01-21 00:37:19 +00:00
Sean Callanan 88685f2865 Fixed a global reference that should have been
a reference to a class variable.

llvm-svn: 148562
2012-01-20 19:27:48 +00:00
Greg Clayton 42a6eb7195 Make the script work again from the command line as long as the PYTHONPATH
environment variable it set to include a path to lldb.py.

Also fixed the case where the executable can't be located and doesn't match
what is installed on the current system. It will still symbolicate the other
frames, and will just show what was originally in the crash log file.

Also removed the --crash-log option so the arguments to the "crashlog"
command are one or more paths to crash logs.

Fixed the script to "auto-install" itself when loaded from the embedded
script interpreter. Now you only need to import the module and the
command is ready for use.

llvm-svn: 148561
2012-01-20 19:25:32 +00:00
Greg Clayton 3d8d3db34e More fixed to verify if a file in the crash log is installed in the current
system and also deal with dsymForUUID being available on the network, locally,
and not at all.

llvm-svn: 148534
2012-01-20 06:12:47 +00:00
Greg Clayton a32bfbeeda Improved the regular expressions to handle "+" characters being at the front
of the identifier name in the binary images section. Improved the regular
expression for the frames.

Added a new file "crashlog.lldb" which can be sourced with "command source"
that will import the module and set itself up to be used as a command.

llvm-svn: 148529
2012-01-20 03:32:35 +00:00
Greg Clayton aa9d02b17c Modified the symbolicate-crash.py so it can be imported into python as a
module (you can't import a module with a '-' in it) and also added a
Symbolcate(...) top level function so it can be imported and used as an
LLDB command.

Then you can import the module and map a "crashlog" command (for darwin
use only currently) to the python function "crashlog.Symbolicate":

(lldb) script import crashlog
(lldb) command script add -f crashlog.Symbolicate crashlog

Then use it to symbolicate:

(lldb) crashlog --crash-log /path/to/foo.crash

The crash log will then get symbolicated and inline frames will be added to
the crash log and the frames will be displayed. The crash log currently will
only try and fetch and setup the target images requires in order to do the
symbolication.

This will need to be iterated upon, but it is getting close to being useful
so I am going to check this in.

llvm-svn: 148528
2012-01-20 03:15:45 +00:00