Commit Graph

297 Commits

Author SHA1 Message Date
Jason Molenda 3f99ade67a Fix typeo in diagnose-unwind.py.
llvm-svn: 186358
2013-07-15 22:40:17 +00:00
Greg Clayton e110ad8fff Enabled the "--debug" option functionality that will SIGSTOP the current process allowing a debugger to attach.
llvm-svn: 186194
2013-07-12 20:08:00 +00:00
Greg Clayton 04bd684074 Added a memory.py module that contains a 'memfind' command which allows you to search memory for a byte pattern.
llvm-svn: 186127
2013-07-11 22:38:00 +00:00
Enrico Granata da504ff00a Tweaks to the Python reference and example command to use the preferred print style and the (finally available :-) SetError API
llvm-svn: 186122
2013-07-11 21:49:38 +00:00
Jason Molenda c95407b0d5 Add the frame content dumper function call to one more place.
llvm-svn: 185906
2013-07-09 05:36:41 +00:00
Jason Molenda 5bd4a4613c Add new information gathering to the lldb & simple backtrace methods:
print five words of memory at the beginning of the stack frame so it's
easier to track where an incorrect saved-fp or saved-pc may have come from.

llvm-svn: 185903
2013-07-09 05:08:14 +00:00
Greg Clayton 96eb9ab047 A bit more cleanup on the process_events.py to use best practices for event handling.
llvm-svn: 185089
2013-06-27 18:08:32 +00:00
Greg Clayton abc18417b6 Update the platform options help strings.
llvm-svn: 185028
2013-06-26 22:24:05 +00:00
Greg Clayton 111db4f94c Fixed the process_events.py example to be able to specify the platform and also use the debugger's listener.
llvm-svn: 185027
2013-06-26 22:23:45 +00:00
Greg Clayton 57d1c4865e Added a regex that can be specified to avoid showing contents on types that match. Also split things up a bit so this can be run as a stand alone script or in lldb.
llvm-svn: 184628
2013-06-22 01:42:49 +00:00
Jason Molenda e445f8fb4d Also report any OS python plugin in use.
llvm-svn: 184487
2013-06-20 22:05:35 +00:00
Jason Molenda 1332988f5a Print the general purpose registers for frame 0.
llvm-svn: 184483
2013-06-20 21:57:34 +00:00
Greg Clayton 694b49f0f8 Cleanup the output a bit by removing old print statements and also printing the number of types found.
llvm-svn: 184389
2013-06-20 01:23:56 +00:00
Greg Clayton d8c3d4b1e9 Implemented a types.py module that allows types to be inspected for padding.
The script was able to point out and save 40 bytes in each lldb_private::Section by being very careful where we need to have virtual destructors and also by re-ordering members.

llvm-svn: 184364
2013-06-19 21:50:28 +00:00
Jason Molenda 8359214427 A few small enhancements to the diagnose-unwind command.
Change the simple-minded stack walk to not depend on lldb to unwind
the first frame.

Collect a list of Modules and Addresses seen while backtracing (with
both methods), display the image list output for all of those modules,
plus disassemble and image show-unwind any additional frames that
the simple backtrace was able to unwind through instead of just the 
lldb unwind algorithm frames.

Remove checks for older lldb's that didn't support -a for disassemble
or specifying the assembler syntax on x86 targets.

llvm-svn: 184280
2013-06-19 04:52:55 +00:00
Greg Clayton 8ccc7f69cd Added the ability options to:
- specify the architecture
- specify the platform
- specify if only external symbols should be dumped
- specify if types in the function signatures should be canonicalized

llvm-svn: 183961
2013-06-14 00:30:23 +00:00
Greg Clayton 4c1306cccc Remove unneeded include.
llvm-svn: 183959
2013-06-13 23:56:47 +00:00
Greg Clayton 1767a73bc8 Added a new makefile setting that can be set in LLDB makefiles: USE_LIBCPP. This will enable libc++ support.
Improved the makefile "clean" to include deleting all ".d.[0-9]+" files.

Added options to the "lldb/examples/lookup" example and made it build using the LLDB_BUILD_DIR. If this is not set, it will default to "/Applications/Xcode.app/Contents/SharedFrameworks" on Darwin.

Added options to the "lldb/examples/function" example and made it build using the LLDB_BUILD_DIR.

llvm-svn: 183949
2013-06-13 21:27:14 +00:00
Greg Clayton 07a1d37b88 Added some new example code that can grab all functions from any executable, and it will print out the function name, range, return type and argument types.
This example shows someone could iterate over all functions and do something intelligent with them, like create function signatures. Then two different builds could be compared to verify the API hasn't changed.

llvm-svn: 183923
2013-06-13 18:03:11 +00:00
Jason Molenda 811d259bb1 Small changes to diagnose_unwind. Correctly provide help text.
Print the lldb version at the top of the output.

llvm-svn: 183289
2013-06-05 02:56:58 +00:00
Enrico Granata a5c0308bde Adding a diagnose-nsstring command
This should help us figure out issues with the NSString data formatter

llvm-svn: 182972
2013-05-30 23:36:47 +00:00
Enrico Granata 083fcdb414 Providing a more interesting command template for LLDB
This one actually exploits the SB API to obtain information about your inferior process

llvm-svn: 181500
2013-05-09 01:32:24 +00:00
Enrico Granata 78f05f13ad Adding some LLDB-specific logic to the tracer (in a separate tracer module) to improve the quality of the output when debugging data formatters
(more improvements are necessary before this is really legible)

llvm-svn: 181367
2013-05-07 21:42:18 +00:00
Enrico Granata c8b36f160c First iteration of a Python tracer module
This module uses Python's sys.settrace() mechanism so setup a hook that can log every significant operation
This is a first step in providing a good debugging experience of Python embedded in LLDB
This module comprises an OO infrastructure that wraps Python's tracing and inspecting mechanisms, plus a very simple logging tracer
Output from this tracer looks like:

call print_keyword_args from <module> @ 243 args are kwargs are {'first_name': 'John', 'last_name': 'Doe'}
running print_keyword_args @ 228 locals are {'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}
running print_keyword_args @ 229 locals are {'key': 'first_name', 'value': 'John', 'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}
first_name = John
running print_keyword_args @ 228 locals are {'key': 'first_name', 'value': 'John', 'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}
running print_keyword_args @ 229 locals are {'key': 'last_name', 'value': 'Doe', 'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}
last_name = Doe
running print_keyword_args @ 228 locals are {'key': 'last_name', 'value': 'Doe', 'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}
return from print_keyword_args value is None locals are {'key': 'last_name', 'value': 'Doe', 'kwargs': {'first_name': 'John', 'last_name': 'Doe'}}

llvm-svn: 181343
2013-05-07 19:49:59 +00:00
Jason Molenda 64dd73e5e1 Print a backtrace line for a pc value even if we can't make an SBAddress
out of it.

llvm-svn: 180835
2013-05-01 01:26:52 +00:00
Jason Molenda 14c84cdb9c Put a try/catch block around the SBAddress setting; don't want to
terminate the command early if we happen to have an invalid load
address.

llvm-svn: 180826
2013-04-30 23:03:56 +00:00
Jason Molenda f7305a6103 Rename unwind_diagnose.py to diagnose_unwind.py. Change
finish-swig-Python-LLDB.sh to create a new lldb.diagnose subdirectory
in the LLDB framework; the first diagnostic command in this directory
is diagnose-unwind.  There may be others added in the future.

Users can load these diagnostic tools into their session with 
"script import lldb.diagnose".

llvm-svn: 180768
2013-04-30 03:03:06 +00:00
Greg Clayton 8d1d25222e Remove a print statement that was left in accidentally.
llvm-svn: 180223
2013-04-24 22:21:02 +00:00
Jason Molenda e005d78241 One line I forgot to remove.
llvm-svn: 180086
2013-04-23 09:49:03 +00:00
Jason Molenda 0f224d2cd4 Update the unwind_diagnose script to work correctly with both
lldb-179 version numberings and the new lldb-300 version numberings.
Remove the pretense that someone might run this from the command
line; this is only used from within a live lldb debug session.  Fix
the loading so it can be loaded via "script import lldb.macosx" or
the script can be loaded individually like "command script import
unwind_diagnose.py"

llvm-svn: 180085
2013-04-23 09:38:10 +00:00
Jason Molenda 535ab8601f Add a new -a / --address argument to image show-unwind to get the
unwind instructions for a function/symbol which contains that
address.

Update the unwind_diagnose.py script to use this instead of doing
image show-unwind by name to avoid cases where there are multiple
name definitions.

llvm-svn: 180079
2013-04-23 04:30:57 +00:00
Jason Molenda caae381b35 Add a new python file to help diagnose backtrace failures in the field.
It will be installed in the LLDB.framework and can be loaded with

  (lldb) script import lldb.macosx

after which a "unwind-diagnose" command will be registered.  Select
the thread which has a bad backtrace and run this command -- a lot
of information about the stack frames, and an alternate backtrace
algorithm, will be used.  The information will often be sufficient
for a remote person to figure out why the backtrace failed.
<rdar://problem/13679300> 

llvm-svn: 180077
2013-04-23 03:40:32 +00:00
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
Greg Clayton 7b619fc159 Playing around with making performance test cases run from within python.
llvm-svn: 178708
2013-04-03 22:59:27 +00:00
Greg Clayton 927fa01e8c <rdar://problem/13416800>
ptr_refs command frequently doesn't work when run in large applicaton. This was due to the default timeout of 500ms. The timeouts have now been increased and all expression evaluations have been modified.

llvm-svn: 178628
2013-04-03 07:25:30 +00:00
Greg Clayton 2d95f35748 A few more tweaks to the python perf tests. Now there is a MemoryMeasurement.
llvm-svn: 178069
2013-03-26 21:00:29 +00:00
Greg Clayton 52e6378f0f Added a python version of the performance tests. It will be good to see if the overhead of python interferes at all with our performance readings. We can try things out with this script and see how things go.
llvm-svn: 177811
2013-03-23 01:44:48 +00:00
Enrico Granata 6d37cc6501 This checkin removes the last Cocoa formatters that were implemented in Python and reimplements them in C++. The Python Cocoa formatters are not shipped as part of LLDB anymore, but still exist in the source repository for user reference. Python formatters still exist for STL classes and users can still define their own Python formatters
llvm-svn: 177366
2013-03-19 00:27:22 +00:00
Enrico Granata 6a92511a08 NS(Mutable)IndexSet formatter moves from Python to C++
llvm-svn: 177217
2013-03-16 01:18:00 +00:00
Enrico Granata 50b5ee5023 Converting more data formatters to C++ - NSBundle, CFBinaryHeap, NSMachPort and NSNotification
llvm-svn: 177213
2013-03-16 00:50:25 +00:00
Sean Callanan 60e390cbd5 Created a sample "jump" command that handles
GDB-style linespecs.  This command allows changing
the PC without manually looking up the new address.

llvm-svn: 176841
2013-03-12 00:08:40 +00:00
Enrico Granata f58cececaa Initial checkin of a new project: LLDB Performance Testing Infrastructure
This is a very basic implementation of a library that easily allows to drive LLDB.framework to write test cases for performance

This is separate from the LLDB testsuite in test/ in that:
a) this uses C++ instead of Python to avoid measures being affected by SWIG
b) this is in very early development and needs lots of tweaking before it can be considered functionally complete
c) this is not meant to test correctness but to help catch performance regressions

There is a sample application built against the library (in darwin/sketch) that uses the famous sample app Sketch as an inferior to measure certain basic parameters of LLDB's behavior.
The resulting output is a PLIST much like the following:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
	<dict>
		<key>fetch-frames</key>
		<real>0.13161715522222225</real>
	</dict>
	<dict>
		<key>file-line-bkpt</key>
		<real>0.029111678750000002</real>
	</dict>
	<dict>
		<key>fetch-modules</key>
		<real>0.00026376766666666668</real>
	</dict>
	<dict>
		<key>fetch-vars</key>
		<real>0.17820429311111111</real>
	</dict>
	<dict>
		<key>run-expr</key>
		<real>0.029676525769230768</real>
	</dict>
</array>
</plist>

Areas for improvement:
- code cleanups (I will be out of the office for a couple days this coming week, but please keep ideas coming!)
- more metrics and test cases
- better error checking

This toolkit also comprises a simple event-loop-driven controller for LLDB, similar yet much simpler to what the Driver does to implement the lldb command-line tool.

llvm-svn: 176715
2013-03-08 20:29:13 +00:00
Greg Clayton 923bedf52f Added a new module that can dump all line tables for all compile units in any modules that are specified as arguments to the "dump_module_line_tables" command.
I used this to verify that the debug map line tables were the same as previous LLDB releases prior to my change in the DWARF in .o file linking.

llvm-svn: 176610
2013-03-07 02:57:54 +00:00
Enrico Granata 6308f58254 Being explicit about how ignoring optparse's exceptions is not a best principle
llvm-svn: 176059
2013-02-25 23:01:08 +00:00
Greg Clayton fdc2515ce9 Added missing lldb module namespace.
llvm-svn: 176049
2013-02-25 21:20:59 +00:00
Greg Clayton 59c40ff3f9 <rdar://problem/13286937>
Make sure to not look in self.images when we have a symbolicator with a live process.

llvm-svn: 176040
2013-02-25 19:34:57 +00:00
Enrico Granata cd4218f5c1 Using __package__ and __name__ seems redundant - __name__ should always contain the fully qualified module name
llvm-svn: 175856
2013-02-22 02:21:10 +00:00
Jim Ingham 6c00a01526 Mark the command as failed if parsing fails.
llvm-svn: 175776
2013-02-21 18:38:46 +00:00
Enrico Granata e1fb1654c8 Quick fix for the libc++ std::map synthetic children provider
If you try to access any child > 0 without having touched child 0, LLDB won't be able to reconstruct type information from the debug info.
Previously, we would fail.
Now, we simply go fetch child 0 and then come back.

llvm-svn: 174795
2013-02-09 01:44:23 +00:00
Greg Clayton 13fbb99107 Allow the target to give out the size of the red zone for given ABIs.
A bit of cleanup in the heap module. 

llvm-svn: 174129
2013-02-01 00:47:49 +00:00