[Lldb-commits] [lldb] Make stop-hooks fire when lldb first gains control of a process. (PR #137410)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 25 15:50:10 PDT 2025
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 HEAD~1 HEAD --extensions h,cpp -- lldb/include/lldb/Target/Target.h lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Target/Process.cpp lldb/source/Target/Target.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index 7aa1fd182..7e89d3176 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -1369,11 +1369,11 @@ public:
}
bool GetAutoContinue() const { return m_auto_continue; }
-
+
void SetRunAtFirstStop(bool at_first_stop) {
m_at_first_stop = at_first_stop;
}
-
+
bool GetRunAtFirstStop() const { return m_at_first_stop; }
void GetDescription(Stream &s, lldb::DescriptionLevel level) const;
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 3f7315715..d162846ba 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -4795,7 +4795,7 @@ public:
m_use_one_liner = true;
m_one_liner.push_back(std::string(option_arg));
break;
-
+
case 'F': {
bool value, success;
value = OptionArgParser::ToBoolean(option_arg, false, &success);
@@ -5019,7 +5019,7 @@ protected:
if (specifier_up)
new_hook_sp->SetSpecifier(specifier_up.release());
-
+
// Should we run at first stop:
new_hook_sp->SetRunAtFirstStop(m_options.m_at_first_stop);
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 3b31f6d04..473cd3afc 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3056,9 +3056,9 @@ bool Target::RunStopHooks(bool at_initial_stop) {
bool no_active_hooks =
llvm::none_of(m_stop_hooks, [at_initial_stop](auto &p) {
- bool should_run_now = !at_initial_stop || p.second->GetRunAtFirstStop();
- return p.second->IsActive() && should_run_now;
- });
+ bool should_run_now = !at_initial_stop || p.second->GetRunAtFirstStop();
+ return p.second->IsActive() && should_run_now;
+ });
if (no_active_hooks)
return false;
@@ -3096,14 +3096,13 @@ bool Target::RunStopHooks(bool at_initial_stop) {
if (num_exe_ctx == 0) {
if (at_initial_stop && num_threads > 0) {
lldb::ThreadSP thread_to_use_sp = cur_threadlist.GetThreadAtIndex(0);
- exc_ctx_with_reasons.emplace_back(m_process_sp.get(),
- thread_to_use_sp.get(),
- thread_to_use_sp->GetStackFrameAtIndex(0).get());
+ exc_ctx_with_reasons.emplace_back(
+ m_process_sp.get(), thread_to_use_sp.get(),
+ thread_to_use_sp->GetStackFrameAtIndex(0).get());
num_exe_ctx = 1;
} else
return false;
}
-
StreamSP output_sp = m_debugger.GetAsyncOutputStream();
auto on_exit = llvm::make_scope_exit([output_sp] { output_sp->Flush(); });
@@ -3604,8 +3603,8 @@ Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) {
std::nullopt, nullptr, false, attach_info.GetHijackListener(), stream,
true, SelectMostRelevantFrame);
process_sp->RestoreProcessEvents();
-
- // Run the stop hooks here. Since we were hijacking the events, they
+
+ // Run the stop hooks here. Since we were hijacking the events, they
// wouldn't have gotten run as part of event delivery.
RunStopHooks(true /* at_initial_stop */);
``````````
</details>
https://github.com/llvm/llvm-project/pull/137410
More information about the lldb-commits
mailing list