summaryrefslogtreecommitdiffstats
path: root/lldb/examples
Commit message (Collapse)AuthorAgeFilesLines
* *** 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
* Specify ObjC++ when running heap commands in case we are stopped in a frame ↵Greg Clayton2015-01-141-0/+4
| | | | | | | | | | with another language. This ensures the expression gets runs with the correct language. <rdar://problem/18816647> llvm-svn: 226041
* Improved the TreeItem delegate which simplifies making tree items:Greg Clayton2014-10-071-135/+419
| | | | | | | | - tree items can define any number of key/value pairs - creating a tree you specify which columns you want to display and it will pick out the right key/value pairs from the new tree item dictionaries - added new "tk-target" command to explore the target's images, sections, symbols, compile units and line tables. llvm-svn: 219219
* Fix some errors that crept in when I cut & pasted into emacs.Jim Ingham2014-09-301-16/+16
| | | | llvm-svn: 218656
* Add a very trivial example for scripted stepping.Jim Ingham2014-09-301-0/+130
| | | | llvm-svn: 218650
* Played around with TK UI a bit this weekend.Greg Clayton2014-09-221-0/+260
| | | | | | | | | | | | | If you "command script import" this file, then you will have two new commands: (lldb) tk-variables (lldb) tk-process Not sure how this will work on all other systems, but on MacOSX, you will get a window with a tree view that allows you to inspect your local variables by expanding variables to see the child values. The "tk-process" allows you to inspect the currently selected process by expanding the process to see the threads, the threads to see the frames, and the frames to see the variables. Very handy if you want to view variables for all frames simultaneously. llvm-svn: 218279
* Fix some typos:Sylvestre Ledru2014-08-111-1/+1
| | | | | | | | * transfered => transferred * unkown => unknown * sucessfully => successfully llvm-svn: 215367
* Don't use "lldb." global variables in LLDB commands.Greg Clayton2014-07-111-1/+4
| | | | llvm-svn: 212852
* Fix typos.Bruce Mitchener2014-07-013-12/+12
| | | | llvm-svn: 212132
* Allow classes to be intialized using current lldb::SB objects. This can help ↵Greg Clayton2014-05-281-4/+55
| | | | | | to import/export the current process state. llvm-svn: 209702
* Fixed an issue where if you called:Greg Clayton2014-04-071-1/+2
| | | | | | | | | | | | | | | | | SBTarget::AddModule(const char *path, const char *triple, const char *uuid_cstr, const char *symfile); If "symfile" was filled in, it would cause us to not correctly add the module. Same goes for: SBTarget::AddModule(SBModuleSpec ...) Where you filled in the symfile. <rdar://problem/16529799> llvm-svn: 205750
* Add example target description file for QEMU for x86-64.Hafiz Abid Qadeer2014-02-201-0/+352
| | | | llvm-svn: 201790
OpenPOWER on IntegriCloud