2016-11-17 05:15:24 +08:00
|
|
|
//===-- FormatManager.cpp ----------------------------------------*- C++-*-===//
|
2011-06-24 01:59:56 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2011-06-24 01:59:56 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-01-29 07:47:25 +08:00
|
|
|
#include "lldb/DataFormatters/FormatManager.h"
|
2011-06-24 01:59:56 +08:00
|
|
|
|
2015-10-20 12:50:09 +08:00
|
|
|
#include "llvm/ADT/STLExtras.h"
|
|
|
|
|
2011-06-24 01:59:56 +08:00
|
|
|
|
2011-07-15 10:26:42 +08:00
|
|
|
#include "lldb/Core/Debugger.h"
|
2015-09-02 09:21:31 +08:00
|
|
|
#include "lldb/DataFormatters/FormattersHelpers.h"
|
2015-09-02 02:22:39 +08:00
|
|
|
#include "lldb/DataFormatters/LanguageCategory.h"
|
2013-01-29 07:47:25 +08:00
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
2015-09-05 05:01:18 +08:00
|
|
|
#include "lldb/Target/Language.h"
|
2017-03-04 04:56:28 +08:00
|
|
|
#include "lldb/Utility/Log.h"
|
2015-09-02 02:22:39 +08:00
|
|
|
|
2011-06-24 01:59:56 +08:00
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
2015-09-02 09:21:31 +08:00
|
|
|
using namespace lldb_private::formatters;
|
2011-06-24 05:22:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
struct FormatInfo {
|
|
|
|
Format format;
|
|
|
|
const char format_char; // One or more format characters that can be used for
|
|
|
|
// this format.
|
|
|
|
const char *format_name; // Long format name that can be used to specify the
|
|
|
|
// current format
|
2011-06-24 05:22:24 +08:00
|
|
|
};
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
static FormatInfo g_format_infos[] = {
|
|
|
|
{eFormatDefault, '\0', "default"},
|
|
|
|
{eFormatBoolean, 'B', "boolean"},
|
|
|
|
{eFormatBinary, 'b', "binary"},
|
|
|
|
{eFormatBytes, 'y', "bytes"},
|
|
|
|
{eFormatBytesWithASCII, 'Y', "bytes with ASCII"},
|
|
|
|
{eFormatChar, 'c', "character"},
|
|
|
|
{eFormatCharPrintable, 'C', "printable character"},
|
|
|
|
{eFormatComplexFloat, 'F', "complex float"},
|
|
|
|
{eFormatCString, 's', "c-string"},
|
|
|
|
{eFormatDecimal, 'd', "decimal"},
|
|
|
|
{eFormatEnum, 'E', "enumeration"},
|
|
|
|
{eFormatHex, 'x', "hex"},
|
|
|
|
{eFormatHexUppercase, 'X', "uppercase hex"},
|
|
|
|
{eFormatFloat, 'f', "float"},
|
|
|
|
{eFormatOctal, 'o', "octal"},
|
|
|
|
{eFormatOSType, 'O', "OSType"},
|
|
|
|
{eFormatUnicode16, 'U', "unicode16"},
|
|
|
|
{eFormatUnicode32, '\0', "unicode32"},
|
|
|
|
{eFormatUnsigned, 'u', "unsigned decimal"},
|
|
|
|
{eFormatPointer, 'p', "pointer"},
|
|
|
|
{eFormatVectorOfChar, '\0', "char[]"},
|
|
|
|
{eFormatVectorOfSInt8, '\0', "int8_t[]"},
|
|
|
|
{eFormatVectorOfUInt8, '\0', "uint8_t[]"},
|
|
|
|
{eFormatVectorOfSInt16, '\0', "int16_t[]"},
|
|
|
|
{eFormatVectorOfUInt16, '\0', "uint16_t[]"},
|
|
|
|
{eFormatVectorOfSInt32, '\0', "int32_t[]"},
|
|
|
|
{eFormatVectorOfUInt32, '\0', "uint32_t[]"},
|
|
|
|
{eFormatVectorOfSInt64, '\0', "int64_t[]"},
|
|
|
|
{eFormatVectorOfUInt64, '\0', "uint64_t[]"},
|
|
|
|
{eFormatVectorOfFloat16, '\0', "float16[]"},
|
|
|
|
{eFormatVectorOfFloat32, '\0', "float32[]"},
|
|
|
|
{eFormatVectorOfFloat64, '\0', "float64[]"},
|
|
|
|
{eFormatVectorOfUInt128, '\0', "uint128_t[]"},
|
|
|
|
{eFormatComplexInteger, 'I', "complex integer"},
|
|
|
|
{eFormatCharArray, 'a', "character array"},
|
|
|
|
{eFormatAddressInfo, 'A', "address"},
|
|
|
|
{eFormatHexFloat, '\0', "hex float"},
|
|
|
|
{eFormatInstruction, 'i', "instruction"},
|
|
|
|
{eFormatVoid, 'v', "void"}};
|
2011-06-24 05:22:24 +08:00
|
|
|
|
2014-06-27 13:17:41 +08:00
|
|
|
static uint32_t g_num_format_infos = llvm::array_lengthof(g_format_infos);
|
2011-06-24 05:22:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
static bool GetFormatFromFormatChar(char format_char, Format &format) {
|
|
|
|
for (uint32_t i = 0; i < g_num_format_infos; ++i) {
|
|
|
|
if (g_format_infos[i].format_char == format_char) {
|
|
|
|
format = g_format_infos[i].format;
|
|
|
|
return true;
|
2011-06-24 05:22:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
format = eFormatInvalid;
|
|
|
|
return false;
|
2011-06-24 05:22:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
static bool GetFormatFromFormatName(const char *format_name,
|
|
|
|
bool partial_match_ok, Format &format) {
|
|
|
|
uint32_t i;
|
|
|
|
for (i = 0; i < g_num_format_infos; ++i) {
|
|
|
|
if (strcasecmp(g_format_infos[i].format_name, format_name) == 0) {
|
|
|
|
format = g_format_infos[i].format;
|
|
|
|
return true;
|
2011-06-24 05:22:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (partial_match_ok) {
|
|
|
|
for (i = 0; i < g_num_format_infos; ++i) {
|
|
|
|
if (strcasestr(g_format_infos[i].format_name, format_name) ==
|
|
|
|
g_format_infos[i].format_name) {
|
|
|
|
format = g_format_infos[i].format;
|
|
|
|
return true;
|
|
|
|
}
|
2011-06-24 05:22:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
format = eFormatInvalid;
|
|
|
|
return false;
|
2011-06-24 05:22:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void FormatManager::Changed() {
|
|
|
|
++m_last_revision;
|
|
|
|
m_format_cache.Clear();
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
|
|
|
|
for (auto &iter : m_language_categories_map) {
|
|
|
|
if (iter.second)
|
|
|
|
iter.second->GetFormatCache().Clear();
|
|
|
|
}
|
2015-12-15 10:20:48 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool FormatManager::GetFormatFromCString(const char *format_cstr,
|
|
|
|
bool partial_match_ok,
|
|
|
|
lldb::Format &format) {
|
|
|
|
bool success = false;
|
|
|
|
if (format_cstr && format_cstr[0]) {
|
|
|
|
if (format_cstr[1] == '\0') {
|
|
|
|
success = GetFormatFromFormatChar(format_cstr[0], format);
|
|
|
|
if (success)
|
|
|
|
return true;
|
2011-06-24 05:22:24 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
success = GetFormatFromFormatName(format_cstr, partial_match_ok, format);
|
|
|
|
}
|
|
|
|
if (!success)
|
|
|
|
format = eFormatInvalid;
|
|
|
|
return success;
|
2011-06-24 05:22:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
char FormatManager::GetFormatAsFormatChar(lldb::Format format) {
|
|
|
|
for (uint32_t i = 0; i < g_num_format_infos; ++i) {
|
|
|
|
if (g_format_infos[i].format == format)
|
|
|
|
return g_format_infos[i].format_char;
|
|
|
|
}
|
|
|
|
return '\0';
|
2011-06-24 05:22:24 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const char *FormatManager::GetFormatAsCString(Format format) {
|
|
|
|
if (format >= eFormatDefault && format < kNumFormats)
|
|
|
|
return g_format_infos[format].format_name;
|
|
|
|
return NULL;
|
2011-06-24 05:22:24 +08:00
|
|
|
}
|
2011-07-02 08:25:22 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void FormatManager::EnableAllCategories() {
|
|
|
|
m_categories_map.EnableAllCategories();
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
|
|
|
|
for (auto &iter : m_language_categories_map) {
|
|
|
|
if (iter.second)
|
|
|
|
iter.second->Enable();
|
|
|
|
}
|
2015-09-05 05:01:18 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void FormatManager::DisableAllCategories() {
|
|
|
|
m_categories_map.DisableAllCategories();
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
|
|
|
|
for (auto &iter : m_language_categories_map) {
|
|
|
|
if (iter.second)
|
|
|
|
iter.second->Disable();
|
|
|
|
}
|
2015-09-05 05:01:18 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void FormatManager::GetPossibleMatches(
|
|
|
|
ValueObject &valobj, CompilerType compiler_type, uint32_t reason,
|
|
|
|
lldb::DynamicValueType use_dynamic, FormattersMatchVector &entries,
|
|
|
|
bool did_strip_ptr, bool did_strip_ref, bool did_strip_typedef,
|
|
|
|
bool root_level) {
|
|
|
|
compiler_type = compiler_type.GetTypeForFormatters();
|
|
|
|
ConstString type_name(compiler_type.GetConstTypeName());
|
|
|
|
if (valobj.GetBitfieldBitSize() > 0) {
|
|
|
|
StreamString sstring;
|
|
|
|
sstring.Printf("%s:%d", type_name.AsCString(), valobj.GetBitfieldBitSize());
|
2016-11-17 05:15:24 +08:00
|
|
|
ConstString bitfieldname(sstring.GetString());
|
2016-09-07 04:57:50 +08:00
|
|
|
entries.push_back(
|
|
|
|
{bitfieldname, 0, did_strip_ptr, did_strip_ref, did_strip_typedef});
|
|
|
|
reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField;
|
|
|
|
}
|
Introduce the concept of a "display name" for types
Rationale:
Pretty simply, the idea is that sometimes type names are way too long and contain way too many details for the average developer to care about. For instance, a plain ol' vector of int might be shown as
std::__1::vector<int, std::__1::allocator<....
rather than the much simpler std::vector<int> form, which is what most developers would actually type in their code
Proposed solution:
Introduce a notion of "display name" and a corresponding API GetDisplayTypeName() to return such a crafted for visual representation type name
Obviously, the display name and the fully qualified (or "true") name are not necessarily the same - that's the whole point
LLDB could choose to pick the "display name" as its one true notion of a type name, and if somebody really needs the fully qualified version of it, let them deal with the problem
Or, LLDB could rename what it currently calls the "type name" to be the "display name", and add new APIs for the fully qualified name, making the display name the default choice
The choice that I am making here is that the type name will keep meaning the same, and people who want a type name suited for display will explicitly ask for one
It is the less risky/disruptive choice - and it should eventually make it fairly obvious when someone is asking for the wrong type
Caveats:
- for now, GetDisplayTypeName() == GetTypeName(), there is no logic to produce customized display type names yet.
- while the fully-qualified type name is still the main key to the kingdom of data formatters, if we start showing custom names to people, those should match formatters
llvm-svn: 209072
2014-05-18 03:14:17 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
if (!compiler_type.IsMeaninglessWithoutDynamicResolution()) {
|
|
|
|
entries.push_back(
|
|
|
|
{type_name, reason, did_strip_ptr, did_strip_ref, did_strip_typedef});
|
2015-10-20 08:13:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
ConstString display_type_name(compiler_type.GetDisplayTypeName());
|
|
|
|
if (display_type_name != type_name)
|
|
|
|
entries.push_back({display_type_name, reason, did_strip_ptr,
|
|
|
|
did_strip_ref, did_strip_typedef});
|
|
|
|
}
|
Introduce the concept of a "display name" for types
Rationale:
Pretty simply, the idea is that sometimes type names are way too long and contain way too many details for the average developer to care about. For instance, a plain ol' vector of int might be shown as
std::__1::vector<int, std::__1::allocator<....
rather than the much simpler std::vector<int> form, which is what most developers would actually type in their code
Proposed solution:
Introduce a notion of "display name" and a corresponding API GetDisplayTypeName() to return such a crafted for visual representation type name
Obviously, the display name and the fully qualified (or "true") name are not necessarily the same - that's the whole point
LLDB could choose to pick the "display name" as its one true notion of a type name, and if somebody really needs the fully qualified version of it, let them deal with the problem
Or, LLDB could rename what it currently calls the "type name" to be the "display name", and add new APIs for the fully qualified name, making the display name the default choice
The choice that I am making here is that the type name will keep meaning the same, and people who want a type name suited for display will explicitly ask for one
It is the less risky/disruptive choice - and it should eventually make it fairly obvious when someone is asking for the wrong type
Caveats:
- for now, GetDisplayTypeName() == GetTypeName(), there is no logic to produce customized display type names yet.
- while the fully-qualified type name is still the main key to the kingdom of data formatters, if we start showing custom names to people, those should match formatters
llvm-svn: 209072
2014-05-18 03:14:17 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
for (bool is_rvalue_ref = true, j = true;
|
|
|
|
j && compiler_type.IsReferenceType(nullptr, &is_rvalue_ref); j = false) {
|
|
|
|
CompilerType non_ref_type = compiler_type.GetNonReferenceType();
|
|
|
|
GetPossibleMatches(
|
|
|
|
valobj, non_ref_type,
|
|
|
|
reason |
|
|
|
|
lldb_private::eFormatterChoiceCriterionStrippedPointerReference,
|
|
|
|
use_dynamic, entries, did_strip_ptr, true, did_strip_typedef);
|
|
|
|
if (non_ref_type.IsTypedefType()) {
|
|
|
|
CompilerType deffed_referenced_type = non_ref_type.GetTypedefedType();
|
|
|
|
deffed_referenced_type =
|
|
|
|
is_rvalue_ref ? deffed_referenced_type.GetRValueReferenceType()
|
|
|
|
: deffed_referenced_type.GetLValueReferenceType();
|
|
|
|
GetPossibleMatches(
|
|
|
|
valobj, deffed_referenced_type,
|
|
|
|
reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
|
|
|
|
use_dynamic, entries, did_strip_ptr, did_strip_ref,
|
|
|
|
true); // this is not exactly the usual meaning of stripping typedefs
|
<rdar://problem/15530080>
Rework data formatters matching algorithm
What happens now is that, for each category, the FormatNavigator generates all possible matches, and checks them one by one
Since the possible matches do not actually depend on the category (whether a match is accepted or not does, but that check can be shifted at a more convenient time),
it is actually feasible to generate every possible match upfront and then let individual categories just scan through those
This commit changes things by introducing a notion of formatters match candidate, and shifting responsibility for generating all of them given a (ValueObject,DynamicValueType) pair
from the FormatNavigator back to the FormatManager
A list of these candidates is then passed down to each category for matching
Candidates also need to remember whether they were generated by stripping pointers, references, typedefs, since this is something that individual formatters can choose to reject
This check, however, is conveniently only done once a "textual" match has been found, so that the list of candidates is truly category-independent
While the performance benefit is small (mostly, due to caching), this is much cleaner from a design perspective
llvm-svn: 195395
2013-11-22 08:02:13 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (compiler_type.IsPointerType()) {
|
|
|
|
CompilerType non_ptr_type = compiler_type.GetPointeeType();
|
|
|
|
GetPossibleMatches(
|
|
|
|
valobj, non_ptr_type,
|
|
|
|
reason |
|
|
|
|
lldb_private::eFormatterChoiceCriterionStrippedPointerReference,
|
|
|
|
use_dynamic, entries, true, did_strip_ref, did_strip_typedef);
|
|
|
|
if (non_ptr_type.IsTypedefType()) {
|
|
|
|
CompilerType deffed_pointed_type =
|
|
|
|
non_ptr_type.GetTypedefedType().GetPointerType();
|
|
|
|
GetPossibleMatches(
|
|
|
|
valobj, deffed_pointed_type,
|
|
|
|
reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
|
|
|
|
use_dynamic, entries, did_strip_ptr, did_strip_ref,
|
|
|
|
true); // this is not exactly the usual meaning of stripping typedefs
|
<rdar://problem/15530080>
Rework data formatters matching algorithm
What happens now is that, for each category, the FormatNavigator generates all possible matches, and checks them one by one
Since the possible matches do not actually depend on the category (whether a match is accepted or not does, but that check can be shifted at a more convenient time),
it is actually feasible to generate every possible match upfront and then let individual categories just scan through those
This commit changes things by introducing a notion of formatters match candidate, and shifting responsibility for generating all of them given a (ValueObject,DynamicValueType) pair
from the FormatNavigator back to the FormatManager
A list of these candidates is then passed down to each category for matching
Candidates also need to remember whether they were generated by stripping pointers, references, typedefs, since this is something that individual formatters can choose to reject
This check, however, is conveniently only done once a "textual" match has been found, so that the list of candidates is truly category-independent
While the performance benefit is small (mostly, due to caching), this is much cleaner from a design perspective
llvm-svn: 195395
2013-11-22 08:02:13 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
for (lldb::LanguageType language_type : GetCandidateLanguages(valobj)) {
|
|
|
|
if (Language *language = Language::FindPlugin(language_type)) {
|
|
|
|
for (ConstString candidate :
|
|
|
|
language->GetPossibleFormattersMatches(valobj, use_dynamic)) {
|
|
|
|
entries.push_back(
|
|
|
|
{candidate,
|
|
|
|
reason | lldb_private::eFormatterChoiceCriterionLanguagePlugin,
|
|
|
|
did_strip_ptr, did_strip_ref, did_strip_typedef});
|
|
|
|
}
|
<rdar://problem/15530080>
Rework data formatters matching algorithm
What happens now is that, for each category, the FormatNavigator generates all possible matches, and checks them one by one
Since the possible matches do not actually depend on the category (whether a match is accepted or not does, but that check can be shifted at a more convenient time),
it is actually feasible to generate every possible match upfront and then let individual categories just scan through those
This commit changes things by introducing a notion of formatters match candidate, and shifting responsibility for generating all of them given a (ValueObject,DynamicValueType) pair
from the FormatNavigator back to the FormatManager
A list of these candidates is then passed down to each category for matching
Candidates also need to remember whether they were generated by stripping pointers, references, typedefs, since this is something that individual formatters can choose to reject
This check, however, is conveniently only done once a "textual" match has been found, so that the list of candidates is truly category-independent
While the performance benefit is small (mostly, due to caching), this is much cleaner from a design perspective
llvm-svn: 195395
2013-11-22 08:02:13 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// try to strip typedef chains
|
|
|
|
if (compiler_type.IsTypedefType()) {
|
|
|
|
CompilerType deffed_type = compiler_type.GetTypedefedType();
|
|
|
|
GetPossibleMatches(
|
|
|
|
valobj, deffed_type,
|
|
|
|
reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
|
|
|
|
use_dynamic, entries, did_strip_ptr, did_strip_ref, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (root_level) {
|
|
|
|
do {
|
|
|
|
if (!compiler_type.IsValid())
|
|
|
|
break;
|
|
|
|
|
|
|
|
CompilerType unqual_compiler_ast_type =
|
|
|
|
compiler_type.GetFullyUnqualifiedType();
|
|
|
|
if (!unqual_compiler_ast_type.IsValid())
|
|
|
|
break;
|
|
|
|
if (unqual_compiler_ast_type.GetOpaqueQualType() !=
|
|
|
|
compiler_type.GetOpaqueQualType())
|
|
|
|
GetPossibleMatches(valobj, unqual_compiler_ast_type, reason,
|
|
|
|
use_dynamic, entries, did_strip_ptr, did_strip_ref,
|
|
|
|
did_strip_typedef);
|
|
|
|
} while (false);
|
|
|
|
|
|
|
|
// if all else fails, go to static type
|
|
|
|
if (valobj.IsDynamic()) {
|
|
|
|
lldb::ValueObjectSP static_value_sp(valobj.GetStaticValue());
|
|
|
|
if (static_value_sp)
|
|
|
|
GetPossibleMatches(
|
|
|
|
*static_value_sp.get(), static_value_sp->GetCompilerType(),
|
|
|
|
reason | lldb_private::eFormatterChoiceCriterionWentToStaticValue,
|
|
|
|
use_dynamic, entries, did_strip_ptr, did_strip_ref,
|
|
|
|
did_strip_typedef, true);
|
<rdar://problem/15530080>
Rework data formatters matching algorithm
What happens now is that, for each category, the FormatNavigator generates all possible matches, and checks them one by one
Since the possible matches do not actually depend on the category (whether a match is accepted or not does, but that check can be shifted at a more convenient time),
it is actually feasible to generate every possible match upfront and then let individual categories just scan through those
This commit changes things by introducing a notion of formatters match candidate, and shifting responsibility for generating all of them given a (ValueObject,DynamicValueType) pair
from the FormatNavigator back to the FormatManager
A list of these candidates is then passed down to each category for matching
Candidates also need to remember whether they were generated by stripping pointers, references, typedefs, since this is something that individual formatters can choose to reject
This check, however, is conveniently only done once a "textual" match has been found, so that the list of candidates is truly category-independent
While the performance benefit is small (mostly, due to caching), this is much cleaner from a design perspective
llvm-svn: 195395
2013-11-22 08:02:13 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
<rdar://problem/15530080>
Rework data formatters matching algorithm
What happens now is that, for each category, the FormatNavigator generates all possible matches, and checks them one by one
Since the possible matches do not actually depend on the category (whether a match is accepted or not does, but that check can be shifted at a more convenient time),
it is actually feasible to generate every possible match upfront and then let individual categories just scan through those
This commit changes things by introducing a notion of formatters match candidate, and shifting responsibility for generating all of them given a (ValueObject,DynamicValueType) pair
from the FormatNavigator back to the FormatManager
A list of these candidates is then passed down to each category for matching
Candidates also need to remember whether they were generated by stripping pointers, references, typedefs, since this is something that individual formatters can choose to reject
This check, however, is conveniently only done once a "textual" match has been found, so that the list of candidates is truly category-independent
While the performance benefit is small (mostly, due to caching), this is much cleaner from a design perspective
llvm-svn: 195395
2013-11-22 08:02:13 +08:00
|
|
|
}
|
|
|
|
|
2013-10-09 03:03:22 +08:00
|
|
|
lldb::TypeFormatImplSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp) {
|
|
|
|
if (!type_sp)
|
|
|
|
return lldb::TypeFormatImplSP();
|
|
|
|
lldb::TypeFormatImplSP format_chosen_sp;
|
|
|
|
uint32_t num_categories = m_categories_map.GetCount();
|
|
|
|
lldb::TypeCategoryImplSP category_sp;
|
|
|
|
uint32_t prio_category = UINT32_MAX;
|
|
|
|
for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
|
|
|
|
category_sp = GetCategoryAtIndex(category_id);
|
2018-12-15 08:15:33 +08:00
|
|
|
if (!category_sp->IsEnabled())
|
2016-09-07 04:57:50 +08:00
|
|
|
continue;
|
|
|
|
lldb::TypeFormatImplSP format_current_sp =
|
|
|
|
category_sp->GetFormatForType(type_sp);
|
|
|
|
if (format_current_sp &&
|
|
|
|
(format_chosen_sp.get() == NULL ||
|
|
|
|
(prio_category > category_sp->GetEnabledPosition()))) {
|
|
|
|
prio_category = category_sp->GetEnabledPosition();
|
|
|
|
format_chosen_sp = format_current_sp;
|
2013-10-09 03:03:22 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return format_chosen_sp;
|
2013-10-09 03:03:22 +08:00
|
|
|
}
|
|
|
|
|
2012-05-09 05:49:57 +08:00
|
|
|
lldb::TypeSummaryImplSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp) {
|
|
|
|
if (!type_sp)
|
|
|
|
return lldb::TypeSummaryImplSP();
|
|
|
|
lldb::TypeSummaryImplSP summary_chosen_sp;
|
|
|
|
uint32_t num_categories = m_categories_map.GetCount();
|
|
|
|
lldb::TypeCategoryImplSP category_sp;
|
|
|
|
uint32_t prio_category = UINT32_MAX;
|
|
|
|
for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
|
|
|
|
category_sp = GetCategoryAtIndex(category_id);
|
2018-12-15 08:15:33 +08:00
|
|
|
if (!category_sp->IsEnabled())
|
2016-09-07 04:57:50 +08:00
|
|
|
continue;
|
|
|
|
lldb::TypeSummaryImplSP summary_current_sp =
|
|
|
|
category_sp->GetSummaryForType(type_sp);
|
|
|
|
if (summary_current_sp &&
|
|
|
|
(summary_chosen_sp.get() == NULL ||
|
|
|
|
(prio_category > category_sp->GetEnabledPosition()))) {
|
|
|
|
prio_category = category_sp->GetEnabledPosition();
|
|
|
|
summary_chosen_sp = summary_current_sp;
|
2012-05-09 05:49:57 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return summary_chosen_sp;
|
2012-05-09 05:49:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::TypeFilterImplSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) {
|
|
|
|
if (!type_sp)
|
|
|
|
return lldb::TypeFilterImplSP();
|
|
|
|
lldb::TypeFilterImplSP filter_chosen_sp;
|
|
|
|
uint32_t num_categories = m_categories_map.GetCount();
|
|
|
|
lldb::TypeCategoryImplSP category_sp;
|
|
|
|
uint32_t prio_category = UINT32_MAX;
|
|
|
|
for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
|
|
|
|
category_sp = GetCategoryAtIndex(category_id);
|
2018-12-15 08:15:33 +08:00
|
|
|
if (!category_sp->IsEnabled())
|
2016-09-07 04:57:50 +08:00
|
|
|
continue;
|
|
|
|
lldb::TypeFilterImplSP filter_current_sp(
|
|
|
|
(TypeFilterImpl *)category_sp->GetFilterForType(type_sp).get());
|
|
|
|
if (filter_current_sp &&
|
|
|
|
(filter_chosen_sp.get() == NULL ||
|
|
|
|
(prio_category > category_sp->GetEnabledPosition()))) {
|
|
|
|
prio_category = category_sp->GetEnabledPosition();
|
|
|
|
filter_chosen_sp = filter_current_sp;
|
2012-05-09 05:49:57 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return filter_chosen_sp;
|
2012-05-09 05:49:57 +08:00
|
|
|
}
|
|
|
|
|
2012-05-16 08:38:08 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2013-01-29 07:47:25 +08:00
|
|
|
lldb::ScriptedSyntheticChildrenSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
|
|
|
|
if (!type_sp)
|
|
|
|
return lldb::ScriptedSyntheticChildrenSP();
|
|
|
|
lldb::ScriptedSyntheticChildrenSP synth_chosen_sp;
|
|
|
|
uint32_t num_categories = m_categories_map.GetCount();
|
|
|
|
lldb::TypeCategoryImplSP category_sp;
|
|
|
|
uint32_t prio_category = UINT32_MAX;
|
|
|
|
for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
|
|
|
|
category_sp = GetCategoryAtIndex(category_id);
|
2018-12-15 08:15:33 +08:00
|
|
|
if (!category_sp->IsEnabled())
|
2016-09-07 04:57:50 +08:00
|
|
|
continue;
|
|
|
|
lldb::ScriptedSyntheticChildrenSP synth_current_sp(
|
|
|
|
(ScriptedSyntheticChildren *)category_sp->GetSyntheticForType(type_sp)
|
|
|
|
.get());
|
|
|
|
if (synth_current_sp &&
|
|
|
|
(synth_chosen_sp.get() == NULL ||
|
|
|
|
(prio_category > category_sp->GetEnabledPosition()))) {
|
|
|
|
prio_category = category_sp->GetEnabledPosition();
|
|
|
|
synth_chosen_sp = synth_current_sp;
|
2012-05-09 05:49:57 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return synth_chosen_sp;
|
2012-05-09 05:49:57 +08:00
|
|
|
}
|
2012-05-16 08:38:08 +08:00
|
|
|
#endif
|
2012-05-09 05:49:57 +08:00
|
|
|
|
2012-05-16 08:38:08 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::SyntheticChildrenSP FormatManager::GetSyntheticChildrenForType(
|
|
|
|
lldb::TypeNameSpecifierImplSP type_sp) {
|
|
|
|
if (!type_sp)
|
|
|
|
return lldb::SyntheticChildrenSP();
|
|
|
|
lldb::TypeFilterImplSP filter_sp = GetFilterForType(type_sp);
|
|
|
|
lldb::ScriptedSyntheticChildrenSP synth_sp = GetSyntheticForType(type_sp);
|
|
|
|
if (filter_sp->GetRevision() > synth_sp->GetRevision())
|
|
|
|
return lldb::SyntheticChildrenSP(filter_sp.get());
|
|
|
|
else
|
|
|
|
return lldb::SyntheticChildrenSP(synth_sp.get());
|
2012-05-09 05:49:57 +08:00
|
|
|
}
|
2012-05-16 08:38:08 +08:00
|
|
|
#endif
|
2012-05-09 05:49:57 +08:00
|
|
|
|
2014-09-06 04:45:07 +08:00
|
|
|
lldb::TypeValidatorImplSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) {
|
|
|
|
if (!type_sp)
|
|
|
|
return lldb::TypeValidatorImplSP();
|
|
|
|
lldb::TypeValidatorImplSP validator_chosen_sp;
|
|
|
|
uint32_t num_categories = m_categories_map.GetCount();
|
|
|
|
lldb::TypeCategoryImplSP category_sp;
|
|
|
|
uint32_t prio_category = UINT32_MAX;
|
|
|
|
for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
|
|
|
|
category_sp = GetCategoryAtIndex(category_id);
|
2018-12-15 08:15:33 +08:00
|
|
|
if (!category_sp->IsEnabled())
|
2016-09-07 04:57:50 +08:00
|
|
|
continue;
|
|
|
|
lldb::TypeValidatorImplSP validator_current_sp(
|
|
|
|
category_sp->GetValidatorForType(type_sp).get());
|
|
|
|
if (validator_current_sp &&
|
|
|
|
(validator_chosen_sp.get() == NULL ||
|
|
|
|
(prio_category > category_sp->GetEnabledPosition()))) {
|
|
|
|
prio_category = category_sp->GetEnabledPosition();
|
|
|
|
validator_chosen_sp = validator_current_sp;
|
2014-09-06 04:45:07 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return validator_chosen_sp;
|
2014-09-06 04:45:07 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void FormatManager::ForEachCategory(TypeCategoryMap::ForEachCallback callback) {
|
|
|
|
m_categories_map.ForEach(callback);
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
|
|
|
|
for (const auto &entry : m_language_categories_map) {
|
|
|
|
if (auto category_sp = entry.second->GetCategory()) {
|
|
|
|
if (!callback(category_sp))
|
|
|
|
break;
|
2015-11-14 13:44:23 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-11-14 13:44:23 +08:00
|
|
|
}
|
|
|
|
|
2012-02-15 10:34:21 +08:00
|
|
|
lldb::TypeCategoryImplSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetCategory(const ConstString &category_name, bool can_create) {
|
|
|
|
if (!category_name)
|
|
|
|
return GetCategory(m_default_category_name);
|
|
|
|
lldb::TypeCategoryImplSP category;
|
|
|
|
if (m_categories_map.Get(category_name, category))
|
|
|
|
return category;
|
|
|
|
|
|
|
|
if (!can_create)
|
|
|
|
return lldb::TypeCategoryImplSP();
|
|
|
|
|
|
|
|
m_categories_map.Add(
|
|
|
|
category_name,
|
|
|
|
lldb::TypeCategoryImplSP(new TypeCategoryImpl(this, category_name)));
|
|
|
|
return GetCategory(category_name);
|
2011-08-23 08:32:52 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::Format FormatManager::GetSingleItemFormat(lldb::Format vector_format) {
|
|
|
|
switch (vector_format) {
|
|
|
|
case eFormatVectorOfChar:
|
|
|
|
return eFormatCharArray;
|
|
|
|
|
|
|
|
case eFormatVectorOfSInt8:
|
|
|
|
case eFormatVectorOfSInt16:
|
|
|
|
case eFormatVectorOfSInt32:
|
|
|
|
case eFormatVectorOfSInt64:
|
|
|
|
return eFormatDecimal;
|
|
|
|
|
|
|
|
case eFormatVectorOfUInt8:
|
|
|
|
case eFormatVectorOfUInt16:
|
|
|
|
case eFormatVectorOfUInt32:
|
|
|
|
case eFormatVectorOfUInt64:
|
|
|
|
case eFormatVectorOfUInt128:
|
|
|
|
return eFormatHex;
|
|
|
|
|
|
|
|
case eFormatVectorOfFloat16:
|
|
|
|
case eFormatVectorOfFloat32:
|
|
|
|
case eFormatVectorOfFloat64:
|
|
|
|
return eFormatFloat;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return lldb::eFormatInvalid;
|
|
|
|
}
|
2011-08-10 10:10:13 +08:00
|
|
|
}
|
2011-08-18 06:13:59 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool FormatManager::ShouldPrintAsOneLiner(ValueObject &valobj) {
|
|
|
|
// if settings say no oneline whatsoever
|
|
|
|
if (valobj.GetTargetSP().get() &&
|
2018-12-15 08:15:33 +08:00
|
|
|
!valobj.GetTargetSP()->GetDebugger().GetAutoOneLineSummaries())
|
2016-09-07 04:57:50 +08:00
|
|
|
return false; // then don't oneline
|
|
|
|
|
|
|
|
// if this object has a summary, then ask the summary
|
|
|
|
if (valobj.GetSummaryFormat().get() != nullptr)
|
|
|
|
return valobj.GetSummaryFormat()->IsOneLiner();
|
|
|
|
|
|
|
|
// no children, no party
|
|
|
|
if (valobj.GetNumChildren() == 0)
|
|
|
|
return false;
|
|
|
|
|
2018-05-01 00:49:04 +08:00
|
|
|
// ask the type if it has any opinion about this eLazyBoolCalculate == no
|
|
|
|
// opinion; other values should be self explanatory
|
2016-09-07 04:57:50 +08:00
|
|
|
CompilerType compiler_type(valobj.GetCompilerType());
|
|
|
|
if (compiler_type.IsValid()) {
|
|
|
|
switch (compiler_type.ShouldPrintAsOneLiner(&valobj)) {
|
|
|
|
case eLazyBoolNo:
|
|
|
|
return false;
|
|
|
|
case eLazyBoolYes:
|
|
|
|
return true;
|
|
|
|
case eLazyBoolCalculate:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t total_children_name_len = 0;
|
|
|
|
|
|
|
|
for (size_t idx = 0; idx < valobj.GetNumChildren(); idx++) {
|
|
|
|
bool is_synth_val = false;
|
|
|
|
ValueObjectSP child_sp(valobj.GetChildAtIndex(idx, true));
|
|
|
|
// something is wrong here - bail out
|
|
|
|
if (!child_sp)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// also ask the child's type if it has any opinion
|
|
|
|
CompilerType child_compiler_type(child_sp->GetCompilerType());
|
|
|
|
if (child_compiler_type.IsValid()) {
|
|
|
|
switch (child_compiler_type.ShouldPrintAsOneLiner(child_sp.get())) {
|
|
|
|
case eLazyBoolYes:
|
|
|
|
// an opinion of yes is only binding for the child, so keep going
|
|
|
|
case eLazyBoolCalculate:
|
|
|
|
break;
|
|
|
|
case eLazyBoolNo:
|
|
|
|
// but if the child says no, then it's a veto on the whole thing
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if we decided to define synthetic children for a type, we probably care
|
2018-05-01 00:49:04 +08:00
|
|
|
// enough to show them, but avoid nesting children in children
|
2016-09-07 04:57:50 +08:00
|
|
|
if (child_sp->GetSyntheticChildren().get() != nullptr) {
|
|
|
|
ValueObjectSP synth_sp(child_sp->GetSyntheticValue());
|
|
|
|
// wait.. wat? just get out of here..
|
|
|
|
if (!synth_sp)
|
|
|
|
return false;
|
|
|
|
// but if we only have them to provide a value, keep going
|
2018-12-15 08:15:33 +08:00
|
|
|
if (!synth_sp->MightHaveChildren() &&
|
2016-09-07 04:57:50 +08:00
|
|
|
synth_sp->DoesProvideSyntheticValue())
|
|
|
|
is_synth_val = true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
total_children_name_len += child_sp->GetName().GetLength();
|
|
|
|
|
|
|
|
// 50 itself is a "randomly" chosen number - the idea is that
|
|
|
|
// overly long structs should not get this treatment
|
|
|
|
// FIXME: maybe make this a user-tweakable setting?
|
|
|
|
if (total_children_name_len > 50)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// if a summary is there..
|
|
|
|
if (child_sp->GetSummaryFormat()) {
|
|
|
|
// and it wants children, then bail out
|
|
|
|
if (child_sp->GetSummaryFormat()->DoesPrintChildren(child_sp.get()))
|
2013-10-05 07:14:13 +08:00
|
|
|
return false;
|
2015-09-23 10:04:34 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
// if this child has children..
|
|
|
|
if (child_sp->GetNumChildren()) {
|
|
|
|
// ...and no summary...
|
|
|
|
// (if it had a summary and the summary wanted children, we would have
|
|
|
|
// bailed out anyway
|
|
|
|
// so this only makes us bail out if this has no summary and we would
|
|
|
|
// then print children)
|
|
|
|
if (!child_sp->GetSummaryFormat() && !is_synth_val) // but again only do
|
|
|
|
// that if not a
|
|
|
|
// synthetic valued
|
|
|
|
// child
|
|
|
|
return false; // then bail out
|
2013-10-05 07:14:13 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return true;
|
2013-10-05 07:14:13 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
ConstString FormatManager::GetValidTypeName(const ConstString &type) {
|
|
|
|
return ::GetValidTypeName_Impl(type);
|
2011-08-19 09:14:49 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
ConstString FormatManager::GetTypeForCache(ValueObject &valobj,
|
|
|
|
lldb::DynamicValueType use_dynamic) {
|
|
|
|
ValueObjectSP valobj_sp = valobj.GetQualifiedRepresentationIfAvailable(
|
|
|
|
use_dynamic, valobj.IsSynthetic());
|
|
|
|
if (valobj_sp && valobj_sp->GetCompilerType().IsValid()) {
|
|
|
|
if (!valobj_sp->GetCompilerType().IsMeaninglessWithoutDynamicResolution())
|
|
|
|
return valobj_sp->GetQualifiedTypeName();
|
|
|
|
}
|
|
|
|
return ConstString();
|
2013-01-29 07:47:25 +08:00
|
|
|
}
|
|
|
|
|
2015-09-09 09:10:46 +08:00
|
|
|
std::vector<lldb::LanguageType>
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetCandidateLanguages(ValueObject &valobj) {
|
|
|
|
lldb::LanguageType lang_type = valobj.GetObjectRuntimeLanguage();
|
|
|
|
return GetCandidateLanguages(lang_type);
|
2015-09-10 06:30:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<lldb::LanguageType>
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetCandidateLanguages(lldb::LanguageType lang_type) {
|
|
|
|
switch (lang_type) {
|
|
|
|
case lldb::eLanguageTypeC:
|
|
|
|
case lldb::eLanguageTypeC89:
|
|
|
|
case lldb::eLanguageTypeC99:
|
|
|
|
case lldb::eLanguageTypeC11:
|
|
|
|
case lldb::eLanguageTypeC_plus_plus:
|
|
|
|
case lldb::eLanguageTypeC_plus_plus_03:
|
|
|
|
case lldb::eLanguageTypeC_plus_plus_11:
|
|
|
|
case lldb::eLanguageTypeC_plus_plus_14:
|
|
|
|
return {lldb::eLanguageTypeC_plus_plus, lldb::eLanguageTypeObjC};
|
|
|
|
default:
|
|
|
|
return {lang_type};
|
|
|
|
}
|
2015-09-02 02:22:39 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
LanguageCategory *
|
|
|
|
FormatManager::GetCategoryForLanguage(lldb::LanguageType lang_type) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
|
|
|
|
auto iter = m_language_categories_map.find(lang_type),
|
|
|
|
end = m_language_categories_map.end();
|
|
|
|
if (iter != end)
|
|
|
|
return iter->second.get();
|
|
|
|
LanguageCategory *lang_category = new LanguageCategory(lang_type);
|
|
|
|
m_language_categories_map[lang_type] =
|
|
|
|
LanguageCategory::UniquePointer(lang_category);
|
|
|
|
return lang_category;
|
2015-09-02 02:22:39 +08:00
|
|
|
}
|
|
|
|
|
2014-08-20 02:47:58 +08:00
|
|
|
lldb::TypeFormatImplSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetHardcodedFormat(FormattersMatchData &match_data) {
|
|
|
|
TypeFormatImplSP retval_sp;
|
|
|
|
|
|
|
|
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
|
|
|
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
|
|
|
if (lang_category->GetHardcoded(*this, match_data, retval_sp))
|
|
|
|
break;
|
2014-08-20 02:47:58 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2015-09-17 02:28:11 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
return retval_sp;
|
2013-10-31 07:46:27 +08:00
|
|
|
}
|
|
|
|
|
2013-10-09 03:03:22 +08:00
|
|
|
lldb::TypeFormatImplSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetFormat(ValueObject &valobj,
|
|
|
|
lldb::DynamicValueType use_dynamic) {
|
|
|
|
FormattersMatchData match_data(valobj, use_dynamic);
|
|
|
|
|
|
|
|
TypeFormatImplSP retval;
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
|
|
|
|
if (match_data.GetTypeForCache()) {
|
|
|
|
if (log)
|
|
|
|
log->Printf(
|
|
|
|
"\n\n[FormatManager::GetFormat] Looking into cache for type %s",
|
|
|
|
match_data.GetTypeForCache().AsCString("<invalid>"));
|
|
|
|
if (m_format_cache.GetFormat(match_data.GetTypeForCache(), retval)) {
|
|
|
|
if (log) {
|
|
|
|
log->Printf(
|
|
|
|
"[FormatManager::GetFormat] Cache search success. Returning.");
|
2017-02-13 19:03:17 +08:00
|
|
|
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
|
|
|
m_format_cache.GetCacheHits(),
|
|
|
|
m_format_cache.GetCacheMisses());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return retval;
|
2015-09-02 02:22:39 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf(
|
|
|
|
"[FormatManager::GetFormat] Cache search failed. Going normal route");
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = m_categories_map.GetFormat(match_data);
|
|
|
|
if (!retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetFormat] Search failed. Giving language a "
|
|
|
|
"chance.");
|
|
|
|
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
|
|
|
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
|
|
|
if (lang_category->Get(match_data, retval))
|
|
|
|
break;
|
|
|
|
}
|
2013-10-31 07:46:27 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
if (retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf(
|
|
|
|
"[FormatManager::GetFormat] Language search success. Returning.");
|
|
|
|
return retval;
|
2013-10-18 06:27:19 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
if (!retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetFormat] Search failed. Giving hardcoded "
|
|
|
|
"a chance.");
|
|
|
|
retval = GetHardcodedFormat(match_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetFormat] Caching %p for type %s",
|
|
|
|
static_cast<void *>(retval.get()),
|
|
|
|
match_data.GetTypeForCache().AsCString("<invalid>"));
|
|
|
|
m_format_cache.SetFormat(match_data.GetTypeForCache(), retval);
|
|
|
|
}
|
2017-02-13 19:03:17 +08:00
|
|
|
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
|
|
|
m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
|
2016-09-07 04:57:50 +08:00
|
|
|
return retval;
|
2013-10-09 03:03:22 +08:00
|
|
|
}
|
|
|
|
|
2014-08-20 02:47:58 +08:00
|
|
|
lldb::TypeSummaryImplSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetHardcodedSummaryFormat(FormattersMatchData &match_data) {
|
|
|
|
TypeSummaryImplSP retval_sp;
|
|
|
|
|
|
|
|
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
|
|
|
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
|
|
|
if (lang_category->GetHardcoded(*this, match_data, retval_sp))
|
|
|
|
break;
|
2014-08-20 02:47:58 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return retval_sp;
|
2013-10-31 07:46:27 +08:00
|
|
|
}
|
|
|
|
|
2013-01-29 07:47:25 +08:00
|
|
|
lldb::TypeSummaryImplSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetSummaryFormat(ValueObject &valobj,
|
|
|
|
lldb::DynamicValueType use_dynamic) {
|
|
|
|
FormattersMatchData match_data(valobj, use_dynamic);
|
|
|
|
|
|
|
|
TypeSummaryImplSP retval;
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
|
|
|
|
if (match_data.GetTypeForCache()) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("\n\n[FormatManager::GetSummaryFormat] Looking into cache "
|
|
|
|
"for type %s",
|
|
|
|
match_data.GetTypeForCache().AsCString("<invalid>"));
|
|
|
|
if (m_format_cache.GetSummary(match_data.GetTypeForCache(), retval)) {
|
|
|
|
if (log) {
|
|
|
|
log->Printf("[FormatManager::GetSummaryFormat] Cache search success. "
|
|
|
|
"Returning.");
|
2017-02-13 19:03:17 +08:00
|
|
|
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
|
|
|
m_format_cache.GetCacheHits(),
|
|
|
|
m_format_cache.GetCacheMisses());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return retval;
|
2015-09-02 02:22:39 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. "
|
|
|
|
"Going normal route");
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = m_categories_map.GetSummaryFormat(match_data);
|
|
|
|
if (!retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving "
|
|
|
|
"language a chance.");
|
|
|
|
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
|
|
|
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
|
|
|
if (lang_category->Get(match_data, retval))
|
|
|
|
break;
|
|
|
|
}
|
2013-10-31 07:46:27 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
if (retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetSummaryFormat] Language search "
|
|
|
|
"success. Returning.");
|
|
|
|
return retval;
|
2013-01-29 07:47:25 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
if (!retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving "
|
|
|
|
"hardcoded a chance.");
|
|
|
|
retval = GetHardcodedSummaryFormat(match_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",
|
|
|
|
static_cast<void *>(retval.get()),
|
|
|
|
match_data.GetTypeForCache().AsCString("<invalid>"));
|
|
|
|
m_format_cache.SetSummary(match_data.GetTypeForCache(), retval);
|
|
|
|
}
|
2017-02-13 19:03:17 +08:00
|
|
|
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
|
|
|
m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
|
2016-09-07 04:57:50 +08:00
|
|
|
return retval;
|
2013-01-29 07:47:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2014-08-20 02:47:58 +08:00
|
|
|
lldb::SyntheticChildrenSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetHardcodedSyntheticChildren(FormattersMatchData &match_data) {
|
|
|
|
SyntheticChildrenSP retval_sp;
|
|
|
|
|
|
|
|
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
|
|
|
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
|
|
|
if (lang_category->GetHardcoded(*this, match_data, retval_sp))
|
|
|
|
break;
|
2014-08-20 02:47:58 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return retval_sp;
|
2013-10-31 07:46:27 +08:00
|
|
|
}
|
|
|
|
|
2013-01-29 07:47:25 +08:00
|
|
|
lldb::SyntheticChildrenSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetSyntheticChildren(ValueObject &valobj,
|
|
|
|
lldb::DynamicValueType use_dynamic) {
|
|
|
|
FormattersMatchData match_data(valobj, use_dynamic);
|
|
|
|
|
|
|
|
SyntheticChildrenSP retval;
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
|
|
|
|
if (match_data.GetTypeForCache()) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("\n\n[FormatManager::GetSyntheticChildren] Looking into "
|
|
|
|
"cache for type %s",
|
|
|
|
match_data.GetTypeForCache().AsCString("<invalid>"));
|
|
|
|
if (m_format_cache.GetSynthetic(match_data.GetTypeForCache(), retval)) {
|
|
|
|
if (log) {
|
|
|
|
log->Printf("[FormatManager::GetSyntheticChildren] Cache search "
|
|
|
|
"success. Returning.");
|
2017-02-13 19:03:17 +08:00
|
|
|
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
|
|
|
m_format_cache.GetCacheHits(),
|
|
|
|
m_format_cache.GetCacheMisses());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return retval;
|
2015-09-02 02:22:39 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. "
|
|
|
|
"Going normal route");
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = m_categories_map.GetSyntheticChildren(match_data);
|
|
|
|
if (!retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving "
|
|
|
|
"language a chance.");
|
|
|
|
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
|
|
|
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
|
|
|
if (lang_category->Get(match_data, retval))
|
|
|
|
break;
|
|
|
|
}
|
2013-10-31 07:46:27 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
if (retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetSyntheticChildren] Language search "
|
|
|
|
"success. Returning.");
|
|
|
|
return retval;
|
2013-01-29 07:47:25 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
if (!retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving "
|
|
|
|
"hardcoded a chance.");
|
|
|
|
retval = GetHardcodedSyntheticChildren(match_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
|
|
|
|
if (log)
|
|
|
|
log->Printf(
|
|
|
|
"[FormatManager::GetSyntheticChildren] Caching %p for type %s",
|
|
|
|
static_cast<void *>(retval.get()),
|
|
|
|
match_data.GetTypeForCache().AsCString("<invalid>"));
|
|
|
|
m_format_cache.SetSynthetic(match_data.GetTypeForCache(), retval);
|
|
|
|
}
|
2017-02-13 19:03:17 +08:00
|
|
|
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
|
|
|
m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
|
2016-09-07 04:57:50 +08:00
|
|
|
return retval;
|
2013-01-29 07:47:25 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-09-06 04:45:07 +08:00
|
|
|
lldb::TypeValidatorImplSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetValidator(ValueObject &valobj,
|
|
|
|
lldb::DynamicValueType use_dynamic) {
|
|
|
|
FormattersMatchData match_data(valobj, use_dynamic);
|
|
|
|
|
|
|
|
TypeValidatorImplSP retval;
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
|
|
|
|
if (match_data.GetTypeForCache()) {
|
|
|
|
if (log)
|
|
|
|
log->Printf(
|
|
|
|
"\n\n[FormatManager::GetValidator] Looking into cache for type %s",
|
|
|
|
match_data.GetTypeForCache().AsCString("<invalid>"));
|
|
|
|
if (m_format_cache.GetValidator(match_data.GetTypeForCache(), retval)) {
|
|
|
|
if (log) {
|
|
|
|
log->Printf(
|
|
|
|
"[FormatManager::GetValidator] Cache search success. Returning.");
|
2017-02-13 19:03:17 +08:00
|
|
|
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
|
|
|
m_format_cache.GetCacheHits(),
|
|
|
|
m_format_cache.GetCacheMisses());
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
return retval;
|
2015-09-02 02:22:39 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetValidator] Cache search failed. Going "
|
|
|
|
"normal route");
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = m_categories_map.GetValidator(match_data);
|
|
|
|
if (!retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetValidator] Search failed. Giving "
|
|
|
|
"language a chance.");
|
|
|
|
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
|
|
|
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
|
|
|
if (lang_category->Get(match_data, retval))
|
|
|
|
break;
|
|
|
|
}
|
2014-09-06 04:45:07 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
if (retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetValidator] Language search success. "
|
|
|
|
"Returning.");
|
|
|
|
return retval;
|
2014-09-06 04:45:07 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
if (!retval) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetValidator] Search failed. Giving "
|
|
|
|
"hardcoded a chance.");
|
|
|
|
retval = GetHardcodedValidator(match_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
|
|
|
|
if (log)
|
|
|
|
log->Printf("[FormatManager::GetValidator] Caching %p for type %s",
|
|
|
|
static_cast<void *>(retval.get()),
|
|
|
|
match_data.GetTypeForCache().AsCString("<invalid>"));
|
|
|
|
m_format_cache.SetValidator(match_data.GetTypeForCache(), retval);
|
|
|
|
}
|
2017-02-13 19:03:17 +08:00
|
|
|
LLDB_LOGV(log, "Cache hits: {0} - Cache Misses: {1}",
|
|
|
|
m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
|
2016-09-07 04:57:50 +08:00
|
|
|
return retval;
|
2014-09-06 04:45:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::TypeValidatorImplSP
|
2016-09-07 04:57:50 +08:00
|
|
|
FormatManager::GetHardcodedValidator(FormattersMatchData &match_data) {
|
|
|
|
TypeValidatorImplSP retval_sp;
|
|
|
|
|
|
|
|
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
|
|
|
|
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
|
|
|
|
if (lang_category->GetHardcoded(*this, match_data, retval_sp))
|
|
|
|
break;
|
2014-09-06 04:45:07 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return retval_sp;
|
2014-09-06 04:45:07 +08:00
|
|
|
}
|
|
|
|
|
2016-05-18 09:59:10 +08:00
|
|
|
FormatManager::FormatManager()
|
2016-09-07 04:57:50 +08:00
|
|
|
: m_last_revision(0), m_format_cache(), m_language_categories_mutex(),
|
|
|
|
m_language_categories_map(), m_named_summaries_map(this),
|
|
|
|
m_categories_map(this), m_default_category_name(ConstString("default")),
|
2016-05-18 09:59:10 +08:00
|
|
|
m_system_category_name(ConstString("system")),
|
2016-09-07 04:57:50 +08:00
|
|
|
m_vectortypes_category_name(ConstString("VectorTypes")) {
|
|
|
|
LoadSystemFormatters();
|
|
|
|
LoadVectorFormatters();
|
2016-05-18 09:59:10 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
EnableCategory(m_vectortypes_category_name, TypeCategoryMap::Last,
|
|
|
|
lldb::eLanguageTypeObjC_plus_plus);
|
|
|
|
EnableCategory(m_system_category_name, TypeCategoryMap::Last,
|
|
|
|
lldb::eLanguageTypeObjC_plus_plus);
|
2012-02-17 11:18:30 +08:00
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void FormatManager::LoadSystemFormatters() {
|
|
|
|
TypeSummaryImpl::Flags string_flags;
|
|
|
|
string_flags.SetCascades(true)
|
|
|
|
.SetSkipPointers(true)
|
|
|
|
.SetSkipReferences(false)
|
|
|
|
.SetDontShowChildren(true)
|
|
|
|
.SetDontShowValue(false)
|
|
|
|
.SetShowMembersOneLiner(false)
|
|
|
|
.SetHideItemNames(false);
|
|
|
|
|
|
|
|
TypeSummaryImpl::Flags string_array_flags;
|
|
|
|
string_array_flags.SetCascades(true)
|
|
|
|
.SetSkipPointers(true)
|
|
|
|
.SetSkipReferences(false)
|
|
|
|
.SetDontShowChildren(true)
|
|
|
|
.SetDontShowValue(true)
|
|
|
|
.SetShowMembersOneLiner(false)
|
|
|
|
.SetHideItemNames(false);
|
|
|
|
|
|
|
|
lldb::TypeSummaryImplSP string_format(
|
|
|
|
new StringSummaryFormat(string_flags, "${var%s}"));
|
|
|
|
|
|
|
|
lldb::TypeSummaryImplSP string_array_format(
|
|
|
|
new StringSummaryFormat(string_array_flags, "${var%s}"));
|
|
|
|
|
|
|
|
lldb::RegularExpressionSP any_size_char_arr(
|
2016-09-22 00:01:28 +08:00
|
|
|
new RegularExpression(llvm::StringRef("char \\[[0-9]+\\]")));
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::RegularExpressionSP any_size_wchar_arr(
|
2016-09-22 00:01:28 +08:00
|
|
|
new RegularExpression(llvm::StringRef("wchar_t \\[[0-9]+\\]")));
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
TypeCategoryImpl::SharedPointer sys_category_sp =
|
|
|
|
GetCategory(m_system_category_name);
|
|
|
|
|
|
|
|
sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("char *"),
|
|
|
|
string_format);
|
|
|
|
sys_category_sp->GetTypeSummariesContainer()->Add(
|
|
|
|
ConstString("unsigned char *"), string_format);
|
|
|
|
sys_category_sp->GetRegexTypeSummariesContainer()->Add(any_size_char_arr,
|
|
|
|
string_array_format);
|
|
|
|
|
|
|
|
lldb::TypeSummaryImplSP ostype_summary(
|
|
|
|
new StringSummaryFormat(TypeSummaryImpl::Flags()
|
|
|
|
.SetCascades(false)
|
|
|
|
.SetSkipPointers(true)
|
|
|
|
.SetSkipReferences(true)
|
|
|
|
.SetDontShowChildren(true)
|
|
|
|
.SetDontShowValue(false)
|
|
|
|
.SetShowMembersOneLiner(false)
|
|
|
|
.SetHideItemNames(false),
|
|
|
|
"${var%O}"));
|
|
|
|
|
|
|
|
sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("OSType"),
|
|
|
|
ostype_summary);
|
|
|
|
|
2013-01-12 12:24:50 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2016-09-07 04:57:50 +08:00
|
|
|
TypeFormatImpl::Flags fourchar_flags;
|
|
|
|
fourchar_flags.SetCascades(true).SetSkipPointers(true).SetSkipReferences(
|
|
|
|
true);
|
|
|
|
|
|
|
|
AddFormat(sys_category_sp, lldb::eFormatOSType, ConstString("FourCharCode"),
|
|
|
|
fourchar_flags);
|
2013-01-12 12:24:50 +08:00
|
|
|
#endif
|
2012-02-24 07:10:03 +08:00
|
|
|
}
|
2012-09-14 02:27:09 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void FormatManager::LoadVectorFormatters() {
|
|
|
|
TypeCategoryImpl::SharedPointer vectors_category_sp =
|
|
|
|
GetCategory(m_vectortypes_category_name);
|
|
|
|
|
|
|
|
TypeSummaryImpl::Flags vector_flags;
|
|
|
|
vector_flags.SetCascades(true)
|
|
|
|
.SetSkipPointers(true)
|
|
|
|
.SetSkipReferences(false)
|
|
|
|
.SetDontShowChildren(true)
|
|
|
|
.SetDontShowValue(false)
|
|
|
|
.SetShowMembersOneLiner(true)
|
|
|
|
.SetHideItemNames(true);
|
|
|
|
|
|
|
|
AddStringSummary(vectors_category_sp, "${var.uint128}",
|
|
|
|
ConstString("builtin_type_vec128"), vector_flags);
|
|
|
|
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("float [4]"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("int32_t [4]"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("int16_t [8]"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("vDouble"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("vFloat"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("vSInt8"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("vSInt16"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("vSInt32"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("vUInt16"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("vUInt8"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("vUInt16"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("vUInt32"),
|
|
|
|
vector_flags);
|
|
|
|
AddStringSummary(vectors_category_sp, "", ConstString("vBool32"),
|
|
|
|
vector_flags);
|
2011-10-12 08:53:29 +08:00
|
|
|
}
|