[Lldb-commits] [PATCH] D154128: [lldb] Add log indicating which kind of data formatter
Dave Lee via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 29 11:17:44 PDT 2023
kastiglione created this revision.
kastiglione added reviewers: jingham, augusto2112.
Herald added a project: All.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
The `formatter` logs include a function name, but these functions are mostly templates
and the template type parameter is not printed, which is useful context.
This change adds a new log which is printed upon entry of `FormatManager::Get`, which
shows the formatter context as either `format`, `summary`, or `synthetic`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154128
Files:
lldb/source/DataFormatters/FormatManager.cpp
Index: lldb/source/DataFormatters/FormatManager.cpp
===================================================================
--- lldb/source/DataFormatters/FormatManager.cpp
+++ lldb/source/DataFormatters/FormatManager.cpp
@@ -596,15 +596,24 @@
return retval_sp;
}
+namespace {
+template <typename ImplSP> const char *FormatterKind;
+template <> const char *FormatterKind<lldb::TypeFormatImplSP> = "format";
+template <> const char *FormatterKind<lldb::TypeSummaryImplSP> = "summary";
+template <> const char *FormatterKind<lldb::SyntheticChildrenSP> = "synthetic";
+} // namespace
+
template <typename ImplSP>
ImplSP FormatManager::Get(ValueObject &valobj,
lldb::DynamicValueType use_dynamic) {
+ Log *log = GetLog(LLDBLog::DataFormatters);
+ LLDB_LOGF(log, "\n\n[%s] Begin %s lookup.", __FUNCTION__,
+ FormatterKind<ImplSP>);
+
FormattersMatchData match_data(valobj, use_dynamic);
if (ImplSP retval_sp = GetCached<ImplSP>(match_data))
return retval_sp;
- Log *log = GetLog(LLDBLog::DataFormatters);
-
LLDB_LOGF(log, "[%s] Search failed. Giving language a chance.", __FUNCTION__);
for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
@@ -628,7 +637,7 @@
ImplSP retval_sp;
Log *log = GetLog(LLDBLog::DataFormatters);
if (match_data.GetTypeForCache()) {
- LLDB_LOGF(log, "\n\n[%s] Looking into cache for type %s", __FUNCTION__,
+ LLDB_LOGF(log, "[%s] Looking into cache for type %s", __FUNCTION__,
match_data.GetTypeForCache().AsCString("<invalid>"));
if (m_format_cache.Get(match_data.GetTypeForCache(), retval_sp)) {
if (log) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154128.535927.patch
Type: text/x-patch
Size: 1735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230629/2cfbef05/attachment.bin>
More information about the lldb-commits
mailing list