diff options
author | Walter Erquinigo <a20012251@gmail.com> | 2020-10-26 21:22:06 -0700 |
---|---|---|
committer | Walter Erquinigo <a20012251@gmail.com> | 2020-11-18 18:24:36 -0800 |
commit | fb19f11ef47bc479d42c11450817c5e855a9830b (patch) | |
tree | 54a34a6be75b39928683e89ad76ee4d9e8395968 /lldb/source/Interpreter/CommandObject.cpp | |
parent | 25f5406f087579d43ca9a82dee7f3e76f0691bad (diff) | |
download | llvm-fb19f11ef47bc479d42c11450817c5e855a9830b.zip llvm-fb19f11ef47bc479d42c11450817c5e855a9830b.tar.gz llvm-fb19f11ef47bc479d42c11450817c5e855a9830b.tar.bz2 |
[trace][intel-pt] Scaffold the 'thread trace start | stop' commands
Depends on D90490.
The stop command is simple and invokes the new method Trace::StopTracingThread(thread).
On the other hand, the start command works by delegating its implementation to a CommandObject provided by the Trace plugin. This is necessary because each trace plugin needs different options for this command. There's even the chance that a Trace plugin can't support live tracing, but instead supports offline decoding and analysis, which means that "thread trace dump instructions" works but "thread trace start" doest. Because of this and a few other reasons, it's better to have each plugin provide this implementation.
Besides, I'm using the GetSupportedTraceType method introduced in D90490 to quickly infer what's the trace plug-in that works for the current process.
As an implementation note, I moved CommandObjectIterateOverThreads to its header so that I can use it from the IntelPT plugin. Besides, the actual start and stop logic for intel-pt is not part of this diff.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D90729
Diffstat (limited to 'lldb/source/Interpreter/CommandObject.cpp')
-rw-r--r-- | lldb/source/Interpreter/CommandObject.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 7e89faa..71adf8c 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -258,6 +258,15 @@ bool CommandObject::CheckRequirements(CommandReturnObject &result) { } } } + + if (GetFlags().Test(eCommandProcessMustBeTraced)) { + Target *target = m_exe_ctx.GetTargetPtr(); + if (target && !target->GetTrace()) { + result.SetError("Process is not being traced."); + return false; + } + } + return true; } |