aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectTarget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index e2ba000..21b2195 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -2235,11 +2235,23 @@ public:
: CommandObjectTargetModulesModuleAutoComplete(
interpreter, "target modules dump ast",
"Dump the clang ast for a given module's symbol file.",
- //"target modules dump ast [<file1> ...]")
- nullptr, eCommandRequiresTarget) {}
+ "target modules dump ast [--filter <name>] [<file1> ...]",
+ eCommandRequiresTarget),
+ m_filter(LLDB_OPT_SET_1, false, "filter", 'f', 0, eArgTypeName,
+ "Dump only the decls whose names contain the specified filter "
+ "string.",
+ /*default_value=*/"") {
+ m_option_group.Append(&m_filter, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+ m_option_group.Finalize();
+ }
+
+ Options *GetOptions() override { return &m_option_group; }
~CommandObjectTargetModulesDumpClangAST() override = default;
+ OptionGroupOptions m_option_group;
+ OptionGroupString m_filter;
+
protected:
void DoExecute(Args &command, CommandReturnObject &result) override {
Target &target = GetTarget();
@@ -2251,6 +2263,8 @@ protected:
return;
}
+ llvm::StringRef filter = m_filter.GetOptionValue().GetCurrentValueAsRef();
+
if (command.GetArgumentCount() == 0) {
// Dump all ASTs for all modules images
result.GetOutputStream().Format("Dumping clang ast for {0} modules.\n",
@@ -2259,7 +2273,7 @@ protected:
if (INTERRUPT_REQUESTED(GetDebugger(), "Interrupted dumping clang ast"))
break;
if (SymbolFile *sf = module_sp->GetSymbolFile())
- sf->DumpClangAST(result.GetOutputStream());
+ sf->DumpClangAST(result.GetOutputStream(), filter);
}
result.SetStatus(eReturnStatusSuccessFinishResult);
return;
@@ -2288,7 +2302,7 @@ protected:
Module *m = module_list.GetModulePointerAtIndex(i);
if (SymbolFile *sf = m->GetSymbolFile())
- sf->DumpClangAST(result.GetOutputStream());
+ sf->DumpClangAST(result.GetOutputStream(), filter);
}
}
result.SetStatus(eReturnStatusSuccessFinishResult);
@@ -5272,7 +5286,7 @@ protected:
// Go over every scratch TypeSystem and dump to the command output.
for (lldb::TypeSystemSP ts : GetTarget().GetScratchTypeSystems())
if (ts)
- ts->Dump(result.GetOutputStream().AsRawOstream());
+ ts->Dump(result.GetOutputStream().AsRawOstream(), "");
result.SetStatus(eReturnStatusSuccessFinishResult);
}