summaryrefslogtreecommitdiffstats
path: root/lldb/test/functionalities/data-formatter
Commit message (Collapse)AuthorAgeFilesLines
...
* Adding formatters for several useful Objective-C/Cocoa data types. The new ↵Enrico Granata2012-02-175-40/+86
| | | | | | | | | | categories are not enabled at startup, but can be manually activated if desired. Adding new API calls to SBValue to be able to retrieve the associated formatters Some refactoring to FormatNavigator::Get() in order to shrink its size down to more manageable terms (a future, massive, refactoring effort will still be needed) Test cases added for the above llvm-svn: 150784
* Fixing issues where synthetic children providers for STL containers ↵Enrico Granata2012-02-032-8/+0
| | | | | | std::list and std::map where not doing their job properly llvm-svn: 149700
* Added a new --omit-names (-O, uppercase letter o) option to "type summary add".Enrico Granata2012-02-023-0/+120
| | | | | | | | | | When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from ([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4). Added a test case to check that the new option works correctly. Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability. Finally, added a new class name to which the std::string summary should be applied. llvm-svn: 149644
* Add @expectedFailure decorators.Johnny Chen2012-02-011-2/+2
| | | | llvm-svn: 149519
* remove spurious leftover code from std::list testcaseEnrico Granata2012-02-011-268/+4
| | | | llvm-svn: 149461
* Test case for std::map synthetic children provider (currently an expected ↵Enrico Granata2012-01-313-0/+377
| | | | | | failure) llvm-svn: 149421
* Test case for std::list synthetic children provider (currently an expected ↵Enrico Granata2012-01-313-0/+491
| | | | | | failure) llvm-svn: 149420
* Test case for std::vector synthetic children providerEnrico Granata2012-01-313-0/+252
| | | | llvm-svn: 149419
* Splitting test case for Python synthetic children: part 1 test is only ↵Enrico Granata2012-01-315-895/+6
| | | | | | testing the synthetic children feature itself. More test cases will be commited for individual STL containers llvm-svn: 149393
* Added support to the Objective-C language runtimeSean Callanan2011-11-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | to find Objective-C class types by looking in the symbol tables for the individual object files. I did this as follows: - I added code to SymbolFileSymtab that vends Clang types for symbols matching the pattern "_OBJC_CLASS_$_NSMyClassName," making them appear as Objective-C classes. This only occurs in modules that do not have debug information, since otherwise SymbolFileDWARF would be in charge of looking up types. - I made a new SymbolVendor subclass for the Apple Objective-C runtime that is in charge of making global lookups of Objective-C types. It currently just sends out type lookup requests to the appropriate SymbolFiles, but in the future we will probably extend it to query the runtime more completely. I also modified a testcase whose behavior is changed by the fact that we now actually return an Objective-C type for __NSCFString. llvm-svn: 145526
* Fixed an issue where we might cause our test suite to exit if we end upGreg Clayton2011-11-281-1/+1
| | | | | | | concatenating a string with "None" in python. Using a python format string gets us around this by handling it gracefully. llvm-svn: 145225
* Added support for the new ".apple_objc" accelerator tables. These tables areGreg Clayton2011-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the same hashed format as the ".apple_names", but they map objective C class names to all of the methods and class functions. We need to do this because in the DWARF the methods for Objective C are never contained in the class definition, they are scattered about at the translation unit level and they don't even have attributes that say the are contained within the class itself. Added 3 new formats which can be used to display data: eFormatAddressInfo eFormatHexFloat eFormatInstruction eFormatAddressInfo describes an address such as function+offset and file+line, or symbol + offset, or constant data (c string, 2, 4, 8, or 16 byte constants). The format character for this is "A", the long format is "address". eFormatHexFloat will print out the hex float format that compilers tend to use. The format character for this is "X", the long format is "hex float". eFormatInstruction will print out disassembly with bytes and it will use the current target's architecture. The format character for this is "i" (which used to be being used for the integer format, but the integer format also has "d", so we gave the "i" format to disassembly), the long format is "instruction". Mate the lldb::FormatterChoiceCriterion enumeration private as it should have been from the start. It is very specialized and doesn't belong in the public API. llvm-svn: 143114
* Add two new @expectedFailure decorators.Johnny Chen2011-10-241-0/+4
| | | | | | rdar://problem/10334911 llvm-svn: 142839
* Fixed a problem with the IR interpreter that causedSean Callanan2011-09-221-2/+0
| | | | | | | | | | | | it to generate result variables that were not bound to their underlying data. This allowed the SBValue class to use the interpreter (if possible). Also made sure that any result variables that point to stack allocations in the stack frame of the interpreted expressions do not get live data. llvm-svn: 140285
* Add four new expectedFailre decorators to new failures most likely due to ↵Johnny Chen2011-09-201-0/+4
| | | | | | r139772 check-in. llvm-svn: 140150
* Redesign of the interaction between Python and frozen objects:Enrico Granata2011-09-063-19/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored in frozen objects ; now such reads transparently move from host to target as required - as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also removed code that enabled to recognize an expression result VO as such - introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO representing a T* or T[], and doing dereferences transparently in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData - as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it en lieu of doing the raw read itself - introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers, this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory) in public layer this returns an SBData, just like GetPointeeData() - introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values - added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing Solved a bug where global pointers to global variables were not dereferenced correctly for display New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128 Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file addresses that generate file address children UNLESS we have a live process) Updated help text for summary-string Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers Edited the syntax and help for some commands to have proper argument types llvm-svn: 139160
* Uniquefy the various data-formatter test class names so that:Johnny Chen2011-08-2314-14/+14
| | | | | | | | ./dotest.py -v -f DataFormatterTestCase.test_with_dsym_and_run_command will not end up running 14 tests. llvm-svn: 138399
* Improved the user-friendliness of errors shown by the summary feature in ↵Enrico Granata2011-08-233-0/+181
| | | | | | | | | | | | certain areas Renamed format "signed decimal" to be "decimal". "unsigned decimal" remains unchanged: - the name "signed decimal" was interfering with symbol %S (use summary) in summary strings. because of the way summary strings are implemented, this did not really lead to a bug, but simply to performing more steps than necessary to display a summary. this is fixed. Documentation improvements (more on synthetic children, some information on filters). This is still a WIP. llvm-svn: 138384
* Short option for --summary-string in 'type summary add' is now -s. This ↵Enrico Granata2011-08-2313-123/+122
| | | | | | might be a breaking change for those who have summaries defined. llvm-svn: 138331
* Additional code cleanups ; Short option name for --python-script in type ↵Enrico Granata2011-08-234-8/+8
| | | | | | summary add moved from -s to -o (this is a preliminary step in moving the short option for --summary-string from -f to -s) ; Accordingly updated the test suite llvm-svn: 138315
* Taking care of an issue with using lldb_private types in ↵Enrico Granata2011-08-191-2/+2
| | | | | | SBCommandInterpreter.cpp ; Making NSString test case work on Snow Leopard ; Removing an unused variable warning llvm-svn: 138105
* - Now using ${var} as the summary for an aggregate type will produce ↵Enrico Granata2011-08-195-2/+165
| | | | | | | | | | | | | | | | "name-of-type @ object-location" instead of giving an error e.g. you may get "foo_class @ 0x123456" when typing "type summary add -f ${var} foo_class" - Added a new special formatting token %T for summaries. This shows the type of the object. Using it, the new "type @ location" summary could be manually generated by writing ${var%T} @ ${var%L} - Bits and pieces required to support "frame variable array[n-m]" The feature is not enabled yet because some additional design and support code is required, but the basics are getting there - Fixed a potential issue where a ValueObjectSyntheticFilter was not holding on to its SyntheticChildrenSP Because of the way VOSF are being built now, this has never been an actual issue, but it is still sensible for a VOSF to hold on to the SyntheticChildrenSP as well as to its FrontEnd llvm-svn: 138080
* More thorough fix for the spaces-in-typename issueEnrico Granata2011-08-191-1/+2
| | | | llvm-svn: 138026
* Third round of code cleanups:Enrico Granata2011-08-191-0/+28
| | | | | | | | | | | - reorganizing the PTS (Partial Template Specializations) in FormatManager.h - applied a patch by Filipe Cabecinhas to make LLDB compile with GCC Functional changes: - fixed an issue where command type summary add for type "struct Foo" would not match any types. currently, "struct" will be stripped off and type "Foo" will be matched. similar behavior occurs for class, enum and union specifiers. llvm-svn: 138020
* Second round of code cleanups:Enrico Granata2011-08-184-5/+114
| | | | | | | | | | | | | | | - reorganizing classes layout to have public part first Typedefs that we want to keep private, but must be defined for some public code to work correctly are an exception - avoiding methods in the form T foo() { code; } all on one-line - moving method implementations from .h to .cpp whenever feasible Templatized code is an exception and so are very small methods - generally, adhering to coding conventions followed project-wide Functional changes: - fixed an issue where using ${var} in a summary for an aggregate, and then displaying a pointer-to-aggregate would lead to no summary being displayed The issue was not a major one because all ${var} was meant to do in that context was display an error for invalid use of pointer Accordingly fixed test cases and added a new test case llvm-svn: 137944
* First round of code cleanups:Enrico Granata2011-08-171-1/+1
| | | | | | | | | | | | | | | | | | - all instances of "vobj" have been renamed to "valobj" - class Debugger::Formatting has been renamed to DataVisualization (defined in FormatManager.h/cpp) The interface to this class has not changed - FormatCategory now uses ConstString's as keys to the navigators instead of repeatedly casting from ConstString to const char* and back all the time Next step is making the same happen for categories themselves - category gnu-libstdc++ is defined in the constructor for a FormatManager The source code for it is defined in gnu_libstdcpp.py, drawn from examples/synthetic at compile time All references to previous 'osxcpp' name have been removed from both code and file names Functional changes: - the name of the option to use a summary string for 'type summary add' has changed from the previous --format-string to the new --summary-string. It is expected that the short option will change from -f to -s, and -s for --python-script will become -o llvm-svn: 137886
* New category "gnu-libstdc++" provides summary for std::string and synthetic ↵Enrico Granata2011-08-171-7/+7
| | | | | | | | | | children for types std::map, std::list and std::vector The category is enabled by default. If you run into issues with it, disable it and the previous behavior of LLDB is restored ** This is a temporary solution. The general solution to having formatters pulled in at startup should involve going through the Platform. Fixed an issue in type synthetic list where a category with synthetic providers in it was not shown if all the providers were regex-based llvm-svn: 137850
* Added an error message when the user tries to add a filter when a synthetic ↵Enrico Granata2011-08-121-19/+40
| | | | | | | | provider for the same type is already defined in the same category The converse is also true: an error is shown when the user tries to add a synthetic provider to a category that already has a filter for the same type llvm-svn: 137493
* *Some more optimizations in usage of ConstStringEnrico Granata2011-08-125-15/+223
| | | | | | | | | | | | *New setting target.max-children-count gives an upper-bound to the number of child objects that will be displayed at each depth-level This might be a breaking change in some scenarios. To override the new limit you can use the --show-all-children (-A) option to frame variable or increase the limit in your lldbinit file *Command "type synthetic" has been split in two: - "type synthetic" now only handles Python synthetic children providers - the new command "type filter" handles filters Because filters and synthetic providers are both ways to replace the children of a ValueObject, only one can be effective at any given time. llvm-svn: 137416
* Fixed an issue where a pointer's address was being logged instead of its valueEnrico Granata2011-08-112-3/+45
| | | | | | | | | | | | | Access to synthetic children by name: if your object has a synthetic child named foo you can now type frame variable object.foo (or ->foo if you have a pointer) and that will print the value of the synthetic child (if your object has an actual child named foo, the actual child prevails!) this behavior should also work in summaries, and you should be able to use ${var.foo} and ${svar.foo} interchangeably (but using svar.foo will mask an actual child named foo) llvm-svn: 137314
* CFString.py now shows contents in a more NSString-like way (e.g. you get ↵Enrico Granata2011-08-092-9/+20
| | | | | | | | | | @"Hello" instead of "Hello") new --raw-output (-R) option to frame variable prevents using summaries and synthetic children other future formatting enhancements will be excluded by using the -R option test case enhanced to check that -R works correctly llvm-svn: 137185
* Basic support for reading synthetic children by index:Enrico Granata2011-08-091-0/+86
| | | | | | | | | | | if your datatype provides synthetic children, "frame variable object[index]" should now do the right thing in cases where the above syntax would have been rejected before, i.e. object is not a pointer nor an array (frame variable ignores potential overload of []) object is a pointer to an Objective-C class (which cannot be dereferenced) expression will still run operator[] if available and complain if it cannot do so synthetic children by name do not work yet llvm-svn: 137097
* Option --regex (-x) now also works for synthetic children:Enrico Granata2011-08-052-12/+13
| | | | | | | - Added a test case in python-synth Minor code improvements in categories, making them ready for adding new element types llvm-svn: 136957
* changing CFString.py to reflect the new behavior of CreateValueFromAddressEnrico Granata2011-08-041-1/+1
| | | | llvm-svn: 136887
* New formatting symbol %# can be used in summary strings to get the "count of ↵Enrico Granata2011-08-044-86/+88
| | | | | | | | | | | | children" of a variable - accordingly, the test cases for the synthetic providers for the std:: containers have been edited to use ${svar%#} instead of ${svar.len} to print out the count of elements ; the .len synthetic child has been removed from the synthetic providers The synthetic children providers for the std:: containers now return None when asked for children indexes >= num_children() Basic code to support filter names based on regular expressions (WIP) llvm-svn: 136862
* APIs to GetValueAsSigned/Unsigned() in SBValue now also accept an SBError ↵Enrico Granata2011-08-044-13/+13
| | | | | | | | | parameter to give more info about any problem The synthetic children providers now use the new (safer) APIs to get the values of objects As a side effect, fixed an issue in ValueObject where ResolveValue() was not always updating the value before reading it llvm-svn: 136861
* testing for a previous issue where formats in summaries where not enforced ↵Enrico Granata2011-08-032-0/+20
| | | | | | in all cases ; removed an unused local variable llvm-svn: 136785
* Fixed an issue where the KVO swizzled type would be returned as the dynamic ↵Enrico Granata2011-08-031-1/+4
| | | | | | | | | | type instead of the actual user-level type - see the test case in lang/objc/objc-dynamic-value for an example Objective-C dynamic type lookup now works for every Objective-C type - previously, true dynamic lookup was only performed for type id llvm-svn: 136763
* Fixed a bug where a variable could not be formatted in a summary if its ↵Enrico Granata2011-08-023-3/+24
| | | | | | | | | | | | | datatype already had a custom format Fixed a bug where Objective-C variables coming out of the expression parser could crash the Python synthetic providers: - expression parser output has a "frozen data" component, which is a byte-exact copy of the value (in host memory), if trying to read into memory based on the host address, LLDB would crash. we are now passing the correct (target) pointer to the Python code Objective-C "id" variables are now formatted according to their dynamic type, if the -d option to frame variable is used: - Code based on the Objective-C 2.0 runtime is used to obtain this information without running code on the target llvm-svn: 136695
* Protect a bit against uninitialized std::list objects, but there is moreGreg Clayton2011-07-301-26/+33
| | | | | | work to be done. llvm-svn: 136579
* Protect a bit better against uninitialized vectors.Greg Clayton2011-07-301-8/+38
| | | | llvm-svn: 136578
* Cleaned up the NSString summary formatter to not print "<invalid object>" whenGreg Clayton2011-07-302-13/+30
| | | | | | | we have a nil NSString *. Also added blank lines between functions in the CFString.py files. llvm-svn: 136554
* changes in the new GetMinimumLanguages() ; robustness improvements in the ↵Enrico Granata2011-07-293-17/+33
| | | | | | CFStringSynthProvider object ; made a CFString_SummaryProvider function you can use if all you care about is the summary string for your NSString objects llvm-svn: 136544
* new synthetic children provider for CFString and related classes ; test case ↵Enrico Granata2011-07-293-3/+371
| | | | | | for it llvm-svn: 136525
* Public API changes:Enrico Granata2011-07-297-10/+710
| | | | | | | | | | | | | | | | | | | | | - Completely new implementation of SBType - Various enhancements in several other classes Python synthetic children providers for std::vector<T>, std::list<T> and std::map<K,V>: - these return the actual elements into the container as the children of the container - basic template name parsing that works (hopefully) on both Clang and GCC - find them in examples/synthetic and in the test suite in functionalities/data-formatter/data-formatter-python-synth New summary string token ${svar : - the syntax is just the same as in ${var but this new token lets you read the values coming from the synthetic children provider instead of the actual children - Python providers above provide a synthetic child len that returns the number of elements into the container Full bug fix for the issue in which getting byte size for a non-complete type would crash LLDB Several other fixes, including: - inverted the order of arguments in the ClangASTType constructor - EvaluationPoint now only returns SharedPointer's to Target and Process - the help text for several type subcommands now correctly indicates argument-less options as such llvm-svn: 136504
* new flag -P to type synth add lets you type a Python class interactivelyEnrico Granata2011-07-251-1/+1
| | | | | | | | added a final newline to fooSynthProvider.py new option to automatically save user input in InputReaderEZ checking for NULL pointers in several new places llvm-svn: 135916
* Python synthetic children:Enrico Granata2011-07-244-0/+169
| | | | | | | | | | | | | | - you can now define a Python class as a synthetic children producer for a type the class must adhere to this "interface": def __init__(self, valobj, dict): def get_child_at_index(self, index): def get_child_index(self, name): then using type synth add -l className typeName (e.g. type synth add -l fooSynthProvider foo) (This is still WIP with lots to be added) A small test case is available also as reference llvm-svn: 135865
* some editing of data visualization error messages to make them more meaningfulEnrico Granata2011-07-221-2/+3
| | | | | | | debugging printfs() for data visualization turned into a meaningful log: - introduced a new log category `types' in channel `lldb' llvm-svn: 135773
* when typing a summary string you can use the %S symbol to explicitly ↵Enrico Granata2011-07-226-1/+327
| | | | | | | | | | | | | | | indicate that you want the summary to be used to print the target object (e.g. ${var%S}). this might already be the default if your variable is of an aggregate type new feature: synthetic filters. you can restrict the number of children for your variables to only a meaningful subset - the restricted list of children obeys the typical rules (e.g. summaries prevail over children) - one-line summaries show only the filtered (synthetic) children, if you type an expanded summary string, or you use Python scripts, all the real children are accessible - to provide a synthetic children list use the "type synth add" command, as in: type synth add foo_type --child varA --child varB[0] --child varC->packet->flags[1-4] (you can use ., ->, single-item array operator [N] and bitfield operator [N-M]; array slice access is not supported, giving simplified names to expression paths is not supported) - a new -S option to frame variable and target variable lets you override synthetic children and instead show real ones llvm-svn: 135731
* Skip the remaining -Y? (skipping ? layers of summaries) tests if using a ↵Johnny Chen2011-07-201-0/+16
| | | | | | | | known version of Apple gcc build which produces wrong namespace for std::string in debug info. llvm-svn: 135597
OpenPOWER on IntegriCloud