summaryrefslogtreecommitdiffstats
path: root/lldb/examples
Commit message (Collapse)AuthorAgeFilesLines
...
* Logging for data formatters.Enrico Granata2012-04-0217-3/+352
| | | | llvm-svn: 153878
* Making sure the count on synthetic providers is always setup - This should ↵Enrico Granata2012-03-312-4/+8
| | | | | | prevent errors about count being undefined from showing up llvm-svn: 153791
* Added some logging to STL synthetic children providers - this should help us ↵Enrico Granata2012-03-302-2/+20
| | | | | | catch problems; more logging might/will be added as needed llvm-svn: 153750
* Fixing a whole class of crashers and potential crashers related to data ↵Enrico Granata2012-03-3014-14/+14
| | | | | | formatters eating up all the stack when an unknown class has to be summarized ; this should make the whole Objective-C summaries more stable llvm-svn: 153712
* Part 1 of a series of fixes meant to improve reliability and increase ease ↵Enrico Granata2012-03-294-4/+318
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of bug fixing for data formatter issues. We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility The Pythonic logging can be enabled by using the following scripting commands: (lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...} 0 = no logging 1 = do log 2 = flush after logging each line - slower but safer 3 or more = each time a Logger is constructed, log the function that has created it more log levels may be added, each one being more log-active than the previous by default, the log output will come out on your screen, to direct it to a file: (lldb) script Logger._lldb_formatters_debug_filename = 'filename' that will make the output go to the file - set to None to disable the file output and get screen logging back Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons this will fix crashers where a malformed list or map would not ever meet our termination conditions to set the cap to a different value: (lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255) you can optionally disable the loop detection algorithm for lists (lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False llvm-svn: 153676
* When running this from the command line, don't pass the python script file ↵Greg Clayton2012-03-291-1/+1
| | | | | | itself to be disassembled. llvm-svn: 153626
* Fixing an issue where Unicode characters in an NSString were printed as ↵Enrico Granata2012-03-291-8/+16
| | | | | | escape sequences by the summary provider shipping with LLDB - Added relevant test case code. Bonus points for identifying the source of the quotes :-) llvm-svn: 153624
* Adding missing fileEnrico Granata2012-03-281-0/+19
| | | | llvm-svn: 153559
* adding a summary for Objective-C type 'Class'Enrico Granata2012-03-271-0/+6
| | | | llvm-svn: 153541
* Synthetic values are now automatically enabled and active by default. ↵Enrico Granata2012-03-272-12/+30
| | | | | | | | | | | | SBValue is set up to always wrap a synthetic value when one is available. A new setting enable-synthetic-value is provided on the target to disable this behavior. There also is a new GetNonSyntheticValue() API call on SBValue to go back from synthetic to non-synthetic. There is no call to go from non-synthetic to synthetic. The test suite has been changed accordingly. Fallout from changes to type searching: an hack has to be played to make it possible to use maps that contain std::string due to the special name replacement operated by clang Fixing a test case that was using libstdcpp instead of libc++ - caught as a consequence of said changes to type searching llvm-svn: 153495
* Fixed up the command so that it doesn't dump the first arguments when run ↵Greg Clayton2012-03-231-7/+8
| | | | | | from the command line which was causing this script to dump the script itself. llvm-svn: 153294
* Added python script that implements a "parse_log_file" command in LLDB which canGreg Clayton2012-03-221-0/+114
| | | | | | | | | | parse the output from "log enable --timestamp ...." and converts it to be relative to the first timestamp and shows the time deltas between log lines. This can also be used as a stand along script outside of lldb: ./delta.py log.txt llvm-svn: 153288
* Added a fix to the crash log script that allows you to locate and load a ↵Greg Clayton2012-03-201-13/+16
| | | | | | | | | | | | binary from any location and _then_ do the symbolication. Something like: (lldb) file /path/to/file.so (lldb) crashlog crash.log .... Then if the file.so has already been loaded it will use the one that is already in LLDB without trying to match up the paths. llvm-svn: 153075
* Massive enumeration name changes: a number of enums in ValueObject were not ↵Enrico Granata2012-03-192-6/+3
| | | | | | | | | | | | | | | | | | following the naming pattern Changes to synthetic children: - the update(self): function can now (optionally) return a value - if it returns boolean value True, ValueObjectSyntheticFilter will not clear its caches across stop-points this should allow better performance for Python-based synthetic children when one can be sure that the child ValueObjects have not changed - making a difference between a synthetic VO and a VO with a synthetic value: now a ValueObjectSyntheticFilter will not return itself as its own synthetic value, but will (correctly) claim to itself be synthetic - cleared up the internal synthetic children architecture to make a more consistent use of pointers and references instead of shared pointers when possible - major cleanup of unnecessary #include, data and functions in ValueObjectSyntheticFilter itself - removed the SyntheticValueType enum and replaced it with a plain boolean (to which it was equivalent in the first place) Some clean ups to the summary generation code Centralized the code that clears out user-visible strings and data in ValueObject More efficient summaries for libc++ containers llvm-svn: 153061
* Adding a new example of synthetic children providerEnrico Granata2012-03-172-0/+168
| | | | llvm-svn: 152970
* Warn about an example script being obsoleted by new native features and just ↵Enrico Granata2012-03-162-0/+10
| | | | | | an example llvm-svn: 152890
* Deleting obsolete filesEnrico Granata2012-03-165-612/+0
| | | | llvm-svn: 152888
* The Cocoa formatters now provide error messages for many of the common ↵Enrico Granata2012-03-1321-448/+543
| | | | | | things-went-wrong situations. Previously they would say nothing or log failures to the Python console llvm-svn: 152673
* Changed several of the Cocoa formatters to match the output style that Xcode ↵Enrico Granata2012-03-139-15/+48
| | | | | | | | | | | uses internally to provide summaries This has been done for those summaries where the difference is only cosmetic (e.g. naming things as items instead of values, ...) The LLDB output style has been preserved when it provides more information (e.g. telling the type as well as the value of an NSNumber) Test cases have been updated to reflect the updated output style where necessary llvm-svn: 152592
* Added formatters for libc++ (http://libcxx.llvm.org):Enrico Granata2012-03-121-0/+481
| | | | | | | | | | | | | std::string has a summary provider std::vector std::list and std::map have both a summary and a synthetic children provider Given the usage of a custom namespace (std::__1::classname) for the implementation of libc++, we keep both libstdcpp and libc++ formatters enabled at the same time since that raises no conflicts and enabled for seamless transition between the two The formatters for libc++ reside in a libcxx category, and are loaded from libcxx.py (to be found in examples/synthetic) The formatters-stl test cases have been divided to be separate for libcxx and libstdcpp. This separation is necessary because (a) we need different compiler flags for libc++ than for libstdcpp (b) libc++ inlines a lot more than libstdcpp and some code changes were required to accommodate this difference llvm-svn: 152570
* Fixing a problem with the NSSet summary provider; plus, providing a further ↵Enrico Granata2012-03-092-2/+6
| | | | | | optimization to the whole Cocoa formatters infrastructure llvm-svn: 152423
* Changed ValueObject to use a dedicated ChildrenManager class to store its ↵Enrico Granata2012-03-091-1/+55
| | | | | | | | | | | | | | | children, instead of an std::vector This solves an issue where a ValueObject was getting a wrong children count (usually, a huge value) and trying to resize the vector of children to fit that many ValueObject* Added a loop detection algorithm to the synthetic children provider for std::list Added a few more checks to the synthetic children provider for std::vector Both std::list and std::vector's synthetic children providers now cache the count of children instead of recomputing it every time std::map has a field that stores the count, so there is little need to cache it on our side llvm-svn: 152371
* the formatter for NSNotification was not being initialized correctlyEnrico Granata2012-03-091-3/+4
| | | | llvm-svn: 152358
* Fixing some of the new Python formatters to report '1 object' instead of '1 ↵Enrico Granata2012-03-077-20/+34
| | | | | | objects' llvm-svn: 152186
* Several performance-oriented changes to the introspecting data formatters:Enrico Granata2012-03-0519-750/+594
| | | | | | | | | | | | (a) the SystemParameters object is now passed around to the formatters; doing so enables the formatters to reuse computed values for things such as pointer-size and endianness instead of repeatedly computing these on their own (b) replacing the global ISA cache with a per-process one (c) providing a per-process types cache where each formatter can store the types it needs to operate, and be sure to find them the next time without recalculating them this also enables formatters to share types if they agree on a local naming convention (d) lazy fetching of data from Objective-C runtime data structures data is fetched as needed and we stop reading as soon as we determine that an ISA is actually garbage llvm-svn: 152052
* added a new formatter for CF(Mutable)BitVectorEnrico Granata2012-03-032-0/+166
| | | | | | | | fixed a few potential NULL-pointer derefs in ValueObject we have a way to provide docstrings for properties we add to the SWIG layer - a few of these properties have a docstring already, more will come in future commits added a new bunch of properties to SBData to make it more natural and Python-like to access the data they contain llvm-svn: 151962
* Removing a spurious print statement leftover from debugging the formatter codeEnrico Granata2012-03-021-1/+0
| | | | llvm-svn: 151928
* (a) adding formatters for:Enrico Granata2012-03-022-1/+51
| | | | | | | | NSTimeZone and CFTimeZonRef SEL and related types CFGregorianDate llvm-svn: 151866
* this fixes unicode strings handling in 32-bit mode on LionEnrico Granata2012-03-011-12/+2
| | | | llvm-svn: 151831
* (a) adding an introspection formatter for NS(Mutable)IndexSetEnrico Granata2012-03-015-10/+233
| | | | | | | | | (b) fixes and improvements to the formatters for NSDate and NSString (c) adding an introspection formatter for NSCountedSet (d) making the Objective-C formatters test cases pass on both 64 and 32 bit one of the test cases is marked as expected failure on i386 - support needs to be added to the LLDB core for it to pass llvm-svn: 151826
* Add an option to sort by packet count (rather than time). Also print the count,Jim Ingham2012-03-011-7/+20
| | | | | | and to print the total count & time in the header. llvm-svn: 151823
* 1) solving a bug where, after Jim's fixes to stack frames, synthetic ↵Enrico Granata2012-03-011-9/+20
| | | | | | | | | | | | | | | | | children were not recalculated when necessary, causing them to get out of sync with live data 2) providing an updated list of tagged pointers values for the objc_runtime module - hopefully this one is final 3) changing ValueObject::DumpValueObject to use an Options class instead of providing a bulky list of parameters to pass around this change had been laid out previously, but some clients of DumpValueObject() were still using the old prototype and some arguments were treated in a special way and passed in directly instead of through the Options class 4) providing new GetSummaryAsCString() and GetValueAsCString() calls in ValueObject that are passed a formatter object and a destination string and fill the string by formatting themselves using the formatter argument instead of the default for the current ValueObject 5) removing the option to have formats and summaries stick to a variable for the current stoppoint after some debate, we are going with non-sticky: if you say frame variable --format hex foo, the hex format will only be applied to the current command execution and not stick when redisplaying foo the other option would be full stickiness, which means that foo would be formatted as hex for its whole lifetime we are open to suggestions on what feels "natural" in this regard llvm-svn: 151801
* Fixing a problem with v1 runtime - plus hopefully finalizing the code to ↵Enrico Granata2012-02-291-12/+13
| | | | | | check for tagged pointers llvm-svn: 151753
* This commit:Enrico Granata2012-02-2916-184/+350
| | | | | | | | | | | | | a) adds a Python summary provider for NSDate b) changes the initialization for ScriptInterpreter so that we are not passing a bulk of Python-specific function pointers around c) provides a new ScriptInterpreterObject class that allows for ref-count safe wrapping of scripting objects on the C++ side d) contains much needed performance improvements: 1) the pointer to the Python function generating a scripted summary is now cached instead of looked up every time 2) redundant memory reads in the Python ObjC runtime wrapper are eliminated 3) summaries now use the m_summary_str in ValueObject to store their data instead of passing around ( == copying) an std::string object e) contains other minor fixes, such as adding descriptive error messages for some cases of summary generation failure llvm-svn: 151703
* Fixing an if condition which was causing issues in detecting the correct ↵Enrico Granata2012-02-241-1/+1
| | | | | | runtime version llvm-svn: 151388
* <rdar://problem/10103468>Greg Clayton2012-02-241-0/+102
| | | | | | | | | | | | | | | | | | | | | | | | | I started work on being able to add symbol files after a debug session had started with a new "target symfile add" command and quickly ran into problems with stale Address objects in breakpoint locations that had lldb_private::Section pointers into modules that had been removed or replaced. This also let to grabbing stale modules from those sections. So I needed to thread harded the Address, Section and related objects. To do this I modified the ModuleChild class to now require a ModuleSP on initialization so that a weak reference can created. I also changed all places that were handing out "Section *" to have them hand out SectionSP. All ObjectFile, SymbolFile and SymbolVendors were inheriting from ModuleChild so all of the find plug-in, static creation function and constructors now require ModuleSP references instead of Module *. Address objects now have weak references to their sections which can safely go stale when a module gets destructed. This checkin doesn't complete the "target symfile add" command, but it does get us a lot clioser to being able to do such things without a high risk of crashing or memory corruption. llvm-svn: 151336
* fixing a syntax error with objc_runtime.pyEnrico Granata2012-02-231-3/+45
| | | | llvm-svn: 151304
* This patch provides a set of formatters for most of the commonly used Cocoa ↵Enrico Granata2012-02-2317-0/+2928
| | | | | | | | | | classes. The formatter for NSString is an improved version of the one previously shipped as an example, the others are new in design and implementation. A more robust and OO-compliant Objective-C runtime wrapper is provided for runtime versions 1 and 2 on 32 and 64 bit. The formatters are contained in a category named "AppKit", which is not enabled at startup. llvm-svn: 151300
* Use a sentry object to properly initialize/terminate LLDB.Johnny Chen2012-02-221-4/+14
| | | | llvm-svn: 151116
* Fix comment.Johnny Chen2012-02-211-1/+1
| | | | llvm-svn: 151077
* Revert accidental commit.Benjamin Kramer2012-02-211-3/+3
| | | | llvm-svn: 151074
* Remove a ton of implicit narrowing conversions for C++11 compatibility.Benjamin Kramer2012-02-211-3/+3
| | | | llvm-svn: 151071
* Fix examples/lookup/main.cpp.Johnny Chen2012-02-202-14/+34
| | | | | | | Patch to fix the main.cpp compile error submitted by Dmitry Vyukov <dvyukov@google.com>. Also add a Makefile, plus some modification to main.cpp. llvm-svn: 150990
* fixing comment to reflect that currentversion of OSX works with our STL ↵Enrico Granata2012-02-081-1/+1
| | | | | | formatters llvm-svn: 150085
* Fixing issues where synthetic children providers for STL containers ↵Enrico Granata2012-02-031-64/+41
| | | | | | std::list and std::map where not doing their job properly llvm-svn: 149700
* This commit provides a new default summary for Objective-C boolean ↵Enrico Granata2012-01-311-0/+9
| | | | | | variables, which shows YES or NO instead of the character value. A new category named objc is added to contain this summary provider. Any future Objective-C related formatters would probably fit here llvm-svn: 149388
* Added a new lldb.SBValue helper module that has two classes:Greg Clayton2012-01-301-0/+255
| | | | | | | | | | | | | | | | | | | | | | | | | sbvalue.value (<SBValue>) sbvalue.variable (<SBValue>) Initialize both with a lldb.SBValue sbvalue.value() make all sorts of convenience properties. Type "help(sbvalue.value)" in the embedded python interpreter to see what is available. sbvalue.variable() wraps a lldb.SBValue and allows you to play with your variable just as you would expect: pt = sbvalue.variable (lldb.frame.FindVariable("pt")) print pt.x print py.y argv = sbvalue.variable (lldb.frame.FindVariable("argv")) print argv[0] Member access and array acccess is all taken care of! llvm-svn: 149260
* Added a 'gdbremote' python module that adds two commands: start_gdb_log and ↵Greg Clayton2012-01-262-4/+188
| | | | | | | | | | | | | | | end_gdb_log. When this is imported into your lldb using the "command script import /path/to/gdbremote.py" these new commands are available within LLDB. 'start_gdb_log' will enable logging with timestamps for GDB remote packets, and 'stop_gdb_log' will then dump the details and also a lot of packet timing data. This allows us to accurately track what packets are taking up the most time when debugging (when using the ProcessGDBRemote debugging plug-in). Also udpated the comments at the top of the cmdtemplate.py to show how to correctly import the module from within LLDB. llvm-svn: 149030
* Proof-reading the python docs.Jim Ingham2012-01-241-5/+6
| | | | llvm-svn: 148768
* Added a python FAQ page with detailed examples of how to add python functionsGreg Clayton2012-01-221-0/+49
| | | | | | | to breakpoints, creating new LLDB commands using python modules and also how to run scripts from the command line. llvm-svn: 148650
OpenPOWER on IntegriCloud