wallace updated this revision to Diff 416558.
wallace added a comment.
Herald added a subscriber: JDevlieghere.
nit
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122023/new/
https://reviews.llvm.org/D122023
Files:
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Commands/Options.td
lldb/test/API/commands/trace/TestTraceDumpInfo.py
lldb/test/API/commands/trace/TestTraceDumpInstructions.py
lldb/test/API/commands/trace/TestTraceExport.py
lldb/test/API/commands/trace/TestTraceSave.py
Index: lldb/test/API/commands/trace/TestTraceSave.py
===================================================================
--- lldb/test/API/commands/trace/TestTraceSave.py
+++ lldb/test/API/commands/trace/TestTraceSave.py
@@ -18,7 +18,7 @@
os.path.join(self.getSourceDir(), "intelpt-trace", "a.out"))
self.expect("process trace save",
- substrs=["error: invalid process"],
+ substrs=["error: Command requires a current process."],
error=True)
# Now we check the output when there's a running target without a trace
Index: lldb/test/API/commands/trace/TestTraceExport.py
===================================================================
--- lldb/test/API/commands/trace/TestTraceExport.py
+++ lldb/test/API/commands/trace/TestTraceExport.py
@@ -23,7 +23,7 @@
os.path.join(self.getSourceDir(), "intelpt-trace", "a.out"))
self.expect(f"thread trace export ctf --file {ctf_test_file}",
- substrs=["error: invalid process"],
+ substrs=["error: Command requires a current process."],
error=True)
# Now we check the output when there's a running target without a trace
@@ -172,4 +172,3 @@
data_index = index_of_first_layer_1_block
for i in range(len(expected_block_names)):
self.assertTrue(data[data_index + i]['name'] == expected_block_names[i])
-
Index: lldb/test/API/commands/trace/TestTraceDumpInstructions.py
===================================================================
--- lldb/test/API/commands/trace/TestTraceDumpInstructions.py
+++ lldb/test/API/commands/trace/TestTraceDumpInstructions.py
@@ -19,7 +19,7 @@
os.path.join(self.getSourceDir(), "intelpt-trace", "a.out"))
self.expect("thread trace dump instructions",
- substrs=["error: invalid process"],
+ substrs=["error: Command requires a current process."],
error=True)
# Now we check the output when there's a running target without a trace
Index: lldb/test/API/commands/trace/TestTraceDumpInfo.py
===================================================================
--- lldb/test/API/commands/trace/TestTraceDumpInfo.py
+++ lldb/test/API/commands/trace/TestTraceDumpInfo.py
@@ -18,7 +18,7 @@
os.path.join(self.getSourceDir(), "intelpt-trace", "a.out"))
self.expect("thread trace dump info",
- substrs=["error: invalid process"],
+ substrs=["error: Command requires a current process."],
error=True)
# Now we check the output when there's a running target without a trace
Index: lldb/source/Commands/Options.td
===================================================================
--- lldb/source/Commands/Options.td
+++ lldb/source/Commands/Options.td
@@ -1116,6 +1116,12 @@
def thread_trace_dump_instructions_show_tsc : Option<"tsc", "t">,
Group<1>,
Desc<"For each instruction, print the corresponding timestamp counter if available.">;
+ def thread_trace_dump_instructions_continue: Option<"continue", "C">,
+ Group<1>,
+ Desc<"Continue dumping instructions right where the previous invocation of this "
+ "command was left, or from the beginning if this is the first invocation. The --skip "
+ "argument is discarded and the other arguments are preserved from the previous "
+ "invocation when possible.">;
}
let Command = "thread trace dump info" in {
Index: lldb/source/Commands/CommandObjectThread.cpp
===================================================================
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -2032,7 +2032,7 @@
unsigned i = 0;
for (llvm::StringRef plugin_name =
- PluginManager::GetTraceExporterPluginNameAtIndex(i++);
+ PluginManager::GetTraceExporterPluginNameAtIndex(i);
!plugin_name.empty();
plugin_name = PluginManager::GetTraceExporterPluginNameAtIndex(i++)) {
if (ThreadTraceExportCommandCreator command_creator =
@@ -2147,6 +2147,10 @@
m_show_tsc = true;
break;
}
+ case 'C': {
+ m_continue = true;
+ break;
+ }
default:
llvm_unreachable("Unimplemented option");
}
@@ -2159,6 +2163,7 @@
m_raw = false;
m_forwards = false;
m_show_tsc = false;
+ m_continue = false;
}
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
@@ -2173,6 +2178,7 @@
bool m_raw;
bool m_forwards;
bool m_show_tsc;
+ bool m_continue;
};
CommandObjectTraceDumpInstructions(CommandInterpreter &interpreter)
@@ -2192,24 +2198,19 @@
llvm::Optional<std::string> GetRepeatCommand(Args ¤t_command_args,
uint32_t index) override {
- current_command_args.GetCommandString(m_repeat_command);
- m_create_repeat_command_just_invoked = true;
- return m_repeat_command;
+ std::string cmd;
+ current_command_args.GetCommandString(cmd);
+ if (cmd.find("--continue") == std::string::npos)
+ cmd += " --continue";
+ return cmd;
}
protected:
bool DoExecute(Args &args, CommandReturnObject &result) override {
- if (!IsRepeatCommand())
+ if (!m_options.m_continue)
m_dumpers.clear();
- bool status = CommandObjectIterateOverThreads::DoExecute(args, result);
-
- m_create_repeat_command_just_invoked = false;
- return status;
- }
-
- bool IsRepeatCommand() {
- return !m_repeat_command.empty() && !m_create_repeat_command_just_invoked;
+ return CommandObjectIterateOverThreads::DoExecute(args, result);
}
bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override {
@@ -2249,10 +2250,6 @@
}
CommandOptions m_options;
-
- // Repeat command helpers
- std::string m_repeat_command;
- bool m_create_repeat_command_just_invoked = false;
std::map<lldb::tid_t, std::unique_ptr<TraceInstructionDumper>> m_dumpers;
};
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits