Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 1 | //===-- FormatManager.cpp -------------------------------------------*- C++ |
| 2 | //-*-===// |
Greg Clayton | 4a33d31 | 2011-06-23 17:59:56 +0000 | [diff] [blame] | 3 | // |
| 4 | // The LLVM Compiler Infrastructure |
| 5 | // |
| 6 | // This file is distributed under the University of Illinois Open Source |
| 7 | // License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
Enrico Granata | 5548cb5 | 2013-01-28 23:47:25 +0000 | [diff] [blame] | 11 | #include "lldb/DataFormatters/FormatManager.h" |
Greg Clayton | 4a33d31 | 2011-06-23 17:59:56 +0000 | [diff] [blame] | 12 | |
Enrico Granata | d717cc9 | 2015-10-20 04:50:09 +0000 | [diff] [blame] | 13 | #include "llvm/ADT/STLExtras.h" |
| 14 | |
Greg Clayton | 4a33d31 | 2011-06-23 17:59:56 +0000 | [diff] [blame] | 15 | // C Includes |
| 16 | // C++ Includes |
| 17 | // Other libraries and framework includes |
| 18 | // Project includes |
| 19 | |
Enrico Granata | f2bbf71 | 2011-07-15 02:26:42 +0000 | [diff] [blame] | 20 | #include "lldb/Core/Debugger.h" |
Enrico Granata | d717cc9 | 2015-10-20 04:50:09 +0000 | [diff] [blame] | 21 | #include "lldb/Core/Log.h" |
Enrico Granata | df7e79e | 2015-09-02 01:21:31 +0000 | [diff] [blame] | 22 | #include "lldb/DataFormatters/FormattersHelpers.h" |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 23 | #include "lldb/DataFormatters/LanguageCategory.h" |
Enrico Granata | 5548cb5 | 2013-01-28 23:47:25 +0000 | [diff] [blame] | 24 | #include "lldb/Target/ExecutionContext.h" |
Enrico Granata | 33e97e6 | 2015-09-04 21:01:18 +0000 | [diff] [blame] | 25 | #include "lldb/Target/Language.h" |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 26 | |
Greg Clayton | 4a33d31 | 2011-06-23 17:59:56 +0000 | [diff] [blame] | 27 | using namespace lldb; |
| 28 | using namespace lldb_private; |
Enrico Granata | df7e79e | 2015-09-02 01:21:31 +0000 | [diff] [blame] | 29 | using namespace lldb_private::formatters; |
Greg Clayton | bb7f31f | 2011-06-23 21:22:24 +0000 | [diff] [blame] | 30 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 31 | struct FormatInfo { |
| 32 | Format format; |
| 33 | const char format_char; // One or more format characters that can be used for |
| 34 | // this format. |
| 35 | const char *format_name; // Long format name that can be used to specify the |
| 36 | // current format |
Greg Clayton | bb7f31f | 2011-06-23 21:22:24 +0000 | [diff] [blame] | 37 | }; |
| 38 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 39 | static FormatInfo g_format_infos[] = { |
| 40 | {eFormatDefault, '\0', "default"}, |
| 41 | {eFormatBoolean, 'B', "boolean"}, |
| 42 | {eFormatBinary, 'b', "binary"}, |
| 43 | {eFormatBytes, 'y', "bytes"}, |
| 44 | {eFormatBytesWithASCII, 'Y', "bytes with ASCII"}, |
| 45 | {eFormatChar, 'c', "character"}, |
| 46 | {eFormatCharPrintable, 'C', "printable character"}, |
| 47 | {eFormatComplexFloat, 'F', "complex float"}, |
| 48 | {eFormatCString, 's', "c-string"}, |
| 49 | {eFormatDecimal, 'd', "decimal"}, |
| 50 | {eFormatEnum, 'E', "enumeration"}, |
| 51 | {eFormatHex, 'x', "hex"}, |
| 52 | {eFormatHexUppercase, 'X', "uppercase hex"}, |
| 53 | {eFormatFloat, 'f', "float"}, |
| 54 | {eFormatOctal, 'o', "octal"}, |
| 55 | {eFormatOSType, 'O', "OSType"}, |
| 56 | {eFormatUnicode16, 'U', "unicode16"}, |
| 57 | {eFormatUnicode32, '\0', "unicode32"}, |
| 58 | {eFormatUnsigned, 'u', "unsigned decimal"}, |
| 59 | {eFormatPointer, 'p', "pointer"}, |
| 60 | {eFormatVectorOfChar, '\0', "char[]"}, |
| 61 | {eFormatVectorOfSInt8, '\0', "int8_t[]"}, |
| 62 | {eFormatVectorOfUInt8, '\0', "uint8_t[]"}, |
| 63 | {eFormatVectorOfSInt16, '\0', "int16_t[]"}, |
| 64 | {eFormatVectorOfUInt16, '\0', "uint16_t[]"}, |
| 65 | {eFormatVectorOfSInt32, '\0', "int32_t[]"}, |
| 66 | {eFormatVectorOfUInt32, '\0', "uint32_t[]"}, |
| 67 | {eFormatVectorOfSInt64, '\0', "int64_t[]"}, |
| 68 | {eFormatVectorOfUInt64, '\0', "uint64_t[]"}, |
| 69 | {eFormatVectorOfFloat16, '\0', "float16[]"}, |
| 70 | {eFormatVectorOfFloat32, '\0', "float32[]"}, |
| 71 | {eFormatVectorOfFloat64, '\0', "float64[]"}, |
| 72 | {eFormatVectorOfUInt128, '\0', "uint128_t[]"}, |
| 73 | {eFormatComplexInteger, 'I', "complex integer"}, |
| 74 | {eFormatCharArray, 'a', "character array"}, |
| 75 | {eFormatAddressInfo, 'A', "address"}, |
| 76 | {eFormatHexFloat, '\0', "hex float"}, |
| 77 | {eFormatInstruction, 'i', "instruction"}, |
| 78 | {eFormatVoid, 'v', "void"}}; |
Greg Clayton | bb7f31f | 2011-06-23 21:22:24 +0000 | [diff] [blame] | 79 | |
Saleem Abdulrasool | 2860695 | 2014-06-27 05:17:41 +0000 | [diff] [blame] | 80 | static uint32_t g_num_format_infos = llvm::array_lengthof(g_format_infos); |
Greg Clayton | bb7f31f | 2011-06-23 21:22:24 +0000 | [diff] [blame] | 81 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 82 | static bool GetFormatFromFormatChar(char format_char, Format &format) { |
| 83 | for (uint32_t i = 0; i < g_num_format_infos; ++i) { |
| 84 | if (g_format_infos[i].format_char == format_char) { |
| 85 | format = g_format_infos[i].format; |
| 86 | return true; |
Greg Clayton | bb7f31f | 2011-06-23 21:22:24 +0000 | [diff] [blame] | 87 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 88 | } |
| 89 | format = eFormatInvalid; |
| 90 | return false; |
| 91 | } |
| 92 | |
| 93 | static bool GetFormatFromFormatName(const char *format_name, |
| 94 | bool partial_match_ok, Format &format) { |
| 95 | uint32_t i; |
| 96 | for (i = 0; i < g_num_format_infos; ++i) { |
| 97 | if (strcasecmp(g_format_infos[i].format_name, format_name) == 0) { |
| 98 | format = g_format_infos[i].format; |
| 99 | return true; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | if (partial_match_ok) { |
| 104 | for (i = 0; i < g_num_format_infos; ++i) { |
| 105 | if (strcasestr(g_format_infos[i].format_name, format_name) == |
| 106 | g_format_infos[i].format_name) { |
| 107 | format = g_format_infos[i].format; |
| 108 | return true; |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | format = eFormatInvalid; |
| 113 | return false; |
| 114 | } |
| 115 | |
| 116 | void FormatManager::Changed() { |
| 117 | ++m_last_revision; |
| 118 | m_format_cache.Clear(); |
| 119 | std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex); |
| 120 | for (auto &iter : m_language_categories_map) { |
| 121 | if (iter.second) |
| 122 | iter.second->GetFormatCache().Clear(); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | bool FormatManager::GetFormatFromCString(const char *format_cstr, |
| 127 | bool partial_match_ok, |
| 128 | lldb::Format &format) { |
| 129 | bool success = false; |
| 130 | if (format_cstr && format_cstr[0]) { |
| 131 | if (format_cstr[1] == '\0') { |
| 132 | success = GetFormatFromFormatChar(format_cstr[0], format); |
| 133 | if (success) |
| 134 | return true; |
| 135 | } |
| 136 | |
| 137 | success = GetFormatFromFormatName(format_cstr, partial_match_ok, format); |
| 138 | } |
| 139 | if (!success) |
Greg Clayton | bb7f31f | 2011-06-23 21:22:24 +0000 | [diff] [blame] | 140 | format = eFormatInvalid; |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 141 | return success; |
Greg Clayton | bb7f31f | 2011-06-23 21:22:24 +0000 | [diff] [blame] | 142 | } |
| 143 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 144 | char FormatManager::GetFormatAsFormatChar(lldb::Format format) { |
| 145 | for (uint32_t i = 0; i < g_num_format_infos; ++i) { |
| 146 | if (g_format_infos[i].format == format) |
| 147 | return g_format_infos[i].format_char; |
| 148 | } |
| 149 | return '\0'; |
Greg Clayton | bb7f31f | 2011-06-23 21:22:24 +0000 | [diff] [blame] | 150 | } |
| 151 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 152 | const char *FormatManager::GetFormatAsCString(Format format) { |
| 153 | if (format >= eFormatDefault && format < kNumFormats) |
| 154 | return g_format_infos[format].format_name; |
| 155 | return NULL; |
Enrico Granata | bd5eab8 | 2015-12-15 02:20:48 +0000 | [diff] [blame] | 156 | } |
| 157 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 158 | void FormatManager::EnableAllCategories() { |
| 159 | m_categories_map.EnableAllCategories(); |
| 160 | std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex); |
| 161 | for (auto &iter : m_language_categories_map) { |
| 162 | if (iter.second) |
| 163 | iter.second->Enable(); |
| 164 | } |
Greg Clayton | bb7f31f | 2011-06-23 21:22:24 +0000 | [diff] [blame] | 165 | } |
| 166 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 167 | void FormatManager::DisableAllCategories() { |
| 168 | m_categories_map.DisableAllCategories(); |
| 169 | std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex); |
| 170 | for (auto &iter : m_language_categories_map) { |
| 171 | if (iter.second) |
| 172 | iter.second->Disable(); |
| 173 | } |
Greg Clayton | bb7f31f | 2011-06-23 21:22:24 +0000 | [diff] [blame] | 174 | } |
Greg Clayton | bb7f31f | 2011-06-23 21:22:24 +0000 | [diff] [blame] | 175 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 176 | void FormatManager::GetPossibleMatches( |
| 177 | ValueObject &valobj, CompilerType compiler_type, uint32_t reason, |
| 178 | lldb::DynamicValueType use_dynamic, FormattersMatchVector &entries, |
| 179 | bool did_strip_ptr, bool did_strip_ref, bool did_strip_typedef, |
| 180 | bool root_level) { |
| 181 | compiler_type = compiler_type.GetTypeForFormatters(); |
| 182 | ConstString type_name(compiler_type.GetConstTypeName()); |
| 183 | if (valobj.GetBitfieldBitSize() > 0) { |
| 184 | StreamString sstring; |
| 185 | sstring.Printf("%s:%d", type_name.AsCString(), valobj.GetBitfieldBitSize()); |
| 186 | ConstString bitfieldname = ConstString(sstring.GetData()); |
| 187 | entries.push_back( |
| 188 | {bitfieldname, 0, did_strip_ptr, did_strip_ref, did_strip_typedef}); |
| 189 | reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField; |
| 190 | } |
Enrico Granata | 0a3958e | 2011-07-02 00:25:22 +0000 | [diff] [blame] | 191 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 192 | if (!compiler_type.IsMeaninglessWithoutDynamicResolution()) { |
| 193 | entries.push_back( |
| 194 | {type_name, reason, did_strip_ptr, did_strip_ref, did_strip_typedef}); |
| 195 | |
| 196 | ConstString display_type_name(compiler_type.GetDisplayTypeName()); |
| 197 | if (display_type_name != type_name) |
| 198 | entries.push_back({display_type_name, reason, did_strip_ptr, |
| 199 | did_strip_ref, did_strip_typedef}); |
| 200 | } |
| 201 | |
| 202 | for (bool is_rvalue_ref = true, j = true; |
| 203 | j && compiler_type.IsReferenceType(nullptr, &is_rvalue_ref); j = false) { |
| 204 | CompilerType non_ref_type = compiler_type.GetNonReferenceType(); |
| 205 | GetPossibleMatches( |
| 206 | valobj, non_ref_type, |
| 207 | reason | |
| 208 | lldb_private::eFormatterChoiceCriterionStrippedPointerReference, |
| 209 | use_dynamic, entries, did_strip_ptr, true, did_strip_typedef); |
| 210 | if (non_ref_type.IsTypedefType()) { |
| 211 | CompilerType deffed_referenced_type = non_ref_type.GetTypedefedType(); |
| 212 | deffed_referenced_type = |
| 213 | is_rvalue_ref ? deffed_referenced_type.GetRValueReferenceType() |
| 214 | : deffed_referenced_type.GetLValueReferenceType(); |
| 215 | GetPossibleMatches( |
| 216 | valobj, deffed_referenced_type, |
| 217 | reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs, |
| 218 | use_dynamic, entries, did_strip_ptr, did_strip_ref, |
| 219 | true); // this is not exactly the usual meaning of stripping typedefs |
Enrico Granata | 33e97e6 | 2015-09-04 21:01:18 +0000 | [diff] [blame] | 220 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 221 | } |
Enrico Granata | 33e97e6 | 2015-09-04 21:01:18 +0000 | [diff] [blame] | 222 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 223 | if (compiler_type.IsPointerType()) { |
| 224 | CompilerType non_ptr_type = compiler_type.GetPointeeType(); |
| 225 | GetPossibleMatches( |
| 226 | valobj, non_ptr_type, |
| 227 | reason | |
| 228 | lldb_private::eFormatterChoiceCriterionStrippedPointerReference, |
| 229 | use_dynamic, entries, true, did_strip_ref, did_strip_typedef); |
| 230 | if (non_ptr_type.IsTypedefType()) { |
| 231 | CompilerType deffed_pointed_type = |
| 232 | non_ptr_type.GetTypedefedType().GetPointerType(); |
| 233 | GetPossibleMatches( |
| 234 | valobj, deffed_pointed_type, |
| 235 | reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs, |
| 236 | use_dynamic, entries, did_strip_ptr, did_strip_ref, |
| 237 | true); // this is not exactly the usual meaning of stripping typedefs |
Enrico Granata | 33e97e6 | 2015-09-04 21:01:18 +0000 | [diff] [blame] | 238 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 239 | } |
Enrico Granata | 33e97e6 | 2015-09-04 21:01:18 +0000 | [diff] [blame] | 240 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 241 | for (lldb::LanguageType language_type : GetCandidateLanguages(valobj)) { |
| 242 | if (Language *language = Language::FindPlugin(language_type)) { |
| 243 | for (ConstString candidate : |
| 244 | language->GetPossibleFormattersMatches(valobj, use_dynamic)) { |
| 245 | entries.push_back( |
| 246 | {candidate, |
| 247 | reason | lldb_private::eFormatterChoiceCriterionLanguagePlugin, |
| 248 | did_strip_ptr, did_strip_ref, did_strip_typedef}); |
| 249 | } |
Enrico Granata | de61cec | 2013-11-22 00:02:13 +0000 | [diff] [blame] | 250 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 251 | } |
Enrico Granata | e8daa2f | 2014-05-17 19:14:17 +0000 | [diff] [blame] | 252 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 253 | // try to strip typedef chains |
| 254 | if (compiler_type.IsTypedefType()) { |
| 255 | CompilerType deffed_type = compiler_type.GetTypedefedType(); |
| 256 | GetPossibleMatches( |
| 257 | valobj, deffed_type, |
| 258 | reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs, |
| 259 | use_dynamic, entries, did_strip_ptr, did_strip_ref, true); |
| 260 | } |
Enrico Granata | b3f0c34 | 2015-10-20 00:13:19 +0000 | [diff] [blame] | 261 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 262 | if (root_level) { |
| 263 | do { |
| 264 | if (!compiler_type.IsValid()) |
| 265 | break; |
Enrico Granata | e8daa2f | 2014-05-17 19:14:17 +0000 | [diff] [blame] | 266 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 267 | CompilerType unqual_compiler_ast_type = |
| 268 | compiler_type.GetFullyUnqualifiedType(); |
| 269 | if (!unqual_compiler_ast_type.IsValid()) |
| 270 | break; |
| 271 | if (unqual_compiler_ast_type.GetOpaqueQualType() != |
| 272 | compiler_type.GetOpaqueQualType()) |
| 273 | GetPossibleMatches(valobj, unqual_compiler_ast_type, reason, |
| 274 | use_dynamic, entries, did_strip_ptr, did_strip_ref, |
Enrico Granata | de61cec | 2013-11-22 00:02:13 +0000 | [diff] [blame] | 275 | did_strip_typedef); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 276 | } while (false); |
| 277 | |
| 278 | // if all else fails, go to static type |
| 279 | if (valobj.IsDynamic()) { |
| 280 | lldb::ValueObjectSP static_value_sp(valobj.GetStaticValue()); |
| 281 | if (static_value_sp) |
| 282 | GetPossibleMatches( |
| 283 | *static_value_sp.get(), static_value_sp->GetCompilerType(), |
| 284 | reason | lldb_private::eFormatterChoiceCriterionWentToStaticValue, |
| 285 | use_dynamic, entries, did_strip_ptr, did_strip_ref, |
| 286 | did_strip_typedef, true); |
Enrico Granata | de61cec | 2013-11-22 00:02:13 +0000 | [diff] [blame] | 287 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 288 | } |
Enrico Granata | de61cec | 2013-11-22 00:02:13 +0000 | [diff] [blame] | 289 | } |
| 290 | |
Enrico Granata | 852cc95 | 2013-10-08 19:03:22 +0000 | [diff] [blame] | 291 | lldb::TypeFormatImplSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 292 | FormatManager::GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp) { |
| 293 | if (!type_sp) |
| 294 | return lldb::TypeFormatImplSP(); |
| 295 | lldb::TypeFormatImplSP format_chosen_sp; |
| 296 | uint32_t num_categories = m_categories_map.GetCount(); |
| 297 | lldb::TypeCategoryImplSP category_sp; |
| 298 | uint32_t prio_category = UINT32_MAX; |
| 299 | for (uint32_t category_id = 0; category_id < num_categories; category_id++) { |
| 300 | category_sp = GetCategoryAtIndex(category_id); |
| 301 | if (category_sp->IsEnabled() == false) |
| 302 | continue; |
| 303 | lldb::TypeFormatImplSP format_current_sp = |
| 304 | category_sp->GetFormatForType(type_sp); |
| 305 | if (format_current_sp && |
| 306 | (format_chosen_sp.get() == NULL || |
| 307 | (prio_category > category_sp->GetEnabledPosition()))) { |
| 308 | prio_category = category_sp->GetEnabledPosition(); |
| 309 | format_chosen_sp = format_current_sp; |
Enrico Granata | 852cc95 | 2013-10-08 19:03:22 +0000 | [diff] [blame] | 310 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 311 | } |
| 312 | return format_chosen_sp; |
Enrico Granata | 852cc95 | 2013-10-08 19:03:22 +0000 | [diff] [blame] | 313 | } |
| 314 | |
Enrico Granata | a777dc2 | 2012-05-08 21:49:57 +0000 | [diff] [blame] | 315 | lldb::TypeSummaryImplSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 316 | FormatManager::GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp) { |
| 317 | if (!type_sp) |
| 318 | return lldb::TypeSummaryImplSP(); |
| 319 | lldb::TypeSummaryImplSP summary_chosen_sp; |
| 320 | uint32_t num_categories = m_categories_map.GetCount(); |
| 321 | lldb::TypeCategoryImplSP category_sp; |
| 322 | uint32_t prio_category = UINT32_MAX; |
| 323 | for (uint32_t category_id = 0; category_id < num_categories; category_id++) { |
| 324 | category_sp = GetCategoryAtIndex(category_id); |
| 325 | if (category_sp->IsEnabled() == false) |
| 326 | continue; |
| 327 | lldb::TypeSummaryImplSP summary_current_sp = |
| 328 | category_sp->GetSummaryForType(type_sp); |
| 329 | if (summary_current_sp && |
| 330 | (summary_chosen_sp.get() == NULL || |
| 331 | (prio_category > category_sp->GetEnabledPosition()))) { |
| 332 | prio_category = category_sp->GetEnabledPosition(); |
| 333 | summary_chosen_sp = summary_current_sp; |
Enrico Granata | a777dc2 | 2012-05-08 21:49:57 +0000 | [diff] [blame] | 334 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 335 | } |
| 336 | return summary_chosen_sp; |
Enrico Granata | a777dc2 | 2012-05-08 21:49:57 +0000 | [diff] [blame] | 337 | } |
| 338 | |
| 339 | lldb::TypeFilterImplSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 340 | FormatManager::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) { |
| 341 | if (!type_sp) |
| 342 | return lldb::TypeFilterImplSP(); |
| 343 | lldb::TypeFilterImplSP filter_chosen_sp; |
| 344 | uint32_t num_categories = m_categories_map.GetCount(); |
| 345 | lldb::TypeCategoryImplSP category_sp; |
| 346 | uint32_t prio_category = UINT32_MAX; |
| 347 | for (uint32_t category_id = 0; category_id < num_categories; category_id++) { |
| 348 | category_sp = GetCategoryAtIndex(category_id); |
| 349 | if (category_sp->IsEnabled() == false) |
| 350 | continue; |
| 351 | lldb::TypeFilterImplSP filter_current_sp( |
| 352 | (TypeFilterImpl *)category_sp->GetFilterForType(type_sp).get()); |
| 353 | if (filter_current_sp && |
| 354 | (filter_chosen_sp.get() == NULL || |
| 355 | (prio_category > category_sp->GetEnabledPosition()))) { |
| 356 | prio_category = category_sp->GetEnabledPosition(); |
| 357 | filter_chosen_sp = filter_current_sp; |
Enrico Granata | a777dc2 | 2012-05-08 21:49:57 +0000 | [diff] [blame] | 358 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 359 | } |
| 360 | return filter_chosen_sp; |
Enrico Granata | a777dc2 | 2012-05-08 21:49:57 +0000 | [diff] [blame] | 361 | } |
| 362 | |
Jason Molenda | 7a9a72b | 2012-05-16 00:38:08 +0000 | [diff] [blame] | 363 | #ifndef LLDB_DISABLE_PYTHON |
Enrico Granata | 5548cb5 | 2013-01-28 23:47:25 +0000 | [diff] [blame] | 364 | lldb::ScriptedSyntheticChildrenSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 365 | FormatManager::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) { |
| 366 | if (!type_sp) |
| 367 | return lldb::ScriptedSyntheticChildrenSP(); |
| 368 | lldb::ScriptedSyntheticChildrenSP synth_chosen_sp; |
| 369 | uint32_t num_categories = m_categories_map.GetCount(); |
| 370 | lldb::TypeCategoryImplSP category_sp; |
| 371 | uint32_t prio_category = UINT32_MAX; |
| 372 | for (uint32_t category_id = 0; category_id < num_categories; category_id++) { |
| 373 | category_sp = GetCategoryAtIndex(category_id); |
| 374 | if (category_sp->IsEnabled() == false) |
| 375 | continue; |
| 376 | lldb::ScriptedSyntheticChildrenSP synth_current_sp( |
| 377 | (ScriptedSyntheticChildren *)category_sp->GetSyntheticForType(type_sp) |
| 378 | .get()); |
| 379 | if (synth_current_sp && |
| 380 | (synth_chosen_sp.get() == NULL || |
| 381 | (prio_category > category_sp->GetEnabledPosition()))) { |
| 382 | prio_category = category_sp->GetEnabledPosition(); |
| 383 | synth_chosen_sp = synth_current_sp; |
Enrico Granata | a777dc2 | 2012-05-08 21:49:57 +0000 | [diff] [blame] | 384 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 385 | } |
| 386 | return synth_chosen_sp; |
Enrico Granata | a777dc2 | 2012-05-08 21:49:57 +0000 | [diff] [blame] | 387 | } |
Jason Molenda | 7a9a72b | 2012-05-16 00:38:08 +0000 | [diff] [blame] | 388 | #endif |
Enrico Granata | a777dc2 | 2012-05-08 21:49:57 +0000 | [diff] [blame] | 389 | |
Jason Molenda | 7a9a72b | 2012-05-16 00:38:08 +0000 | [diff] [blame] | 390 | #ifndef LLDB_DISABLE_PYTHON |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 391 | lldb::SyntheticChildrenSP FormatManager::GetSyntheticChildrenForType( |
| 392 | lldb::TypeNameSpecifierImplSP type_sp) { |
| 393 | if (!type_sp) |
| 394 | return lldb::SyntheticChildrenSP(); |
| 395 | lldb::TypeFilterImplSP filter_sp = GetFilterForType(type_sp); |
| 396 | lldb::ScriptedSyntheticChildrenSP synth_sp = GetSyntheticForType(type_sp); |
| 397 | if (filter_sp->GetRevision() > synth_sp->GetRevision()) |
| 398 | return lldb::SyntheticChildrenSP(filter_sp.get()); |
| 399 | else |
| 400 | return lldb::SyntheticChildrenSP(synth_sp.get()); |
Enrico Granata | a777dc2 | 2012-05-08 21:49:57 +0000 | [diff] [blame] | 401 | } |
Jason Molenda | 7a9a72b | 2012-05-16 00:38:08 +0000 | [diff] [blame] | 402 | #endif |
Enrico Granata | a777dc2 | 2012-05-08 21:49:57 +0000 | [diff] [blame] | 403 | |
Enrico Granata | c582713 | 2014-09-05 20:45:07 +0000 | [diff] [blame] | 404 | lldb::TypeValidatorImplSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 405 | FormatManager::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) { |
| 406 | if (!type_sp) |
| 407 | return lldb::TypeValidatorImplSP(); |
| 408 | lldb::TypeValidatorImplSP validator_chosen_sp; |
| 409 | uint32_t num_categories = m_categories_map.GetCount(); |
| 410 | lldb::TypeCategoryImplSP category_sp; |
| 411 | uint32_t prio_category = UINT32_MAX; |
| 412 | for (uint32_t category_id = 0; category_id < num_categories; category_id++) { |
| 413 | category_sp = GetCategoryAtIndex(category_id); |
| 414 | if (category_sp->IsEnabled() == false) |
| 415 | continue; |
| 416 | lldb::TypeValidatorImplSP validator_current_sp( |
| 417 | category_sp->GetValidatorForType(type_sp).get()); |
| 418 | if (validator_current_sp && |
| 419 | (validator_chosen_sp.get() == NULL || |
| 420 | (prio_category > category_sp->GetEnabledPosition()))) { |
| 421 | prio_category = category_sp->GetEnabledPosition(); |
| 422 | validator_chosen_sp = validator_current_sp; |
Enrico Granata | c582713 | 2014-09-05 20:45:07 +0000 | [diff] [blame] | 423 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 424 | } |
| 425 | return validator_chosen_sp; |
Enrico Granata | c582713 | 2014-09-05 20:45:07 +0000 | [diff] [blame] | 426 | } |
| 427 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 428 | void FormatManager::ForEachCategory(TypeCategoryMap::ForEachCallback callback) { |
| 429 | m_categories_map.ForEach(callback); |
| 430 | std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex); |
| 431 | for (const auto &entry : m_language_categories_map) { |
| 432 | if (auto category_sp = entry.second->GetCategory()) { |
| 433 | if (!callback(category_sp)) |
| 434 | break; |
Enrico Granata | b56d010 | 2015-11-14 05:44:23 +0000 | [diff] [blame] | 435 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 436 | } |
Enrico Granata | b56d010 | 2015-11-14 05:44:23 +0000 | [diff] [blame] | 437 | } |
| 438 | |
Enrico Granata | 061858c | 2012-02-15 02:34:21 +0000 | [diff] [blame] | 439 | lldb::TypeCategoryImplSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 440 | FormatManager::GetCategory(const ConstString &category_name, bool can_create) { |
| 441 | if (!category_name) |
| 442 | return GetCategory(m_default_category_name); |
| 443 | lldb::TypeCategoryImplSP category; |
| 444 | if (m_categories_map.Get(category_name, category)) |
| 445 | return category; |
| 446 | |
| 447 | if (!can_create) |
| 448 | return lldb::TypeCategoryImplSP(); |
| 449 | |
| 450 | m_categories_map.Add( |
| 451 | category_name, |
| 452 | lldb::TypeCategoryImplSP(new TypeCategoryImpl(this, category_name))); |
| 453 | return GetCategory(category_name); |
Enrico Granata | dc94073 | 2011-08-23 00:32:52 +0000 | [diff] [blame] | 454 | } |
| 455 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 456 | lldb::Format FormatManager::GetSingleItemFormat(lldb::Format vector_format) { |
| 457 | switch (vector_format) { |
| 458 | case eFormatVectorOfChar: |
| 459 | return eFormatCharArray; |
| 460 | |
| 461 | case eFormatVectorOfSInt8: |
| 462 | case eFormatVectorOfSInt16: |
| 463 | case eFormatVectorOfSInt32: |
| 464 | case eFormatVectorOfSInt64: |
| 465 | return eFormatDecimal; |
| 466 | |
| 467 | case eFormatVectorOfUInt8: |
| 468 | case eFormatVectorOfUInt16: |
| 469 | case eFormatVectorOfUInt32: |
| 470 | case eFormatVectorOfUInt64: |
| 471 | case eFormatVectorOfUInt128: |
| 472 | return eFormatHex; |
| 473 | |
| 474 | case eFormatVectorOfFloat16: |
| 475 | case eFormatVectorOfFloat32: |
| 476 | case eFormatVectorOfFloat64: |
| 477 | return eFormatFloat; |
| 478 | |
| 479 | default: |
| 480 | return lldb::eFormatInvalid; |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | bool FormatManager::ShouldPrintAsOneLiner(ValueObject &valobj) { |
| 485 | // if settings say no oneline whatsoever |
| 486 | if (valobj.GetTargetSP().get() && |
| 487 | valobj.GetTargetSP()->GetDebugger().GetAutoOneLineSummaries() == false) |
| 488 | return false; // then don't oneline |
| 489 | |
| 490 | // if this object has a summary, then ask the summary |
| 491 | if (valobj.GetSummaryFormat().get() != nullptr) |
| 492 | return valobj.GetSummaryFormat()->IsOneLiner(); |
| 493 | |
| 494 | // no children, no party |
| 495 | if (valobj.GetNumChildren() == 0) |
| 496 | return false; |
| 497 | |
| 498 | // ask the type if it has any opinion about this |
| 499 | // eLazyBoolCalculate == no opinion; other values should be self explanatory |
| 500 | CompilerType compiler_type(valobj.GetCompilerType()); |
| 501 | if (compiler_type.IsValid()) { |
| 502 | switch (compiler_type.ShouldPrintAsOneLiner(&valobj)) { |
| 503 | case eLazyBoolNo: |
| 504 | return false; |
| 505 | case eLazyBoolYes: |
| 506 | return true; |
| 507 | case eLazyBoolCalculate: |
| 508 | break; |
Enrico Granata | f4efecd | 2011-07-12 22:56:10 +0000 | [diff] [blame] | 509 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 510 | } |
Enrico Granata | c482a19 | 2011-08-17 22:13:59 +0000 | [diff] [blame] | 511 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 512 | size_t total_children_name_len = 0; |
| 513 | |
| 514 | for (size_t idx = 0; idx < valobj.GetNumChildren(); idx++) { |
| 515 | bool is_synth_val = false; |
| 516 | ValueObjectSP child_sp(valobj.GetChildAtIndex(idx, true)); |
| 517 | // something is wrong here - bail out |
| 518 | if (!child_sp) |
| 519 | return false; |
| 520 | |
| 521 | // also ask the child's type if it has any opinion |
| 522 | CompilerType child_compiler_type(child_sp->GetCompilerType()); |
| 523 | if (child_compiler_type.IsValid()) { |
| 524 | switch (child_compiler_type.ShouldPrintAsOneLiner(child_sp.get())) { |
| 525 | case eLazyBoolYes: |
| 526 | // an opinion of yes is only binding for the child, so keep going |
| 527 | case eLazyBoolCalculate: |
| 528 | break; |
| 529 | case eLazyBoolNo: |
| 530 | // but if the child says no, then it's a veto on the whole thing |
Enrico Granata | a29cb0b | 2013-10-04 23:14:13 +0000 | [diff] [blame] | 531 | return false; |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 532 | } |
Enrico Granata | 9c63f99 | 2015-09-23 02:04:34 +0000 | [diff] [blame] | 533 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 534 | |
| 535 | // if we decided to define synthetic children for a type, we probably care |
| 536 | // enough |
| 537 | // to show them, but avoid nesting children in children |
| 538 | if (child_sp->GetSyntheticChildren().get() != nullptr) { |
| 539 | ValueObjectSP synth_sp(child_sp->GetSyntheticValue()); |
| 540 | // wait.. wat? just get out of here.. |
| 541 | if (!synth_sp) |
| 542 | return false; |
| 543 | // but if we only have them to provide a value, keep going |
| 544 | if (synth_sp->MightHaveChildren() == false && |
| 545 | synth_sp->DoesProvideSyntheticValue()) |
| 546 | is_synth_val = true; |
| 547 | else |
| 548 | return false; |
Enrico Granata | a29cb0b | 2013-10-04 23:14:13 +0000 | [diff] [blame] | 549 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 550 | |
| 551 | total_children_name_len += child_sp->GetName().GetLength(); |
| 552 | |
| 553 | // 50 itself is a "randomly" chosen number - the idea is that |
| 554 | // overly long structs should not get this treatment |
| 555 | // FIXME: maybe make this a user-tweakable setting? |
| 556 | if (total_children_name_len > 50) |
| 557 | return false; |
| 558 | |
| 559 | // if a summary is there.. |
| 560 | if (child_sp->GetSummaryFormat()) { |
| 561 | // and it wants children, then bail out |
| 562 | if (child_sp->GetSummaryFormat()->DoesPrintChildren(child_sp.get())) |
| 563 | return false; |
| 564 | } |
| 565 | |
| 566 | // if this child has children.. |
| 567 | if (child_sp->GetNumChildren()) { |
| 568 | // ...and no summary... |
| 569 | // (if it had a summary and the summary wanted children, we would have |
| 570 | // bailed out anyway |
| 571 | // so this only makes us bail out if this has no summary and we would |
| 572 | // then print children) |
| 573 | if (!child_sp->GetSummaryFormat() && !is_synth_val) // but again only do |
| 574 | // that if not a |
| 575 | // synthetic valued |
| 576 | // child |
| 577 | return false; // then bail out |
| 578 | } |
| 579 | } |
| 580 | return true; |
Enrico Granata | a29cb0b | 2013-10-04 23:14:13 +0000 | [diff] [blame] | 581 | } |
| 582 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 583 | ConstString FormatManager::GetValidTypeName(const ConstString &type) { |
| 584 | return ::GetValidTypeName_Impl(type); |
Enrico Granata | 02b6676 | 2011-08-19 01:14:49 +0000 | [diff] [blame] | 585 | } |
| 586 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 587 | ConstString FormatManager::GetTypeForCache(ValueObject &valobj, |
| 588 | lldb::DynamicValueType use_dynamic) { |
| 589 | ValueObjectSP valobj_sp = valobj.GetQualifiedRepresentationIfAvailable( |
| 590 | use_dynamic, valobj.IsSynthetic()); |
| 591 | if (valobj_sp && valobj_sp->GetCompilerType().IsValid()) { |
| 592 | if (!valobj_sp->GetCompilerType().IsMeaninglessWithoutDynamicResolution()) |
| 593 | return valobj_sp->GetQualifiedTypeName(); |
| 594 | } |
| 595 | return ConstString(); |
Enrico Granata | 5548cb5 | 2013-01-28 23:47:25 +0000 | [diff] [blame] | 596 | } |
| 597 | |
Enrico Granata | d3233c1 | 2015-09-09 01:10:46 +0000 | [diff] [blame] | 598 | std::vector<lldb::LanguageType> |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 599 | FormatManager::GetCandidateLanguages(ValueObject &valobj) { |
| 600 | lldb::LanguageType lang_type = valobj.GetObjectRuntimeLanguage(); |
| 601 | return GetCandidateLanguages(lang_type); |
Enrico Granata | ac49453 | 2015-09-09 22:30:24 +0000 | [diff] [blame] | 602 | } |
| 603 | |
| 604 | std::vector<lldb::LanguageType> |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 605 | FormatManager::GetCandidateLanguages(lldb::LanguageType lang_type) { |
| 606 | switch (lang_type) { |
| 607 | case lldb::eLanguageTypeC: |
| 608 | case lldb::eLanguageTypeC89: |
| 609 | case lldb::eLanguageTypeC99: |
| 610 | case lldb::eLanguageTypeC11: |
| 611 | case lldb::eLanguageTypeC_plus_plus: |
| 612 | case lldb::eLanguageTypeC_plus_plus_03: |
| 613 | case lldb::eLanguageTypeC_plus_plus_11: |
| 614 | case lldb::eLanguageTypeC_plus_plus_14: |
| 615 | return {lldb::eLanguageTypeC_plus_plus, lldb::eLanguageTypeObjC}; |
| 616 | default: |
| 617 | return {lang_type}; |
| 618 | } |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 619 | } |
| 620 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 621 | LanguageCategory * |
| 622 | FormatManager::GetCategoryForLanguage(lldb::LanguageType lang_type) { |
| 623 | std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex); |
| 624 | auto iter = m_language_categories_map.find(lang_type), |
| 625 | end = m_language_categories_map.end(); |
| 626 | if (iter != end) |
| 627 | return iter->second.get(); |
| 628 | LanguageCategory *lang_category = new LanguageCategory(lang_type); |
| 629 | m_language_categories_map[lang_type] = |
| 630 | LanguageCategory::UniquePointer(lang_category); |
| 631 | return lang_category; |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 632 | } |
| 633 | |
Enrico Granata | ecd02bc | 2014-08-19 18:47:58 +0000 | [diff] [blame] | 634 | lldb::TypeFormatImplSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 635 | FormatManager::GetHardcodedFormat(FormattersMatchData &match_data) { |
| 636 | TypeFormatImplSP retval_sp; |
Enrico Granata | 7cb59e1 | 2015-09-16 18:28:11 +0000 | [diff] [blame] | 637 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 638 | for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) { |
| 639 | if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) { |
| 640 | if (lang_category->GetHardcoded(*this, match_data, retval_sp)) |
| 641 | break; |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | return retval_sp; |
Enrico Granata | 686f3de | 2013-10-30 23:46:27 +0000 | [diff] [blame] | 646 | } |
| 647 | |
Enrico Granata | 852cc95 | 2013-10-08 19:03:22 +0000 | [diff] [blame] | 648 | lldb::TypeFormatImplSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 649 | FormatManager::GetFormat(ValueObject &valobj, |
| 650 | lldb::DynamicValueType use_dynamic) { |
| 651 | FormattersMatchData match_data(valobj, use_dynamic); |
| 652 | |
| 653 | TypeFormatImplSP retval; |
| 654 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); |
| 655 | if (match_data.GetTypeForCache()) { |
| 656 | if (log) |
| 657 | log->Printf( |
| 658 | "\n\n[FormatManager::GetFormat] Looking into cache for type %s", |
| 659 | match_data.GetTypeForCache().AsCString("<invalid>")); |
| 660 | if (m_format_cache.GetFormat(match_data.GetTypeForCache(), retval)) { |
| 661 | if (log) { |
| 662 | log->Printf( |
| 663 | "[FormatManager::GetFormat] Cache search success. Returning."); |
| 664 | if (log->GetDebug()) |
| 665 | log->Printf("[FormatManager::GetFormat] Cache hits: %" PRIu64 |
| 666 | " - Cache Misses: %" PRIu64, |
| 667 | m_format_cache.GetCacheHits(), |
| 668 | m_format_cache.GetCacheMisses()); |
| 669 | } |
| 670 | return retval; |
Enrico Granata | 52b4b6c | 2013-10-17 22:27:19 +0000 | [diff] [blame] | 671 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 672 | if (log) |
| 673 | log->Printf( |
| 674 | "[FormatManager::GetFormat] Cache search failed. Going normal route"); |
| 675 | } |
| 676 | |
| 677 | retval = m_categories_map.GetFormat(match_data); |
| 678 | if (!retval) { |
| 679 | if (log) |
| 680 | log->Printf("[FormatManager::GetFormat] Search failed. Giving language a " |
| 681 | "chance."); |
| 682 | for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) { |
| 683 | if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) { |
| 684 | if (lang_category->Get(match_data, retval)) |
| 685 | break; |
| 686 | } |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 687 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 688 | if (retval) { |
| 689 | if (log) |
| 690 | log->Printf( |
| 691 | "[FormatManager::GetFormat] Language search success. Returning."); |
| 692 | return retval; |
Enrico Granata | 686f3de | 2013-10-30 23:46:27 +0000 | [diff] [blame] | 693 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 694 | } |
| 695 | if (!retval) { |
| 696 | if (log) |
| 697 | log->Printf("[FormatManager::GetFormat] Search failed. Giving hardcoded " |
| 698 | "a chance."); |
| 699 | retval = GetHardcodedFormat(match_data); |
| 700 | } |
| 701 | |
| 702 | if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) { |
| 703 | if (log) |
| 704 | log->Printf("[FormatManager::GetFormat] Caching %p for type %s", |
| 705 | static_cast<void *>(retval.get()), |
| 706 | match_data.GetTypeForCache().AsCString("<invalid>")); |
| 707 | m_format_cache.SetFormat(match_data.GetTypeForCache(), retval); |
| 708 | } |
| 709 | if (log && log->GetDebug()) |
| 710 | log->Printf("[FormatManager::GetFormat] Cache hits: %" PRIu64 |
| 711 | " - Cache Misses: %" PRIu64, |
| 712 | m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); |
| 713 | return retval; |
Enrico Granata | 852cc95 | 2013-10-08 19:03:22 +0000 | [diff] [blame] | 714 | } |
| 715 | |
Enrico Granata | ecd02bc | 2014-08-19 18:47:58 +0000 | [diff] [blame] | 716 | lldb::TypeSummaryImplSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 717 | FormatManager::GetHardcodedSummaryFormat(FormattersMatchData &match_data) { |
| 718 | TypeSummaryImplSP retval_sp; |
| 719 | |
| 720 | for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) { |
| 721 | if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) { |
| 722 | if (lang_category->GetHardcoded(*this, match_data, retval_sp)) |
| 723 | break; |
Enrico Granata | ecd02bc | 2014-08-19 18:47:58 +0000 | [diff] [blame] | 724 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 725 | } |
| 726 | |
| 727 | return retval_sp; |
Enrico Granata | 686f3de | 2013-10-30 23:46:27 +0000 | [diff] [blame] | 728 | } |
| 729 | |
Enrico Granata | 5548cb5 | 2013-01-28 23:47:25 +0000 | [diff] [blame] | 730 | lldb::TypeSummaryImplSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 731 | FormatManager::GetSummaryFormat(ValueObject &valobj, |
| 732 | lldb::DynamicValueType use_dynamic) { |
| 733 | FormattersMatchData match_data(valobj, use_dynamic); |
| 734 | |
| 735 | TypeSummaryImplSP retval; |
| 736 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); |
| 737 | if (match_data.GetTypeForCache()) { |
| 738 | if (log) |
| 739 | log->Printf("\n\n[FormatManager::GetSummaryFormat] Looking into cache " |
| 740 | "for type %s", |
| 741 | match_data.GetTypeForCache().AsCString("<invalid>")); |
| 742 | if (m_format_cache.GetSummary(match_data.GetTypeForCache(), retval)) { |
| 743 | if (log) { |
| 744 | log->Printf("[FormatManager::GetSummaryFormat] Cache search success. " |
| 745 | "Returning."); |
| 746 | if (log->GetDebug()) |
| 747 | log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64 |
| 748 | " - Cache Misses: %" PRIu64, |
| 749 | m_format_cache.GetCacheHits(), |
| 750 | m_format_cache.GetCacheMisses()); |
| 751 | } |
| 752 | return retval; |
Enrico Granata | 5548cb5 | 2013-01-28 23:47:25 +0000 | [diff] [blame] | 753 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 754 | if (log) |
| 755 | log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. " |
| 756 | "Going normal route"); |
| 757 | } |
| 758 | |
| 759 | retval = m_categories_map.GetSummaryFormat(match_data); |
| 760 | if (!retval) { |
| 761 | if (log) |
| 762 | log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving " |
| 763 | "language a chance."); |
| 764 | for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) { |
| 765 | if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) { |
| 766 | if (lang_category->Get(match_data, retval)) |
| 767 | break; |
| 768 | } |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 769 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 770 | if (retval) { |
| 771 | if (log) |
| 772 | log->Printf("[FormatManager::GetSummaryFormat] Language search " |
| 773 | "success. Returning."); |
| 774 | return retval; |
Enrico Granata | 686f3de | 2013-10-30 23:46:27 +0000 | [diff] [blame] | 775 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 776 | } |
| 777 | if (!retval) { |
| 778 | if (log) |
| 779 | log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving " |
| 780 | "hardcoded a chance."); |
| 781 | retval = GetHardcodedSummaryFormat(match_data); |
| 782 | } |
| 783 | |
| 784 | if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) { |
| 785 | if (log) |
| 786 | log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s", |
| 787 | static_cast<void *>(retval.get()), |
| 788 | match_data.GetTypeForCache().AsCString("<invalid>")); |
| 789 | m_format_cache.SetSummary(match_data.GetTypeForCache(), retval); |
| 790 | } |
| 791 | if (log && log->GetDebug()) |
| 792 | log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64 |
| 793 | " - Cache Misses: %" PRIu64, |
| 794 | m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); |
| 795 | return retval; |
Enrico Granata | 5548cb5 | 2013-01-28 23:47:25 +0000 | [diff] [blame] | 796 | } |
| 797 | |
| 798 | #ifndef LLDB_DISABLE_PYTHON |
Enrico Granata | ecd02bc | 2014-08-19 18:47:58 +0000 | [diff] [blame] | 799 | lldb::SyntheticChildrenSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 800 | FormatManager::GetHardcodedSyntheticChildren(FormattersMatchData &match_data) { |
| 801 | SyntheticChildrenSP retval_sp; |
| 802 | |
| 803 | for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) { |
| 804 | if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) { |
| 805 | if (lang_category->GetHardcoded(*this, match_data, retval_sp)) |
| 806 | break; |
Enrico Granata | ecd02bc | 2014-08-19 18:47:58 +0000 | [diff] [blame] | 807 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 808 | } |
| 809 | |
| 810 | return retval_sp; |
Enrico Granata | 686f3de | 2013-10-30 23:46:27 +0000 | [diff] [blame] | 811 | } |
| 812 | |
Enrico Granata | 5548cb5 | 2013-01-28 23:47:25 +0000 | [diff] [blame] | 813 | lldb::SyntheticChildrenSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 814 | FormatManager::GetSyntheticChildren(ValueObject &valobj, |
| 815 | lldb::DynamicValueType use_dynamic) { |
| 816 | FormattersMatchData match_data(valobj, use_dynamic); |
| 817 | |
| 818 | SyntheticChildrenSP retval; |
| 819 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); |
| 820 | if (match_data.GetTypeForCache()) { |
| 821 | if (log) |
| 822 | log->Printf("\n\n[FormatManager::GetSyntheticChildren] Looking into " |
| 823 | "cache for type %s", |
| 824 | match_data.GetTypeForCache().AsCString("<invalid>")); |
| 825 | if (m_format_cache.GetSynthetic(match_data.GetTypeForCache(), retval)) { |
| 826 | if (log) { |
| 827 | log->Printf("[FormatManager::GetSyntheticChildren] Cache search " |
| 828 | "success. Returning."); |
| 829 | if (log->GetDebug()) |
| 830 | log->Printf( |
| 831 | "[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64 |
| 832 | " - Cache Misses: %" PRIu64, |
| 833 | m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); |
| 834 | } |
| 835 | return retval; |
Enrico Granata | 5548cb5 | 2013-01-28 23:47:25 +0000 | [diff] [blame] | 836 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 837 | if (log) |
| 838 | log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. " |
| 839 | "Going normal route"); |
| 840 | } |
| 841 | |
| 842 | retval = m_categories_map.GetSyntheticChildren(match_data); |
| 843 | if (!retval) { |
| 844 | if (log) |
| 845 | log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving " |
| 846 | "language a chance."); |
| 847 | for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) { |
| 848 | if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) { |
| 849 | if (lang_category->Get(match_data, retval)) |
| 850 | break; |
| 851 | } |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 852 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 853 | if (retval) { |
| 854 | if (log) |
| 855 | log->Printf("[FormatManager::GetSyntheticChildren] Language search " |
| 856 | "success. Returning."); |
| 857 | return retval; |
Enrico Granata | 686f3de | 2013-10-30 23:46:27 +0000 | [diff] [blame] | 858 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 859 | } |
| 860 | if (!retval) { |
| 861 | if (log) |
| 862 | log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving " |
| 863 | "hardcoded a chance."); |
| 864 | retval = GetHardcodedSyntheticChildren(match_data); |
| 865 | } |
| 866 | |
| 867 | if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) { |
| 868 | if (log) |
| 869 | log->Printf( |
| 870 | "[FormatManager::GetSyntheticChildren] Caching %p for type %s", |
| 871 | static_cast<void *>(retval.get()), |
| 872 | match_data.GetTypeForCache().AsCString("<invalid>")); |
| 873 | m_format_cache.SetSynthetic(match_data.GetTypeForCache(), retval); |
| 874 | } |
| 875 | if (log && log->GetDebug()) |
| 876 | log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64 |
| 877 | " - Cache Misses: %" PRIu64, |
| 878 | m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); |
| 879 | return retval; |
Enrico Granata | 5548cb5 | 2013-01-28 23:47:25 +0000 | [diff] [blame] | 880 | } |
| 881 | #endif |
Enrico Granata | 5548cb5 | 2013-01-28 23:47:25 +0000 | [diff] [blame] | 882 | |
Enrico Granata | c582713 | 2014-09-05 20:45:07 +0000 | [diff] [blame] | 883 | lldb::TypeValidatorImplSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 884 | FormatManager::GetValidator(ValueObject &valobj, |
| 885 | lldb::DynamicValueType use_dynamic) { |
| 886 | FormattersMatchData match_data(valobj, use_dynamic); |
| 887 | |
| 888 | TypeValidatorImplSP retval; |
| 889 | Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS)); |
| 890 | if (match_data.GetTypeForCache()) { |
| 891 | if (log) |
| 892 | log->Printf( |
| 893 | "\n\n[FormatManager::GetValidator] Looking into cache for type %s", |
| 894 | match_data.GetTypeForCache().AsCString("<invalid>")); |
| 895 | if (m_format_cache.GetValidator(match_data.GetTypeForCache(), retval)) { |
| 896 | if (log) { |
| 897 | log->Printf( |
| 898 | "[FormatManager::GetValidator] Cache search success. Returning."); |
| 899 | if (log->GetDebug()) |
| 900 | log->Printf("[FormatManager::GetValidator] Cache hits: %" PRIu64 |
| 901 | " - Cache Misses: %" PRIu64, |
| 902 | m_format_cache.GetCacheHits(), |
| 903 | m_format_cache.GetCacheMisses()); |
| 904 | } |
| 905 | return retval; |
Enrico Granata | c582713 | 2014-09-05 20:45:07 +0000 | [diff] [blame] | 906 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 907 | if (log) |
| 908 | log->Printf("[FormatManager::GetValidator] Cache search failed. Going " |
| 909 | "normal route"); |
| 910 | } |
| 911 | |
| 912 | retval = m_categories_map.GetValidator(match_data); |
| 913 | if (!retval) { |
| 914 | if (log) |
| 915 | log->Printf("[FormatManager::GetValidator] Search failed. Giving " |
| 916 | "language a chance."); |
| 917 | for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) { |
| 918 | if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) { |
| 919 | if (lang_category->Get(match_data, retval)) |
| 920 | break; |
| 921 | } |
Enrico Granata | 980c048 | 2015-09-01 18:22:39 +0000 | [diff] [blame] | 922 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 923 | if (retval) { |
| 924 | if (log) |
| 925 | log->Printf("[FormatManager::GetValidator] Language search success. " |
| 926 | "Returning."); |
| 927 | return retval; |
Enrico Granata | c582713 | 2014-09-05 20:45:07 +0000 | [diff] [blame] | 928 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 929 | } |
| 930 | if (!retval) { |
| 931 | if (log) |
| 932 | log->Printf("[FormatManager::GetValidator] Search failed. Giving " |
| 933 | "hardcoded a chance."); |
| 934 | retval = GetHardcodedValidator(match_data); |
| 935 | } |
| 936 | |
| 937 | if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) { |
| 938 | if (log) |
| 939 | log->Printf("[FormatManager::GetValidator] Caching %p for type %s", |
| 940 | static_cast<void *>(retval.get()), |
| 941 | match_data.GetTypeForCache().AsCString("<invalid>")); |
| 942 | m_format_cache.SetValidator(match_data.GetTypeForCache(), retval); |
| 943 | } |
| 944 | if (log && log->GetDebug()) |
| 945 | log->Printf("[FormatManager::GetValidator] Cache hits: %" PRIu64 |
| 946 | " - Cache Misses: %" PRIu64, |
| 947 | m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses()); |
| 948 | return retval; |
Enrico Granata | c582713 | 2014-09-05 20:45:07 +0000 | [diff] [blame] | 949 | } |
| 950 | |
| 951 | lldb::TypeValidatorImplSP |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 952 | FormatManager::GetHardcodedValidator(FormattersMatchData &match_data) { |
| 953 | TypeValidatorImplSP retval_sp; |
| 954 | |
| 955 | for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) { |
| 956 | if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) { |
| 957 | if (lang_category->GetHardcoded(*this, match_data, retval_sp)) |
| 958 | break; |
Enrico Granata | c582713 | 2014-09-05 20:45:07 +0000 | [diff] [blame] | 959 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 960 | } |
| 961 | |
| 962 | return retval_sp; |
Enrico Granata | c582713 | 2014-09-05 20:45:07 +0000 | [diff] [blame] | 963 | } |
| 964 | |
Saleem Abdulrasool | 16ff860 | 2016-05-18 01:59:10 +0000 | [diff] [blame] | 965 | FormatManager::FormatManager() |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 966 | : m_last_revision(0), m_format_cache(), m_language_categories_mutex(), |
| 967 | m_language_categories_map(), m_named_summaries_map(this), |
| 968 | m_categories_map(this), m_default_category_name(ConstString("default")), |
Saleem Abdulrasool | 16ff860 | 2016-05-18 01:59:10 +0000 | [diff] [blame] | 969 | m_system_category_name(ConstString("system")), |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 970 | m_vectortypes_category_name(ConstString("VectorTypes")) { |
| 971 | LoadSystemFormatters(); |
| 972 | LoadVectorFormatters(); |
Saleem Abdulrasool | 16ff860 | 2016-05-18 01:59:10 +0000 | [diff] [blame] | 973 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 974 | EnableCategory(m_vectortypes_category_name, TypeCategoryMap::Last, |
| 975 | lldb::eLanguageTypeObjC_plus_plus); |
| 976 | EnableCategory(m_system_category_name, TypeCategoryMap::Last, |
| 977 | lldb::eLanguageTypeObjC_plus_plus); |
Enrico Granata | 864e3e8 | 2012-02-17 03:18:30 +0000 | [diff] [blame] | 978 | } |
| 979 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 980 | void FormatManager::LoadSystemFormatters() { |
| 981 | TypeSummaryImpl::Flags string_flags; |
| 982 | string_flags.SetCascades(true) |
| 983 | .SetSkipPointers(true) |
| 984 | .SetSkipReferences(false) |
| 985 | .SetDontShowChildren(true) |
| 986 | .SetDontShowValue(false) |
| 987 | .SetShowMembersOneLiner(false) |
| 988 | .SetHideItemNames(false); |
Enrico Granata | aff6565 | 2013-10-21 17:29:51 +0000 | [diff] [blame] | 989 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 990 | TypeSummaryImpl::Flags string_array_flags; |
| 991 | string_array_flags.SetCascades(true) |
| 992 | .SetSkipPointers(true) |
| 993 | .SetSkipReferences(false) |
| 994 | .SetDontShowChildren(true) |
| 995 | .SetDontShowValue(true) |
| 996 | .SetShowMembersOneLiner(false) |
| 997 | .SetHideItemNames(false); |
| 998 | |
| 999 | lldb::TypeSummaryImplSP string_format( |
| 1000 | new StringSummaryFormat(string_flags, "${var%s}")); |
| 1001 | |
| 1002 | lldb::TypeSummaryImplSP string_array_format( |
| 1003 | new StringSummaryFormat(string_array_flags, "${var%s}")); |
| 1004 | |
| 1005 | lldb::RegularExpressionSP any_size_char_arr( |
| 1006 | new RegularExpression("char \\[[0-9]+\\]")); |
| 1007 | lldb::RegularExpressionSP any_size_wchar_arr( |
| 1008 | new RegularExpression("wchar_t \\[[0-9]+\\]")); |
| 1009 | |
| 1010 | TypeCategoryImpl::SharedPointer sys_category_sp = |
| 1011 | GetCategory(m_system_category_name); |
| 1012 | |
| 1013 | sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("char *"), |
| 1014 | string_format); |
| 1015 | sys_category_sp->GetTypeSummariesContainer()->Add( |
| 1016 | ConstString("unsigned char *"), string_format); |
| 1017 | sys_category_sp->GetRegexTypeSummariesContainer()->Add(any_size_char_arr, |
| 1018 | string_array_format); |
| 1019 | |
| 1020 | lldb::TypeSummaryImplSP ostype_summary( |
| 1021 | new StringSummaryFormat(TypeSummaryImpl::Flags() |
| 1022 | .SetCascades(false) |
| 1023 | .SetSkipPointers(true) |
| 1024 | .SetSkipReferences(true) |
| 1025 | .SetDontShowChildren(true) |
| 1026 | .SetDontShowValue(false) |
| 1027 | .SetShowMembersOneLiner(false) |
| 1028 | .SetHideItemNames(false), |
| 1029 | "${var%O}")); |
| 1030 | |
| 1031 | sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("OSType"), |
| 1032 | ostype_summary); |
| 1033 | |
Jason Molenda | 1a100cd | 2013-01-12 04:24:50 +0000 | [diff] [blame] | 1034 | #ifndef LLDB_DISABLE_PYTHON |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 1035 | TypeFormatImpl::Flags fourchar_flags; |
| 1036 | fourchar_flags.SetCascades(true).SetSkipPointers(true).SetSkipReferences( |
| 1037 | true); |
| 1038 | |
| 1039 | AddFormat(sys_category_sp, lldb::eFormatOSType, ConstString("FourCharCode"), |
| 1040 | fourchar_flags); |
Jason Molenda | 1a100cd | 2013-01-12 04:24:50 +0000 | [diff] [blame] | 1041 | #endif |
Enrico Granata | d3d444f | 2012-02-23 23:10:03 +0000 | [diff] [blame] | 1042 | } |
Enrico Granata | b2698cd | 2012-09-13 18:27:09 +0000 | [diff] [blame] | 1043 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 1044 | void FormatManager::LoadVectorFormatters() { |
| 1045 | TypeCategoryImpl::SharedPointer vectors_category_sp = |
| 1046 | GetCategory(m_vectortypes_category_name); |
| 1047 | |
| 1048 | TypeSummaryImpl::Flags vector_flags; |
| 1049 | vector_flags.SetCascades(true) |
| 1050 | .SetSkipPointers(true) |
| 1051 | .SetSkipReferences(false) |
| 1052 | .SetDontShowChildren(true) |
| 1053 | .SetDontShowValue(false) |
| 1054 | .SetShowMembersOneLiner(true) |
| 1055 | .SetHideItemNames(true); |
| 1056 | |
| 1057 | AddStringSummary(vectors_category_sp, "${var.uint128}", |
| 1058 | ConstString("builtin_type_vec128"), vector_flags); |
| 1059 | |
| 1060 | AddStringSummary(vectors_category_sp, "", ConstString("float [4]"), |
| 1061 | vector_flags); |
| 1062 | AddStringSummary(vectors_category_sp, "", ConstString("int32_t [4]"), |
| 1063 | vector_flags); |
| 1064 | AddStringSummary(vectors_category_sp, "", ConstString("int16_t [8]"), |
| 1065 | vector_flags); |
| 1066 | AddStringSummary(vectors_category_sp, "", ConstString("vDouble"), |
| 1067 | vector_flags); |
| 1068 | AddStringSummary(vectors_category_sp, "", ConstString("vFloat"), |
| 1069 | vector_flags); |
| 1070 | AddStringSummary(vectors_category_sp, "", ConstString("vSInt8"), |
| 1071 | vector_flags); |
| 1072 | AddStringSummary(vectors_category_sp, "", ConstString("vSInt16"), |
| 1073 | vector_flags); |
| 1074 | AddStringSummary(vectors_category_sp, "", ConstString("vSInt32"), |
| 1075 | vector_flags); |
| 1076 | AddStringSummary(vectors_category_sp, "", ConstString("vUInt16"), |
| 1077 | vector_flags); |
| 1078 | AddStringSummary(vectors_category_sp, "", ConstString("vUInt8"), |
| 1079 | vector_flags); |
| 1080 | AddStringSummary(vectors_category_sp, "", ConstString("vUInt16"), |
| 1081 | vector_flags); |
| 1082 | AddStringSummary(vectors_category_sp, "", ConstString("vUInt32"), |
| 1083 | vector_flags); |
| 1084 | AddStringSummary(vectors_category_sp, "", ConstString("vBool32"), |
| 1085 | vector_flags); |
Greg Clayton | d4e2552 | 2011-10-12 00:53:29 +0000 | [diff] [blame] | 1086 | } |