summaryrefslogtreecommitdiff
path: root/lldb/examples
AgeCommit message (Collapse)Author
2018-12-17Fix lldb's macosx/heap.py cstr command.Davide Italiano
<rdar://problem/44432167>
2018-12-17Make crashlog.py work or binaries with spaces in their namesAdrian Prantl
This is a little dangerous since the crashlog files aren't 100% unambiguous, but the risk is mitigated by using a non-greedy +? pattern. rdar://problem/38478511 Differential Revision: https://reviews.llvm.org/D55608
2018-12-17Make crashlog.py work when a .dSYM is present, but a binary is missingAdrian Prantl
Often users have a crash log an d a .dSYM bundle, but not the original application binary. It turns out that for crash symbolication, we can safely fall back to using the binary inside the .dSYM bundle. Differential Revision: https://reviews.llvm.org/D55607
2018-11-11Remove header grouping comments.Jonas Devlieghere
This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain.
2018-11-11Remove comments after header includes.Jonas Devlieghere
This patch removes the comments following the header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. Differential revision: https://reviews.llvm.org/D54385
2018-09-27Fixes for GDB remote packet disassembler:Greg Clayton
- Add latency timings to GDB packet log summary if timestamps are on log - Add the ability to plot the latencies for each packet type with --plot - Don't crash the script when target xml register info is in wierd format
2018-09-27Add an interactive mode to BSD archive parser.Greg Clayton
2018-06-22Update cmdtemplate.py to use best pratices.Greg Clayton
Fixes include: - fix all lint errors - add code that will automatically register and LLDB command classes by detecting the classes and any classes that have a "register_lldb_command" function - automatically fill in the correct module name when registering commands - automatically fill in the class name when registering command
2018-06-13Fix/unify the spelling of Objective-C.Adrian Prantl
2018-04-02Added a BSD archive tool.Greg Clayton
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.
2017-11-16Fixed up to use a class for the commands, renamed the commands and added a ↵Greg Clayton
way to just dump the compile unit full paths and optionally their support files with the new "dump-files"command.
2017-11-07Update tuple/list/deque data formatters to work with newest libc++Pavel Labath
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
2017-10-31Modernize the example cmdtemplate.py.Jim Ingham
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.
2017-10-12The save_crashlog command was still looking at lldb.target andJim Ingham
lldb.process. That hasn't worked for a long time. Convert it to the form that takes an SBExecutionContext and use that instead.
2017-10-05Work around a bug in the C++ expression parser.Jim Ingham
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>
2017-10-05Another silly little thing you can do with Python commands.Jim Ingham
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.
2017-04-20Add an example command to toggle between disassembly-only and source mode.Jim Ingham
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.
2017-04-14Fixed to disassemble new packets and fixed the dumping of the 'x' packets.Greg Clayton
2017-03-28Print the error if dsymForUUID sometimes produces bad plists.Jim Ingham
Not much we can do about it but at least we can print the bad plist and the error.
2016-12-08Improve crashlog.py so it can handle more iOS crashlog files.Greg Clayton
<rdar://problem/29191857>
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone
*** 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.
2016-08-30Add an helper class lldb.formatters.synth.PythonObjectSyntheticChildProviderEnrico Granata
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
2016-08-05Mention is_stale in the scripted step doc.Jim Ingham
2016-06-28Fixup the "shadow" example command to use the function that takes an ↵Greg Clayton
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.
2016-06-23Added a new python example which installs a command called "shadow".Greg Clayton
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.
2016-06-10Fixed a few places that were building a regex from an identifier without ↵Greg Clayton
escaping the identifier text. <rdar://problem/26090553>
2016-05-03Another little example use of scripted thread plans.Jim Ingham
2016-04-14Fix regression in gnu_libstdcpp.py introduced by r266313Ulrich Weigand
CreateChildAtOffset needs a byte offset, not an element number.
2016-04-14Miscellaneous fixes for big-endian systemsUlrich Weigand
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
2015-11-03Python 3 - modernize exception catching syntax.Zachary Turner
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.
2015-10-26Fix tabs and spaces in one of the python files.Zachary Turner
2015-10-22Fix libstdc++ data formatters on Ubuntu 15.10 x86_64Todd Fiala
See http://reviews.llvm.org/D13964 for details.
2015-10-19Py3'ify some of the examples that get run at startup.Zachary Turner
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.
2015-10-13[libstdc++ data-formatters] Remove size limits.Siva Chandra
Reviewers: granata.enrico Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13682
2015-09-22Fix typos.Bruce Mitchener
Summary: Another round of minor typo fixes. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13026
2015-08-12Fix process_events.py to auto continue the process if we attached so the ↵Greg Clayton
process doesn't just sit there suspended.
2015-07-28Fix typo in gdbremote.pyPavel Labath
2015-07-22Improved the packet dumper to escape the response string before sending it ↵Greg Clayton
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.
2015-07-22Fix typos.Bruce Mitchener
Summary: Fix a bunch of typos. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11386
2015-07-20Fix the yellow colorizing and fix some logic in the "A" packet dumper.Greg Clayton
2015-07-17Handle dumping many more packet types including the A packet, qC, ↵Greg Clayton
QSetDisableASLR, qLaunchSuccess and QLaunchArch.
2015-07-17Added support for dumping 'x', 'X', 'qSymbol' packets. Also dump any XML ↵Greg Clayton
retrieved from a qXfer packets.
2015-07-17Allow gdbremote.py to take input from STDIN and handle "c" and "s" packets.Greg Clayton
2015-07-02Improve the packet dumper to be able to read the target.xml so it can dump ↵Greg Clayton
register values when disassembling the packet log.
2015-07-02Fix typosBruce Mitchener
Summary: Fixes more typos. Reviewers: clayborg Subscribers: lldb-commits-list Differential Revision: http://reviews.llvm.org/D10898
2015-07-02Another slightly less goofy example of scripted steps.Jim Ingham
2015-07-01Add a missing space.Jim Ingham
2015-06-23Remove a few uses of lldb.target, which is not validJim Ingham
in a scripted command.
2015-06-18Fix a variety of typos.Bruce Mitchener
No functional change.
2015-06-01Fix types.py to actually be able to run check_padding_command() without ↵Greg Clayton
erroring out. <rdar://problem/21071347>