summaryrefslogtreecommitdiffstats
path: root/lldb/examples
Commit message (Collapse)AuthorAgeFilesLines
...
* Added a BSD archive tool.Greg Clayton2018-04-021-0/+481
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a combination stand alone BSD archive tool that can dump BSD archives: % bsd.py /path/to/foo.a Search archives for an object file: % bsd.py --object foo.o bar.a Dump the symbol definitions found in the __.SYMDEF objects: % bsd.py --symdef bar.a Find symbols by name that are listed in the __.SYMDEF objects: % bsd.py --symbol _Z123 bar.a Extract objects from BSD archives: % bsd.py --object foo.o bar.a --extract % bsd.py --object foo.o bar.a --extract --outfile /tmp/foo.o % bsd.py --object foo.o bar.a --extract --mtime 0x1234556 It also has installs a new LLDB command line command when imported into LLDB: (lldb) command script import ~/Dropbox/bin/bsd.py The "verify-debug-map-objects" command has been installed, type "help verify-debug-map-objects" for detailed help. (lldb) verify-debug-map-objects a.out This will iterate through all object files and verify the modification times match for any .o files, it will verify any .o files from BSD archives are found and have matching modification times and print out errors if any are found. llvm-svn: 328990
* Fixed up to use a class for the commands, renamed the commands and added a ↵Greg Clayton2017-11-161-68/+181
| | | | | | way to just dump the compile unit full paths and optionally their support files with the new "dump-files"command. llvm-svn: 318424
* Update tuple/list/deque data formatters to work with newest libc++Pavel Labath2017-11-071-4/+11
| | | | | | | | | | | | | | Summary: A couple of members of these data structures have been renamed in recent months. This makes sure they still work with the latest libc++ version. Reviewers: jingham, EricWF Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D39602 llvm-svn: 317624
* Modernize the example cmdtemplate.py.Jim Ingham2017-10-311-85/+95
| | | | | | | | This version relies on a newer and more convenient way to use a class to implement a command. It has been in place since early 2015, so it should be pretty safe to use. llvm-svn: 317043
* The save_crashlog command was still looking at lldb.target andJim Ingham2017-10-121-6/+7
| | | | | | | lldb.process. That hasn't worked for a long time. Convert it to the form that takes an SBExecutionContext and use that instead. llvm-svn: 315549
* Work around a bug in the C++ expression parser.Jim Ingham2017-10-051-47/+47
| | | | | | | | | | | | When the expression parser does name resolution for local variables in C++ closures it doesn't give the local name priority over other global symbols of the same name. heap.py uses "info" which is a fairly common name, and so the commands in it fail. This is a workaround, just use lldb_info not info. <rdar://problem/34026140> llvm-svn: 314959
* Another silly little thing you can do with Python commands.Jim Ingham2017-10-051-0/+24
| | | | | | | | | Sometimes you want to step along and print a local each time as you go. You can do that with stop hooks, but that's a little heavy-weight. This is a sketch of a command that steps and then does "frame variable" on all its arguments. llvm-svn: 314958
* Add an example command to toggle between disassembly-only and source mode.Jim Ingham2017-04-201-0/+48
| | | | | | | | Sometimes you are debugging in source, but you really only want to see the disassembly. That's easy to do but you have to set a few variables. This command toggles between your old values, and a disassembly only mode. llvm-svn: 300902
* Fixed to disassemble new packets and fixed the dumping of the 'x' packets.Greg Clayton2017-04-141-12/+41
| | | | llvm-svn: 300341
* Print the error if dsymForUUID sometimes produces bad plists.Jim Ingham2017-03-281-1/+5
| | | | | | | Not much we can do about it but at least we can print the bad plist and the error. llvm-svn: 298958
* Improve crashlog.py so it can handle more iOS crashlog files.Greg Clayton2016-12-081-0/+11
| | | | | | <rdar://problem/29191857> llvm-svn: 289006
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-0675-10770/+14148
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* Add an helper class lldb.formatters.synth.PythonObjectSyntheticChildProviderEnrico Granata2016-08-301-0/+57
| | | | | | | | This class enables one to easily write a synthetic child provider by writing a class that returns pairs of names and primitive Python values - the base class then converts those into LLDB SBValues Comes with a test case llvm-svn: 280172
* Mention is_stale in the scripted step doc.Jim Ingham2016-08-051-7/+29
| | | | llvm-svn: 277884
* Fixup the "shadow" example command to use the function that takes an ↵Greg Clayton2016-06-281-28/+26
| | | | | | | | | | | execution context now that the @lldb.command decorator does the right thing for the command function that takes 5 arguments. A few fixes: - Check the process state to make sure it is stopped - Grab the frame from the "exe_ctx" so this will work during breakpoint callbacks - Print out the SBDeclaration objects of the variables that shadow each other so we can see the source locations of which variable declarations are shodowing each other. llvm-svn: 273963
* Added a new python example which installs a command called "shadow". Greg Clayton2016-06-231-0/+59
| | | | | | This shows how to grab individual blocks from stack frames and get only the variables from those blocks. It then will iterate over all of the parent blocks and look for shadowed variables. llvm-svn: 273604
* Fixed a few places that were building a regex from an identifier without ↵Greg Clayton2016-06-102-2/+2
| | | | | | | | escaping the identifier text. <rdar://problem/26090553> llvm-svn: 272423
* Another little example use of scripted thread plans.Jim Ingham2016-05-031-0/+25
| | | | llvm-svn: 268338
* Fix regression in gnu_libstdcpp.py introduced by r266313Ulrich Weigand2016-04-141-1/+1
| | | | | | CreateChildAtOffset needs a byte offset, not an element number. llvm-svn: 266352
* Miscellaneous fixes for big-endian systemsUlrich Weigand2016-04-141-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes a bunch of issues that show up on big-endian systems: - The gnu_libstdcpp.py script doesn't follow the way libstdc++ encodes bit vectors: it should identify the enclosing *word* and then access the appropriate bit within that word. Instead, the script simply operates on bytes. This gives the same result on little-endian systems, but not on big-endian. - lldb_private::formatters::WCharSummaryProvider always assumes wchar_t is UTF16, even though it could also be UTF8 or UTF32. This is mostly not an issue on little-endian systems, but immediately fails on BE. Fixed by checking the size of wchar_t like WCharStringSummaryProvider already does. - ClangASTContext::GetChildCompilerTypeAtIndex uses uint32_t to access the virtual base offset stored in the vtable, even though the size of this field matches the target pointer size according to the C++ ABI. Again, this is mostly not visible on LE, but fails on BE. - Process::ReadStringFromMemory uses strncmp to search for a terminator consisting of multiple zero bytes. This doesn't work since strncmp will stop already at the first zero byte. Use memcmp instead. Differential Revision: http://reviews.llvm.org/D18983 llvm-svn: 266313
* Python 3 - modernize exception catching syntax.Zachary Turner2015-11-031-1/+1
| | | | | | | | | | | | | | | | | Old-style syntax: `except Exception, e:` New-style syntax: `except Exception as e:` These two statements are identical, except that the former has been deprecated for may versions, and was removed in Python 3. This converts everything to use the new syntax (which also works in Python 2). I had to convert unittest2 as well. What we really need to do is just delete unittest2, and use unittest instead since it is a standard module that ships with every Python distribution. But this is the path of least resistance for now, although at some point we will really need to do it. llvm-svn: 251968
* Fix tabs and spaces in one of the python files.Zachary Turner2015-10-261-16/+14
| | | | llvm-svn: 251308
* Fix libstdc++ data formatters on Ubuntu 15.10 x86_64Todd Fiala2015-10-221-7/+21
| | | | | | See http://reviews.llvm.org/D13964 for details. llvm-svn: 250965
* Py3'ify some of the examples that get run at startup.Zachary Turner2015-10-192-5/+5
| | | | | | | | | | Even though these are under examples/, they actually get loaded when LLDB starts up during initialization of ScriptInterpreterPython. There's obviously some kind of layering issue here (and comments in the code even point to that as well), but for now just make them py3 compatible. llvm-svn: 250710
* [libstdc++ data-formatters] Remove size limits.Siva Chandra2015-10-131-11/+0
| | | | | | | | | | Reviewers: granata.enrico Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13682 llvm-svn: 250131
* Fix typos.Bruce Mitchener2015-09-224-6/+6
| | | | | | | | | | | | Summary: Another round of minor typo fixes. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13026 llvm-svn: 248243
* Fix process_events.py to auto continue the process if we attached so the ↵Greg Clayton2015-08-121-0/+6
| | | | | | process doesn't just sit there suspended. llvm-svn: 244801
* Fix typo in gdbremote.pyPavel Labath2015-07-281-1/+1
| | | | llvm-svn: 243421
* Improved the packet dumper to escape the response string before sending it ↵Greg Clayton2015-07-221-10/+77
| | | | | | to the response functions (find any 0x7d characters and remove it and XOR the next character with 0x20). This allows us to parse the JSON in the reply packet and display it correctly. llvm-svn: 242928
* Fix typos.Bruce Mitchener2015-07-221-4/+4
| | | | | | | | | | | | Summary: Fix a bunch of typos. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11386 llvm-svn: 242856
* Fix the yellow colorizing and fix some logic in the "A" packet dumper.Greg Clayton2015-07-201-2/+7
| | | | llvm-svn: 242709
* Handle dumping many more packet types including the A packet, qC, ↵Greg Clayton2015-07-171-34/+81
| | | | | | QSetDisableASLR, qLaunchSuccess and QLaunchArch. llvm-svn: 242586
* Added support for dumping 'x', 'X', 'qSymbol' packets. Also dump any XML ↵Greg Clayton2015-07-171-15/+121
| | | | | | retrieved from a qXfer packets. llvm-svn: 242566
* Allow gdbremote.py to take input from STDIN and handle "c" and "s" packets.Greg Clayton2015-07-171-9/+28
| | | | llvm-svn: 242490
* Improve the packet dumper to be able to read the target.xml so it can dump ↵Greg Clayton2015-07-021-10/+62
| | | | | | register values when disassembling the packet log. llvm-svn: 241307
* Fix typosBruce Mitchener2015-07-021-3/+3
| | | | | | | | | | | | Summary: Fixes more typos. Reviewers: clayborg Subscribers: lldb-commits-list Differential Revision: http://reviews.llvm.org/D10898 llvm-svn: 241289
* Another slightly less goofy example of scripted steps.Jim Ingham2015-07-021-0/+56
| | | | llvm-svn: 241216
* Add a missing space.Jim Ingham2015-07-011-1/+1
| | | | llvm-svn: 241181
* Remove a few uses of lldb.target, which is not validJim Ingham2015-06-231-5/+6
| | | | | | in a scripted command. llvm-svn: 240451
* Fix a variety of typos.Bruce Mitchener2015-06-181-5/+5
| | | | | | No functional change. llvm-svn: 239995
* Fix types.py to actually be able to run check_padding_command() without ↵Greg Clayton2015-06-011-1/+1
| | | | | | | | erroring out. <rdar://problem/21071347> llvm-svn: 238764
* Added a new API to SBFrame:Greg Clayton2015-05-281-18/+112
| | | | | | | | | | lldb::addr_t SBFrame::GetCFA(); This gets the CFA (call frame address) of the frame so it allows us to take an address that is on the stack and figure out which thread it comes from. Also modified the heap.py module to be able to find out which variable in a frame's stack frame contains an address. This way when ptr_refs finds a match on the stack, it get then report which variable contains the pointer. llvm-svn: 238393
* Allow expresions to have unique expression prefixes:Greg Clayton2015-05-271-13/+24
| | | | | | | | | | | | | | | | | | expr_options = lldb.SBExpressionOptions() expr_options.SetPrefix(''' struct Foo { int a; int b; int c; } ''' expr_result = frame.EvaluateExpression ("Foo foo = { 1, 2, 3}; foo", expr_options) This fixed a current issue with ptr_refs, cstr_refs and malloc_info so that they can work. If expressions define their own types and then return expression results that use those types, those types get copied into the target's AST context so they persist and the expression results can be still printed and used in future expressions. Code was added to the expression parser to copy the context in which types are defined if they are used as the expression results. So in the case of types defined by expressions, they get defined in a lldb_expr function and that function and _all_ of its statements get copied. Many types of statements are not supported in this copy (array subscript, lambdas, etc) so this causes expressions to fail as they can't copy the result types. To work around this issue I have added code that allows expressions to specify an expression specific prefix. Then when you evaluate the expression you can pass the "expr_options" and have types that can be correctly copied out into the target. I added this as a way to work around an issue, but I also think it is nice to be allowed to specify an expression prefix that can be reused by many expressions, so this feature is very useful. <rdar://problem/21130675> llvm-svn: 238365
* Fix this module to work with current packects and also to be able to figure ↵Greg Clayton2015-05-221-15/+39
| | | | | | out average packets speed and standard deviation. llvm-svn: 238065
* Add a call to SBDebugger:Destroy() at the end of the self-hostedJason Molenda2015-04-011-0/+1
| | | | | | | | | | version of this script. We picked up a bug at some point in March where scripts that fail to call SBDebugger::Destroy() will crash in the Debugger C++ dtor. I want to track the change down which introduced the change - but this script should be calling SBDebugger::Destroy() in the first place, so do that. llvm-svn: 233779
* Fix StdVBoolImplementation to handle large vectorsTamas Berghammer2015-03-251-2/+3
| | | | | | | | | | The previous implementation only read out the first element of the underlying storage array. Because of it only the first 32 (on x86) or the first 64 (on x86_64) element was displayed. Differential revision: http://reviews.llvm.org/D8585 llvm-svn: 233179
* Cleanup to simplify the formatter for std::map of libstdc++.Siva Chandra2015-03-181-33/+11
| | | | | | | | | | | | | | | | | | Summary: GCC does not emit some DWARF required for the simplified formatter to work. A workaround for it has been incorporated in the formatter. The corresponding test TestDataFormatterStdMap has also been enabled for GCC. Test Plan: dotest.py -C <clang|gcc> -p TestDataFormatterStdMap Reviewers: clayborg, vharron, granata.enrico Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8424 llvm-svn: 232678
* Implement formatter for std::vector<bool, ...> of libstdc++ in Python.Siva Chandra2015-03-171-68/+126
| | | | | | | | | | | | | | | | | | | Summary: The existing formatter in C++ has been removed as it was not being used. The associated test TestDataFormatterStdVBool.py has been enabled for both Clang and GCC on Linux. Test Plan: dotest.py -p TestDataFormatterStdVBool Reviewers: vharron, clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8390 llvm-svn: 232548
* Cleanup implementation of formatter for std::vector from libstdc++.Siva Chandra2015-03-161-11/+1
| | | | | | | | | | | | | | Summary: Removed unused variables and methods. Test Plan: dotest.py -p TestDataFormatterStdVector Reviewers: vharron Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8368 llvm-svn: 232434
* symbolicate the application specific backtraces that are in MacOSX crash log ↵Greg Clayton2015-03-052-77/+127
| | | | | | | | files. <rdar://problem/20039160> llvm-svn: 231415
OpenPOWER on IntegriCloud