[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 11 21:54:32 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 79d695f049343c96eccbce9c06357256bc567be3 6bd33589417195eafe945f2d2f57b01352f56568 --extensions h,cpp,c -- lldb/test/API/functionalities/reverse-execution/main.c lldb/include/lldb/API/SBProcess.h lldb/include/lldb/Target/Process.h lldb/include/lldb/Target/StopInfo.h lldb/include/lldb/lldb-enumerations.h lldb/source/API/SBProcess.cpp lldb/source/API/SBThread.cpp lldb/source/Interpreter/CommandInterpreter.cpp lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp lldb/source/Plugins/Process/Windows/Common/ProcessWindows.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp lldb/source/Plugins/Process/scripted/ScriptedProcess.h lldb/source/Target/Process.cpp lldb/source/Target/StopInfo.cpp lldb/source/Target/Thread.cpp lldb/tools/lldb-dap/JSONUtils.cpp lldb/tools/lldb-dap/LLDBUtils.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index fe7fbc50fd..6efeb0d369 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -860,7 +860,8 @@ public:
Status Resume(lldb::RunDirection direction = lldb::eRunForward);
/// Resume a process, and wait for it to stop.
- Status ResumeSynchronous(Stream *stream, lldb::RunDirection direction = lldb::eRunForward);
+ Status ResumeSynchronous(Stream *stream,
+ lldb::RunDirection direction = lldb::eRunForward);
/// Halts a running process.
///
@@ -1110,7 +1111,8 @@ public:
"error: {0} does not support resuming processes", GetPluginName());
} else {
return Status::FromErrorStringWithFormatv(
- "error: {0} does not support reverse execution of processes", GetPluginName());
+ "error: {0} does not support reverse execution of processes",
+ GetPluginName());
}
}
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index 07780f9f9c..8d50c2f4d1 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -563,9 +563,7 @@ uint32_t SBProcess::GetAddressByteSize() const {
return size;
}
-SBError SBProcess::Continue() {
- return Continue(RunDirection::eRunForward);
-}
+SBError SBProcess::Continue() { return Continue(RunDirection::eRunForward); }
SBError SBProcess::Continue(RunDirection direction) {
LLDB_INSTRUMENT_VA(this);
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index 116c43343c..919ca0924c 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -408,7 +408,8 @@ Status ProcessKDP::DoResume(RunDirection direction) {
if (direction == RunDirection::eRunReverse) {
error.SetErrorStringWithFormatv(
- "error: {0} does not support reverse execution of processes", GetPluginName());
+ "error: {0} does not support reverse execution of processes",
+ GetPluginName());
return error;
}
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index 76b7095dea..34ff2d5866 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -211,7 +211,8 @@ Status ProcessWindows::DoResume(RunDirection direction) {
if (direction == RunDirection::eRunReverse) {
error.SetErrorStringWithFormatv(
- "error: {0} does not support reverse execution of processes", GetPluginName());
+ "error: {0} does not support reverse execution of processes",
+ GetPluginName());
return error;
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 3fc03bd05d..f979262644 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -169,9 +169,7 @@ public:
}
};
-std::chrono::seconds ResumeTimeout() {
- return std::chrono::seconds(5);
-}
+std::chrono::seconds ResumeTimeout() { return std::chrono::seconds(5); }
} // namespace
@@ -1202,13 +1200,16 @@ Status ProcessGDBRemote::DoResume(RunDirection direction) {
StreamString continue_packet;
bool continue_packet_error = false;
- // Number of threads continuing with "c", i.e. continuing without a signal to deliver.
+ // Number of threads continuing with "c", i.e. continuing without a signal
+ // to deliver.
const size_t num_continue_c_tids = m_continue_c_tids.size();
- // Number of threads continuing with "C", i.e. continuing with a signal to deliver.
+ // Number of threads continuing with "C", i.e. continuing with a signal to
+ // deliver.
const size_t num_continue_C_tids = m_continue_C_tids.size();
// Number of threads continuing with "s", i.e. single-stepping.
const size_t num_continue_s_tids = m_continue_s_tids.size();
- // Number of threads continuing with "S", i.e. single-stepping with a signal to deliver.
+ // Number of threads continuing with "S", i.e. single-stepping with a signal
+ // to deliver.
const size_t num_continue_S_tids = m_continue_S_tids.size();
if (direction == RunDirection::eRunForward &&
m_gdb_comm.HasAnyVContSupport()) {
@@ -1376,27 +1377,36 @@ Status ProcessGDBRemote::DoResume(RunDirection direction) {
if (direction == RunDirection::eRunReverse && continue_packet_error) {
if (num_continue_C_tids > 0 || num_continue_S_tids > 0) {
- LLDB_LOGF(log, "ProcessGDBRemote::DoResumeReverse: Signals not supported");
- return Status::FromErrorString("can't deliver signals while running in reverse");
+ LLDB_LOGF(log,
+ "ProcessGDBRemote::DoResumeReverse: Signals not supported");
+ return Status::FromErrorString(
+ "can't deliver signals while running in reverse");
}
if (num_continue_s_tids > 0) {
if (num_continue_s_tids > 1) {
- LLDB_LOGF(log, "ProcessGDBRemote::DoResumeReverse: can't step multiple threads");
- return Status::FromErrorString("can't step multiple threads while reverse-stepping");
+ LLDB_LOGF(
+ log,
+ "ProcessGDBRemote::DoResumeReverse: can't step multiple threads");
+ return Status::FromErrorString(
+ "can't step multiple threads while reverse-stepping");
}
if (!m_gdb_comm.GetReverseStepSupported()) {
- LLDB_LOGF(log, "ProcessGDBRemote::DoResumeReverse: target does not support reverse-stepping");
- return Status::FromErrorString("target does not support reverse-stepping");
+ LLDB_LOGF(log, "ProcessGDBRemote::DoResumeReverse: target does not "
+ "support reverse-stepping");
+ return Status::FromErrorString(
+ "target does not support reverse-stepping");
}
m_gdb_comm.SetCurrentThreadForRun(m_continue_s_tids.front());
continue_packet.PutCString("bs");
} else {
if (!m_gdb_comm.GetReverseContinueSupported()) {
- LLDB_LOGF(log, "ProcessGDBRemote::DoResumeReverse: target does not support reverse-continue");
- return Status::FromErrorString("target does not support reverse-continue");
+ LLDB_LOGF(log, "ProcessGDBRemote::DoResumeReverse: target does not "
+ "support reverse-continue");
+ return Status::FromErrorString(
+ "target does not support reverse-continue");
}
// All threads continue whether requested or not ---
@@ -1408,7 +1418,8 @@ Status ProcessGDBRemote::DoResume(RunDirection direction) {
}
if (continue_packet_error) {
- return Status::FromErrorString("can't make continue packet for this resume");
+ return Status::FromErrorString(
+ "can't make continue packet for this resume");
} else {
EventSP event_sp;
if (!m_async_thread.IsJoinable()) {
diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
index 304c12173d..e68007ead3 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -189,7 +189,8 @@ Status ScriptedProcess::DoResume(RunDirection direction) {
return GetInterface().Resume();
} else {
return Status::FromErrorStringWithFormatv(
- "error: {0} does not support reverse execution of processes", GetPluginName());
+ "error: {0} does not support reverse execution of processes",
+ GetPluginName());
}
}
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index fd68372838..fcbbf4174b 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -447,12 +447,11 @@ Process::Process(lldb::TargetSP target_sp, ListenerSP listener_sp,
m_should_detach(false), m_next_event_action_up(), m_public_run_lock(),
m_private_run_lock(), m_currently_handling_do_on_removals(false),
m_resume_requested(false), m_last_run_direction(eRunForward),
- m_interrupt_tid(LLDB_INVALID_THREAD_ID),
- m_finalizing(false), m_destructing(false),
- m_clear_thread_plans_on_stop(false), m_force_next_event_delivery(false),
- m_last_broadcast_state(eStateInvalid), m_destroy_in_process(false),
- m_can_interpret_function_calls(false), m_run_thread_plan_lock(),
- m_can_jit(eCanJITDontKnow),
+ m_interrupt_tid(LLDB_INVALID_THREAD_ID), m_finalizing(false),
+ m_destructing(false), m_clear_thread_plans_on_stop(false),
+ m_force_next_event_delivery(false), m_last_broadcast_state(eStateInvalid),
+ m_destroy_in_process(false), m_can_interpret_function_calls(false),
+ m_run_thread_plan_lock(), m_can_jit(eCanJITDontKnow),
m_crash_info_dict_sp(new StructuredData::Dictionary()) {
CheckInWithManager();
``````````
</details>
https://github.com/llvm/llvm-project/pull/112079
More information about the lldb-commits
mailing list