summaryrefslogtreecommitdiffstats
path: root/lldb/source/DataFormatters
Commit message (Collapse)AuthorAgeFilesLines
* Fix a bug where language categories would hold on to their caches even after ↵Enrico Granata2015-12-152-4/+22
| | | | | | changes llvm-svn: 255603
* Fix a bug where one-lining display of child values would ignore the user's ↵Enrico Granata2015-12-011-1/+1
| | | | | | choice of format llvm-svn: 254349
* Reapply r253423 and r253424 (which cleanup the data formatters iteration ↵Enrico Granata2015-11-183-56/+2
| | | | | | model, as well as the type X list commands), along with a change by Zachary Turner to bypass a MSVC bug with SFINAE llvm-svn: 253493
* Revert 2 commits breaking the MSVC buildTamas Berghammer2015-11-183-2/+56
| | | | | | | | | | Revert "Remove a few vestigial typedefs from the old world" This reverts commit 05872cda2a00fbd988c4fc761b1f87fe9edce224. Revert "Cleanup the type X list commands to use the new ForEach goodness" This reverts commit 85b1d83819a22cdc9ef12f58fd4fa92b473a4f81. llvm-svn: 253455
* Cleanup the type X list commands to use the new ForEach goodnessEnrico Granata2015-11-183-56/+2
| | | | llvm-svn: 253423
* The existing logic to loop over formatters is very pre-C++11, using void* ↵Enrico Granata2015-11-143-0/+54
| | | | | | | | | batons, and function pointers, and raw memory allocations instead of safer more modern constructs This is a first pass at a cleanup of that code, modernizing the "type X clear" commands, and providing the basic infrastructure I plan to use all over More cleanup will come over the next few days llvm-svn: 253125
* Upstream some data formatter related cleanupsEnrico Granata2015-11-131-7/+18
| | | | llvm-svn: 253093
* Fix indentationEnrico Granata2015-11-131-21/+21
| | | | llvm-svn: 253089
* Introduce a way for Languages to specify whether values of "reference types" ↵Enrico Granata2015-11-101-7/+22
| | | | | | | | | | are "nil" (not pointing to anything) or uninitialized (never made to point at anything) This latter determination may or may not be possible on a per-language basis; and neither is mandatory to implement for any language Use this knowledge in the ValueObjectPrinter to generalize the notion of IsObjCNil() and the respective printout llvm-svn: 252663
* Upstream changes to the ValueObjectPrinter; nfcEnrico Granata2015-11-102-43/+147
| | | | llvm-svn: 252638
* Extend the TypeSystem's ShouldPrintAsOneLiner implementation so that the ↵Enrico Granata2015-11-091-1/+18
| | | | | | ValueObject itself also gets a say in the process; NFC llvm-svn: 252516
* Fix an issue where LLDB would truncate summaries for string types without ↵Enrico Granata2015-11-041-4/+28
| | | | | | producing any evidence thereof llvm-svn: 252018
* All instance variables start with "m_". Fix "options" to be "m_options".Greg Clayton2015-11-031-56/+56
| | | | llvm-svn: 252013
* Add a --language (-l) option to the formatter delete commands in order to ↵Enrico Granata2015-10-291-0/+8
| | | | | | | | | allow removing formatters from language categories This is slightly harder to test because formatters cannot be added to language categories, so deletions are irreversible (in a debugger run) I plan to add a test case soon, but I need to think about the right approach to obtain one llvm-svn: 251660
* Remove an unused local variableEnrico Granata2015-10-281-1/+0
| | | | llvm-svn: 251581
* Fix Clang-tidy modernize-use-override warnings in some files in source; ↵Eugene Zelenko2015-10-261-23/+27
| | | | | | other minor fixes. llvm-svn: 251309
* [SBValue] Add a method GetNumChildren(uint32_t max)Siva Chandra2015-10-211-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Along with this, support for an optional argument to the "num_children" method of a Python synthetic child provider has also been added. These have been added with the following use case in mind: Synthetic child providers currently have a method "has_children" and "num_children". While the former is good enough to know if there are children, it does not give any insight into how many children there are. Though the latter serves this purpose, calculating the number for children of a data structure could be an O(N) operation if the data structure has N children. The new method added in this change provide a middle ground. One can call GetNumChildren(K) to know if a child exists at an index K which can be as large as the callers tolerance can be. If the caller wants to know about children beyond K, it can make an other call with 2K. If the synthetic child provider maintains state about it counting till K previosly, then the next call is only an O(K) operation. Infact, all calls made progressively with steps of K will be O(K) operations. Reviewers: vharron, clayborg, granata.enrico Subscribers: labath, lldb-commits Differential Revision: http://reviews.llvm.org/D13778 llvm-svn: 250930
* Rationalization of includes in the data formatters codeEnrico Granata2015-10-2010-24/+14
| | | | llvm-svn: 250798
* Introduce the concept of a type that is meaningless without dynamic ↵Enrico Granata2015-10-201-18/+12
| | | | | | | | resolution, which are essentially placeholder types meant to appease a language's type system but do not offer any actual information to the debugger, unless further resolved This is currently meant for data formatters to know to ignore such types in caching and lookup llvm-svn: 250767
* Let Language plugins vend a default DeclPrintingHelper in case a custom one ↵Enrico Granata2015-10-193-11/+253
| | | | | | is not specified for the specific invocation llvm-svn: 250744
* Silence -Wreturn-type with gcc 5.2Saleem Abdulrasool2015-10-181-0/+1
| | | | | | The switch is fully covered, mark "default" as unreachable. NFC. llvm-svn: 250667
* Silence -Wqual-cast warnings from GCC 5.2Saleem Abdulrasool2015-10-181-2/+2
| | | | | | | | There were a number of const qualifiers being cast away which caused warnings. This cluttered the output hiding real errors. Silence them by explicit casting. NFC. llvm-svn: 250662
* Teach an old pony a few new tricks.Enrico Granata2015-10-171-25/+81
| | | | | | | | ValueObjectPrinter can now mask out pointer values during a printout; also, it supports helper functions to print declarations in different formats if needed Practically speaking however, this change is NFC as nothing yet uses it in the codebase llvm-svn: 250599
* Move TypeSummaryImpl over to LLVM-style RTTI for subclassingEnrico Granata2015-10-161-8/+10
| | | | llvm-svn: 250567
* Resubmit: RenderScript command for printing allocation contents Ewan Crawford2015-10-161-0/+2
| | | | | | | | | Previous commit r250281 broke TestDataFormatterSmartArray.py Resolved in in this patch by adding the new enum eFormatVectorOfFloat16 to FormatManager. Differential Revision: http://reviews.llvm.org/D13730 llvm-svn: 250499
* Fix build with python disabled after r249597Keno Fischer2015-10-161-5/+0
| | | | | | | | | | | | | | | Summary: r249597 introduced a usage of GetTypeSummary in lldb-mi. That function used to only be available when python is enabled. However, there is no reason for that anymore since that is now dealt with at a different abstraction layer. Reviewers: ki.stfu, evgeny777, clayborg, granata.enrico Subscribers: elehcim, brucem, lldb-commits Differential Revision: http://reviews.llvm.org/D13577 llvm-svn: 250494
* Route the preferred-display-language mechanism to the ValueObjectPrinter and ↵Enrico Granata2015-10-071-2/+3
| | | | | | actually fill in a few gaps for dynamic and synthetic values to be able to adopt this in useful ways llvm-svn: 249507
* Enable the StringPrinter to have prefixes that are strings instead of just a ↵Enrico Granata2015-10-071-5/+12
| | | | | | single character; and also introduce a comparable suffix mechanism llvm-svn: 249506
* Introduce a variant of GetSummaryAsCString() that takes a LanguageType ↵Enrico Granata2015-10-071-2/+5
| | | | | | | | argument, and use it when crafting summaries by running selectors This is the first in a series of commits that are meant to teach LLDB how to properly handle multi-language formatting of values llvm-svn: 249503
* Create a logging category that is specific to data formatters activityEnrico Granata2015-10-062-8/+8
| | | | llvm-svn: 249433
* Introduce a FormattersMatchData class which contains all the information ↵Enrico Granata2015-10-064-150/+177
| | | | | | | | that data formatters need in one place, and also allows for lazy computation of expensive chunks of information if need be This is a NFC commit that is essentially plumbing the new currency through the system llvm-svn: 249366
* Made GetScratchTypeSystemForLanguage return an error if desired.Sean Callanan2015-10-021-1/+1
| | | | | | | Also made it not store nullptrs in its TypeSystemMap, so it will retry to make the AST context if it errored out last time. llvm-svn: 249167
* Fix evaluation of unicode character arrays (char16_t[] and char32_t[])Dawn Perchik2015-09-251-0/+13
| | | | | | | | | | | | | | | | Suppose we have the UTF-16 string: char16_t[] s = u"hello"; Before this patch, evaluating the string in lldb would get: (char16_t [6]) $0 = ([0] = U+0068 u'h', [1] = U+0065 u'e', [2] = U+006c u'l', [3] = U+006c u'l', [4] = U+006f u'o', [5] = U+0000 u'\0') After applying the patch, we now get: (char16_t [6]) $0 = u"hello" Patch from evgeny.leviant@gmail.com Reviewed by: granata.enrico Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13053 llvm-svn: 248555
* Fix covered-switch-default warning in FormatManager.Bruce Mitchener2015-09-231-1/+0
| | | | | | | | | | | | | | | | Summary: The default case doesn't need to be here as the switch covers all possible values. If there's a new "lazy bool" value added in the future, the compiler would start to warn about the new case not being covered. Reviewers: granata.enrico, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13084 llvm-svn: 248365
* Allow CompilerType to express a vote on whether oneliner printing should happenEnrico Granata2015-09-231-0/+17
| | | | llvm-svn: 248363
* Add {TypeSystem|CompilerType}::GetTypeForFormatters()Enrico Granata2015-09-231-1/+1
| | | | | | | | | Different type system may have different notions of attributes of a type that do not matter for data formatters matching purposes For instance, in the case of clang types, we remove some qualifiers (e.g. "volatile") as it doesn't make much sense to differentiate volatile T from T in the data formatters This new API allows each type system to generate, if needed, a type that does not have those unwanted attributes that the data formatters can then consume to generate matches llvm-svn: 248359
* TypeSystem is now a plugin interface and removed any "ClangASTContext ↵Greg Clayton2015-09-172-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | &Class::GetClangASTContext()" functions. This cleans up type systems to be more pluggable. Prior to this we had issues: - Module, SymbolFile, and many others has "ClangASTContext &GetClangASTContext()" functions. All have been switched over to use "TypeSystem *GetTypeSystemForLanguage()" - Cleaned up any places that were using the GetClangASTContext() functions to use TypeSystem - Cleaned up Module so that it no longer has dedicated type system member variables: lldb::ClangASTContextUP m_ast; ///< The Clang AST context for this module. lldb::GoASTContextUP m_go_ast; ///< The Go AST context for this module. Now we have a type system map: typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> TypeSystemMap; TypeSystemMap m_type_system_map; ///< A map of any type systems associated with this module - Many places in code were using ClangASTContext static functions to place with CompilerType objects and add modifiers (const, volatile, restrict) and to make typedefs, L and R value references and more. These have been made into CompilerType functions that are abstract: class CompilerType { ... //---------------------------------------------------------------------- // Return a new CompilerType that is a L value reference to this type if // this type is valid and the type system supports L value references, // else return an invalid type. //---------------------------------------------------------------------- CompilerType GetLValueReferenceType () const; //---------------------------------------------------------------------- // Return a new CompilerType that is a R value reference to this type if // this type is valid and the type system supports R value references, // else return an invalid type. //---------------------------------------------------------------------- CompilerType GetRValueReferenceType () const; //---------------------------------------------------------------------- // Return a new CompilerType adds a const modifier to this type if // this type is valid and the type system supports const modifiers, // else return an invalid type. //---------------------------------------------------------------------- CompilerType AddConstModifier () const; //---------------------------------------------------------------------- // Return a new CompilerType adds a volatile modifier to this type if // this type is valid and the type system supports volatile modifiers, // else return an invalid type. //---------------------------------------------------------------------- CompilerType AddVolatileModifier () const; //---------------------------------------------------------------------- // Return a new CompilerType adds a restrict modifier to this type if // this type is valid and the type system supports restrict modifiers, // else return an invalid type. //---------------------------------------------------------------------- CompilerType AddRestrictModifier () const; //---------------------------------------------------------------------- // Create a typedef to this type using "name" as the name of the typedef // this type is valid and the type system supports typedefs, else return // an invalid type. //---------------------------------------------------------------------- CompilerType CreateTypedef (const char *name, const CompilerDeclContext &decl_ctx) const; }; Other changes include: - Removed "CompilerType TypeSystem::GetIntTypeFromBitSize(...)" and CompilerType TypeSystem::GetFloatTypeFromBitSize(...) and replaced it with "CompilerType TypeSystem::GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size);" - Fixed code in Type.h to not request the full type for a type for no good reason, just request the forward type and let the type expand as needed llvm-svn: 247953
* DataFormatters: Rename clang_type to compiler_type.Bruce Mitchener2015-09-173-21/+21
| | | | | | | | | | Reviewers: granata.enrico Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D12930 llvm-svn: 247915
* Add the ability for formatter categories to be bound to one or more languagesEnrico Granata2015-09-175-14/+164
| | | | | | What that does is it restricts formatters in those categories to only match to types coming from "compatible" source languages llvm-svn: 247872
* Move hardcoded formatters from the FormatManager to the Language pluginsEnrico Granata2015-09-162-98/+158
| | | | llvm-svn: 247831
* This patch makes Clang-independent base classes for all the expression types ↵Jim Ingham2015-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that lldb currently vends. Before we had: ClangFunction ClangUtilityFunction ClangUserExpression and code all over in lldb that explicitly made Clang-based expressions. This patch adds an Expression base class, and three pure virtual implementations for the Expression kinds: FunctionCaller UtilityFunction UserExpression You can request one of these expression types from the Target using the Get<ExpressionType>ForLanguage. The Target will then consult all the registered TypeSystem plugins, and if the type system that matches the language can make an expression of that kind, it will do so and return it. Because all of the real expression types need to communicate with their ExpressionParser in a uniform way, I also added a ExpressionTypeSystemHelper class that expressions generically can vend, and a ClangExpressionHelper that encapsulates the operations that the ClangExpressionParser needs to perform on the ClangExpression types. Then each of the Clang* expression kinds constructs the appropriate helper to do what it needs. The patch also fixes a wart in the UtilityFunction that to use it you had to create a parallel FunctionCaller to actually call the function made by the UtilityFunction. Now the UtilityFunction can be asked to vend a FunctionCaller that will run its function. This cleaned up a lot of boiler plate code using UtilityFunctions. Note, in this patch all the expression types explicitly depend on the LLVM JIT and IR, and all the common JIT running code is in the FunctionCaller etc base classes. At some point we could also abstract that dependency but I don't see us adding another back end in the near term, so I'll leave that exercise till it is actually necessary. llvm-svn: 247720
* Move Objective-C data formatters to the Objective-C language plugin where ↵Enrico Granata2015-09-1410-4335/+10
| | | | | | they belong llvm-svn: 247627
* Introduce the notion of an escape helper. Different languages have different ↵Enrico Granata2015-09-093-41/+83
| | | | | | | | notion of what to print in a string and how to escape non-printable things. The escape helper is where this notion is provided to LLDB This is NFC, other than a code re-org llvm-svn: 247200
* Preparatory work for letting language plugins help the StringPrinter with ↵Enrico Granata2015-09-092-105/+22
| | | | | | formatting special characters llvm-svn: 247189
* Fix some compiler warnings.Zachary Turner2015-09-091-0/+2
| | | | llvm-svn: 247164
* Data formatter candidate matches can be generated in a number of ways; ↵Enrico Granata2015-09-091-31/+12
| | | | | | | | | | language-based dynamic type discovery being one of them (for instance, this is what takes an 'id' and discovers that it truly is an __NSArrayI, so it should probably use the NSArray formatter) This used to be hardcoded in the FormatManager, but in a pluginized world that is not the right way to go So, move this step to the Language plugin such that appropriate language plugins for a type get a say about adding candidates to the formatters lookup tables llvm-svn: 247112
* Implement a Target::GetTypeSystemForLanguage API, as well as provide helpers ↵Enrico Granata2015-09-082-32/+35
| | | | | | on the TypeSystem to get numeric types of specific sizes and signedness llvm-svn: 247082
* Use LLVM casting for TypeSystem so you can cast it to subclasses.Greg Clayton2015-09-084-14/+19
| | | | | | | | | | | | | | This will keep our code cleaner and it removes the need for intrusive additions to TypeSystem like: class TypeSystem { virtual ClangASTContext * AsClangASTContext() = 0; } As you can now just use the llvm::dyn_cast and other casts. llvm-svn: 247041
* Add a --language (-l) option to type category {enable|disable} to allow ↵Enrico Granata2015-09-041-0/+14
| | | | | | people to turn on and off formatters for a given language llvm-svn: 246884
* Never mind, I see what the problem is on the Windows build. Attempt a fixEnrico Granata2015-09-041-1/+2
| | | | llvm-svn: 246876
OpenPOWER on IntegriCloud