summaryrefslogtreecommitdiffstats
path: root/lldb/examples
Commit message (Collapse)AuthorAgeFilesLines
...
* <rdar://problem/14972424>Greg Clayton2013-10-151-0/+298
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When debugging with the GDB remote in LLDB, LLDB uses special packets to discover the registers on the remote server. When those packets aren't supported, LLDB doesn't know what the registers look like. This checkin implements a setting that can be used to specify a python file that contains the registers definitions. The setting is: (lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/module.py Inside module there should be a function: def get_dynamic_setting(target, setting_name): This dynamic setting function is handed the "target" which is a SBTarget, and the "setting_name", which is the name of the dynamic setting to retrieve. For the GDB remote target definition the setting name is 'gdb-server-target-definition'. The return value is a dictionary that follows the same format as the OperatingSystem plugins follow. I have checked in an example file that implements the x86_64 GDB register set for people to see: examples/python/x86_64_target_definition.py This allows LLDB to debug to any archticture that is support and allows users to define the registers contexts when the discovery packets (qRegisterInfo, qHostInfo) are not supported by the remote GDB server. A few benefits of doing this in Python: 1 - The dynamic register context was already supported in the OperatingSystem plug-in 2 - Register contexts can use all of the LLDB enumerations and definitions for things like lldb::Format, lldb::Encoding, generic register numbers, invalid registers numbers, etc. 3 - The code that generates the register context can use the program to calculate the register context contents (like offsets, register numbers, and more) 4 - True dynamic detection could be used where variables and types could be read from the target program itself in order to determine which registers are available since the target is passed into the python function. This is designed to be used instead of XML since it is more dynamic and code flow and functions can be used to make the dictionary. llvm-svn: 192646
* An example of data formatters that generate a summary for a Unicode UTF ↵Enrico Granata2013-10-081-0/+48
| | | | | | encoded string represented as a (pointer,length) pair llvm-svn: 192206
* This is an example synthetic provider for libc++ unordered (multi) maps&setEnrico Granata2013-09-041-0/+110
| | | | | | Thanks to Jared Grubb for writing it and sharing it! llvm-svn: 189964
* Added a "sources.py" which adds a command that can print out the source ↵Greg Clayton2013-09-044-0/+1997
| | | | | | | | files contained in one or more modules. Added "mach_o.py" which is a mach-o parser that can dump mach-o file contents and also extract sections. It uses the "file_extract" module and the "dict_utils" module. llvm-svn: 189959
* Fixed a crash in objc_refs caused by improperSean Callanan2013-08-131-2/+4
| | | | | | | | resolution of class_getSuperclass. <rdar://problem/14662686> llvm-svn: 188240
* Fix typeo in diagnose-unwind.py.Jason Molenda2013-07-151-1/+1
| | | | llvm-svn: 186358
* Enabled the "--debug" option functionality that will SIGSTOP the current ↵Greg Clayton2013-07-121-0/+5
| | | | | | process allowing a debugger to attach. llvm-svn: 186194
* Added a memory.py module that contains a 'memfind' command which allows you ↵Greg Clayton2013-07-111-0/+181
| | | | | | to search memory for a byte pattern. llvm-svn: 186127
* Tweaks to the Python reference and example command to use the preferred ↵Enrico Granata2013-07-111-5/+5
| | | | | | print style and the (finally available :-) SetError API llvm-svn: 186122
* Add the frame content dumper function call to one more place.Jason Molenda2013-07-091-0/+2
| | | | llvm-svn: 185906
* Add new information gathering to the lldb & simple backtrace methods:Jason Molenda2013-07-091-5/+30
| | | | | | | 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
* A bit more cleanup on the process_events.py to use best practices for event ↵Greg Clayton2013-06-271-54/+72
| | | | | | handling. llvm-svn: 185089
* Update the platform options help strings.Greg Clayton2013-06-263-3/+3
| | | | llvm-svn: 185028
* Fixed the process_events.py example to be able to specify the platform and ↵Greg Clayton2013-06-261-64/+63
| | | | | | also use the debugger's listener. llvm-svn: 185027
* Added a regex that can be specified to avoid showing contents on types that ↵Greg Clayton2013-06-221-70/+105
| | | | | | match. Also split things up a bit so this can be run as a stand alone script or in lldb. llvm-svn: 184628
* Also report any OS python plugin in use.Jason Molenda2013-06-201-0/+3
| | | | llvm-svn: 184487
* Print the general purpose registers for frame 0.Jason Molenda2013-06-201-0/+8
| | | | llvm-svn: 184483
* Cleanup the output a bit by removing old print statements and also printing ↵Greg Clayton2013-06-201-4/+4
| | | | | | the number of types found. llvm-svn: 184389
* Implemented a types.py module that allows types to be inspected for padding.Greg Clayton2013-06-191-0/+212
| | | | | | 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
* A few small enhancements to the diagnose-unwind command.Jason Molenda2013-06-191-24/+82
| | | | | | | | | | | | | | | | 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
* Added the ability options to:Greg Clayton2013-06-141-74/+256
| | | | | | | | | - 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
* Remove unneeded include.Greg Clayton2013-06-131-1/+0
| | | | llvm-svn: 183959
* Added a new makefile setting that can be set in LLDB makefiles: USE_LIBCPP. ↵Greg Clayton2013-06-134-40/+175
| | | | | | | | | | | | 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
* Added some new example code that can grab all functions from any executable, ↵Greg Clayton2013-06-132-0/+183
| | | | | | | | 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
* Small changes to diagnose_unwind. Correctly provide help text.Jason Molenda2013-06-051-6/+15
| | | | | | Print the lldb version at the top of the output. llvm-svn: 183289
* Adding a diagnose-nsstring commandEnrico Granata2013-05-302-1/+172
| | | | | | This should help us figure out issues with the NSString data formatter llvm-svn: 182972
* Providing a more interesting command template for LLDBEnrico Granata2013-05-091-25/+41
| | | | | | This one actually exploits the SB API to obtain information about your inferior process llvm-svn: 181500
* Adding some LLDB-specific logic to the tracer (in a separate tracer module) ↵Enrico Granata2013-05-071-12/+91
| | | | | | | | to improve the quality of the output when debugging data formatters (more improvements are necessary before this is really legible) llvm-svn: 181367
* First iteration of a Python tracer moduleEnrico Granata2013-05-071-0/+249
| | | | | | | | | | | | | | | | | | | 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
* Print a backtrace line for a pc value even if we can't make an SBAddressJason Molenda2013-05-011-1/+2
| | | | | | out of it. llvm-svn: 180835
* Put a try/catch block around the SBAddress setting; don't want to Jason Molenda2013-04-301-13/+16
| | | | | | | terminate the command early if we happen to have an invalid load address. llvm-svn: 180826
* Rename unwind_diagnose.py to diagnose_unwind.py. ChangeJason Molenda2013-04-301-7/+7
| | | | | | | | | | | 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
* Remove a print statement that was left in accidentally.Greg Clayton2013-04-241-1/+0
| | | | llvm-svn: 180223
* One line I forgot to remove.Jason Molenda2013-04-231-1/+0
| | | | llvm-svn: 180086
* Update the unwind_diagnose script to work correctly with bothJason Molenda2013-04-231-48/+10
| | | | | | | | | | | 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
* Add a new -a / --address argument to image show-unwind to get theJason Molenda2013-04-231-1/+4
| | | | | | | | | | | 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
* Add a new python file to help diagnose backtrace failures in the field.Jason Molenda2013-04-231-0/+197
| | | | | | | | | | | | | | | 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
* <rdar://problem/13477795>Greg Clayton2013-04-042-3/+10
| | | | | | 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
* Playing around with making performance test cases run from within python. Greg Clayton2013-04-031-25/+122
| | | | llvm-svn: 178708
* <rdar://problem/13416800>Greg Clayton2013-04-031-4/+21
| | | | | | 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
* A few more tweaks to the python perf tests. Now there is a MemoryMeasurement.Greg Clayton2013-03-261-19/+60
| | | | llvm-svn: 178069
* Added a python version of the performance tests. It will be good to see if ↵Greg Clayton2013-03-231-0/+197
| | | | | | 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
* This checkin removes the last Cocoa formatters that were implemented in ↵Enrico Granata2013-03-191-1/+2
| | | | | | 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
* NS(Mutable)IndexSet formatter moves from Python to C++Enrico Granata2013-03-161-1/+2
| | | | llvm-svn: 177217
* Converting more data formatters to C++ - NSBundle, CFBinaryHeap, NSMachPort ↵Enrico Granata2013-03-165-5/+10
| | | | | | and NSNotification llvm-svn: 177213
* Created a sample "jump" command that handlesSean Callanan2013-03-121-0/+173
| | | | | | | GDB-style linespecs. This command allows changing the PC without manually looking up the new address. llvm-svn: 176841
* Initial checkin of a new project: LLDB Performance Testing InfrastructureEnrico Granata2013-03-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Added a new module that can dump all line tables for all compile units in ↵Greg Clayton2013-03-071-0/+59
| | | | | | | | 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
* Being explicit about how ignoring optparse's exceptions is not a best principleEnrico Granata2013-02-251-0/+2
| | | | llvm-svn: 176059
* Added missing lldb module namespace.Greg Clayton2013-02-251-1/+1
| | | | llvm-svn: 176049
OpenPOWER on IntegriCloud