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 origin/main HEAD --extensions cpp --
lldb/test/API/api/multithreaded/driver.cpp
lldb/test/API/api/multithreaded/listener_test.cpp
lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp
lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp
lldb/test/API/api/multithreaded/test_concurrent_unwind.cpp
lldb/test/API/api/multithreaded/test_listener_event_description.cpp
lldb/test/API/api/multithreaded/test_listener_event_process_state.cpp
lldb/test/API/api/multithreaded/test_listener_resume.cpp
lldb/test/API/api/multithreaded/test_stop-hook.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/test/API/api/multithreaded/driver.cpp
b/lldb/test/API/api/multithreaded/driver.cpp
index e17e967a2..2c0172c70 100644
--- a/lldb/test/API/api/multithreaded/driver.cpp
+++ b/lldb/test/API/api/multithreaded/driver.cpp
@@ -7,7 +7,7 @@
#include <string>
#include <vector>
#if !defined(_MSC_VER)
- #include <signal.h>
+#include <signal.h>
#endif
#include "lldb/API/SBDebugger.h"
@@ -19,7 +19,7 @@ using namespace lldb;
void test(SBDebugger &dbg, std::vector<string> args);
-int main(int argc, char** argv) {
+int main(int argc, char **argv) {
// Ignore SIGPIPE. The lldb driver does this as well,
// because we seem to get spurious SIGPIPES on some
@@ -32,8 +32,7 @@ int main(int argc, char** argv) {
SBDebugger::Initialize();
SBDebugger dbg = SBDebugger::Create();
dbg.HandleCommand("settings set symbols.enable-external-lookup false");
- dbg.HandleCommand(
- "settings set plugin.process.gdb-remote.packet-timeout 60");
+ dbg.HandleCommand("settings set plugin.process.gdb-remote.packet-timeout
60");
try {
if (!dbg.IsValid())
diff --git a/lldb/test/API/api/multithreaded/listener_test.cpp
b/lldb/test/API/api/multithreaded/listener_test.cpp
index 7b7a8112e..f4f76c607 100644
--- a/lldb/test/API/api/multithreaded/listener_test.cpp
+++ b/lldb/test/API/api/multithreaded/listener_test.cpp
@@ -7,13 +7,13 @@
#include <thread>
#include <vector>
+#include "common.h"
#include "lldb/API/SBBreakpoint.h"
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBListener.h"
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBTarget.h"
-#include "common.h"
using namespace lldb;
using namespace std;
@@ -22,7 +22,7 @@ void listener_func();
void check_listener(SBDebugger &dbg);
// Listener thread and related variables
-atomic<bool> g_done;
+atomic<bool> g_done;
SBListener g_listener("test-listener");
thread g_listener_thread;
@@ -36,20 +36,18 @@ void test(SBDebugger &dbg, std::vector<string> args) {
try {
g_done.store(false);
SBTarget target = dbg.CreateTarget(args.at(0).c_str());
- if (!target.IsValid()) throw Exception("invalid target");
+ if (!target.IsValid())
+ throw Exception("invalid target");
SBBreakpoint breakpoint = target.BreakpointCreateByName("next");
- if (!breakpoint.IsValid()) throw Exception("invalid breakpoint");
+ if (!breakpoint.IsValid())
+ throw Exception("invalid breakpoint");
std::unique_ptr<char> working_dir(get_working_dir());
SBError error;
- SBProcess process = target.Launch(g_listener,
- 0, 0, 0, 0, 0,
- working_dir.get(),
- 0,
- false,
- error);
+ SBProcess process = target.Launch(g_listener, 0, 0, 0, 0, 0,
+ working_dir.get(), 0, false, error);
if (!error.Success())
throw Exception("Error launching process.");
diff --git a/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp
b/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp
index 557a7bb64..3b8e909ce 100644
--- a/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp
+++ b/lldb/test/API/api/multithreaded/test_breakpoint_callback.cpp
@@ -2,10 +2,10 @@
// LLDB C++ API Test: verify that the function registered with
// SBBreakpoint.SetCallback() is invoked when a breakpoint is hit.
-#include <mutex>
#include <iostream>
-#include <vector>
+#include <mutex>
#include <string>
+#include <vector>
#include "lldb/API/SBBreakpoint.h"
#include "lldb/API/SBBreakpointLocation.h"
@@ -23,10 +23,8 @@ mutex g_mutex;
condition_variable g_condition;
int g_breakpoint_hit_count = 0;
-bool BPCallback (void *baton,
- SBProcess &process,
- SBThread &thread,
- SBBreakpointLocation &location) {
+bool BPCallback(void *baton, SBProcess &process, SBThread &thread,
+ SBBreakpointLocation &location) {
lock_guard<mutex> lock(g_mutex);
g_breakpoint_hit_count += 1;
g_condition.notify_all();
@@ -34,16 +32,18 @@ bool BPCallback (void *baton,
}
void test(SBDebugger &dbg, vector<string> args) {
- dbg.SetAsync(false);
+ dbg.SetAsync(false);
SBTarget target = dbg.CreateTarget(args.at(0).c_str());
- if (!target.IsValid()) throw Exception("invalid target");
+ if (!target.IsValid())
+ throw Exception("invalid target");
SBBreakpoint breakpoint = target.BreakpointCreateByName("next");
- if (!breakpoint.IsValid()) throw Exception("invalid breakpoint");
+ if (!breakpoint.IsValid())
+ throw Exception("invalid breakpoint");
breakpoint.SetCallback(BPCallback, 0);
std::unique_ptr<char> working_dir(get_working_dir());
- SBProcess process = target.LaunchSimple (0, 0, working_dir.get());
+ SBProcess process = target.LaunchSimple(0, 0, working_dir.get());
{
unique_lock<mutex> lock(g_mutex);
diff --git
a/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp
b/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp
index 90705aae3..eea3b9ed6 100644
--- a/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp
+++ b/lldb/test/API/api/multithreaded/test_breakpoint_location_callback.cpp
@@ -2,10 +2,10 @@
// LLDB C++ API Test: verify that the function registered with
// SBBreakpoint.SetCallback() is invoked when a breakpoint is hit.
-#include <mutex>
#include <iostream>
-#include <vector>
+#include <mutex>
#include <string>
+#include <vector>
#include "lldb/API/SBBreakpoint.h"
#include "lldb/API/SBBreakpointLocation.h"
@@ -25,10 +25,8 @@ mutex g_mutex;
condition_variable g_condition;
int g_breakpoint_hit_count = 0;
-bool BPCallback (void *baton,
- SBProcess &process,
- SBThread &thread,
- SBBreakpointLocation &location) {
+bool BPCallback(void *baton, SBProcess &process, SBThread &thread,
+ SBBreakpointLocation &location) {
lock_guard<mutex> lock(g_mutex);
g_breakpoint_hit_count += 1;
g_condition.notify_all();
@@ -38,7 +36,8 @@ bool BPCallback (void *baton,
void test(SBDebugger &dbg, vector<string> args) {
dbg.SetAsync(false);
SBTarget target = dbg.CreateTarget(args.at(0).c_str());
- if (!target.IsValid()) throw Exception("invalid target");
+ if (!target.IsValid())
+ throw Exception("invalid target");
// Only look for the breakpoint in the main module.
SBFileSpec main_module(args.at(0).c_str(), /*resolve=*/true);
@@ -47,14 +46,16 @@ void test(SBDebugger &dbg, vector<string> args) {
SBBreakpoint breakpoint = target.BreakpointCreateByName(
"next", eFunctionNameTypeFull, module_list, SBFileSpecList());
- if (!breakpoint.IsValid()) throw Exception("invalid breakpoint");
+ if (!breakpoint.IsValid())
+ throw Exception("invalid breakpoint");
- if(breakpoint.GetNumLocations() != 1) throw Exception("unexpected amount of
breakpoint locations");
+ if (breakpoint.GetNumLocations() != 1)
+ throw Exception("unexpected amount of breakpoint locations");
SBBreakpointLocation breakpoint_location = breakpoint.GetLocationAtIndex(0);
breakpoint_location.SetCallback(BPCallback, 0);
std::unique_ptr<char> working_dir(get_working_dir());
- SBProcess process = target.LaunchSimple (0, 0, working_dir.get());
+ SBProcess process = target.LaunchSimple(0, 0, working_dir.get());
{
unique_lock<mutex> lock(g_mutex);
diff --git a/lldb/test/API/api/multithreaded/test_concurrent_unwind.cpp
b/lldb/test/API/api/multithreaded/test_concurrent_unwind.cpp
index 1272f7464..72bac46fe 100644
--- a/lldb/test/API/api/multithreaded/test_concurrent_unwind.cpp
+++ b/lldb/test/API/api/multithreaded/test_concurrent_unwind.cpp
@@ -17,9 +17,9 @@
using namespace lldb;
-void test (SBDebugger &dbg, std::vector<std::string> args) {
+void test(SBDebugger &dbg, std::vector<std::string> args) {
-SBError error;
+ SBError error;
dbg.SetAsync(false);
SBTarget target = dbg.CreateTarget(args.at(0).c_str());
if (!target.IsValid())
@@ -27,8 +27,8 @@ SBError error;
// Now set our breakpoint and launch:
SBFileSpec main_sourcefile("deep_stack.cpp");
- SBBreakpoint bkpt = target.BreakpointCreateBySourceRegex("Set a breakpoint
here",
- main_sourcefile);
+ SBBreakpoint bkpt = target.BreakpointCreateBySourceRegex(
+ "Set a breakpoint here", main_sourcefile);
if (bkpt.GetNumLocations() == 0)
throw Exception("Main breakpoint got no locations");
@@ -52,7 +52,7 @@ SBError error;
const size_t num_frames = cur_thread.GetNumFrames();
// Now step once to clear the frame cache:
cur_thread.StepOver();
-
+
// Create three threads and set them to getting frames simultaneously,
// and make sure we don't deadlock.
pseudo_barrier_t rendevous;
@@ -60,7 +60,7 @@ SBError error;
std::atomic_size_t success(true);
std::atomic_size_t largest(0);
- auto lambda = [&](size_t stride){
+ auto lambda = [&](size_t stride) {
pseudo_barrier_wait(rendevous);
bool younger = true;
while (1) {
@@ -80,7 +80,6 @@ SBError error;
break;
}
}
-
};
std::thread thread1(lambda, 1);
@@ -93,7 +92,7 @@ SBError error;
thread3.join();
thread4.join();
thread5.join();
-
+
if (!success)
throw Exception("One thread stopped before 1000");
}
diff --git
a/lldb/test/API/api/multithreaded/test_listener_event_description.cpp
b/lldb/test/API/api/multithreaded/test_listener_event_description.cpp
index 54bdc4fce..10faa5961 100644
--- a/lldb/test/API/api/multithreaded/test_listener_event_description.cpp
+++ b/lldb/test/API/api/multithreaded/test_listener_event_description.cpp
@@ -2,8 +2,8 @@
// LLDB C++ API Test: verify the event description that is received by an
// SBListener object registered with a process with a breakpoint.
-#include <atomic>
#include <array>
+#include <atomic>
#include <iostream>
#include <string>
#include <thread>
@@ -42,59 +42,53 @@ void listener_func() {
}
}
-bool check_state(string &state, string &desc, bool got_description)
-{
- g_error_desc.clear();
+bool check_state(string &state, string &desc, bool got_description) {
+ g_error_desc.clear();
- if(!got_description)
- {
- g_error_desc.append("Did not get expected event description");
- return false;
- }
+ if (!got_description) {
+ g_error_desc.append("Did not get expected event description");
+ return false;
+ }
- if (desc.find("state-changed") == desc.npos)
- g_error_desc.append("Event description incorrect: missing
'state-changed' ");
+ if (desc.find("state-changed") == desc.npos)
+ g_error_desc.append(
+ "Event description incorrect: missing 'state-changed' ");
- if (desc.find("pid = ") == desc.npos)
- g_error_desc.append("Event description incorrect: missing process pid
");
+ if (desc.find("pid = ") == desc.npos)
+ g_error_desc.append("Event description incorrect: missing process pid ");
- string state_search_str = "state = " + state;
- if (desc.find(state_search_str) == desc.npos)
- {
- string errString = ("Event description incorrect: expected state "
- + state
- + " but desc was "
- + desc);
- g_error_desc.append(errString);
- }
+ string state_search_str = "state = " + state;
+ if (desc.find(state_search_str) == desc.npos) {
+ string errString = ("Event description incorrect: expected state " + state
+
+ " but desc was " + desc);
+ g_error_desc.append(errString);
+ }
- if (g_error_desc.length() > 0)
- return false;
+ if (g_error_desc.length() > 0)
+ return false;
- cout << "check_state: " << state << " OK\n";
- return true;
+ cout << "check_state: " << state << " OK\n";
+ return true;
}
-void check_listener(SBDebugger &dbg)
-{
- bool got_description;
- string state;
-
- // check for "launching" state, this may or may not be present
- string desc = g_event_descriptions.pop(5, got_description);
- state = "launching";
- if (check_state(state, desc, got_description))
- {
- // found a 'launching' state, pop next one from queue
- desc = g_event_descriptions.pop(5, got_description);
- }
-
- state = "running";
- if( !check_state(state, desc, got_description) )
- throw Exception(g_error_desc);
+void check_listener(SBDebugger &dbg) {
+ bool got_description;
+ string state;
+ // check for "launching" state, this may or may not be present
+ string desc = g_event_descriptions.pop(5, got_description);
+ state = "launching";
+ if (check_state(state, desc, got_description)) {
+ // found a 'launching' state, pop next one from queue
desc = g_event_descriptions.pop(5, got_description);
- state = "stopped";
- if( !check_state(state, desc, got_description) )
- throw Exception(g_error_desc);
+ }
+
+ state = "running";
+ if (!check_state(state, desc, got_description))
+ throw Exception(g_error_desc);
+
+ desc = g_event_descriptions.pop(5, got_description);
+ state = "stopped";
+ if (!check_state(state, desc, got_description))
+ throw Exception(g_error_desc);
}
diff --git
a/lldb/test/API/api/multithreaded/test_listener_event_process_state.cpp
b/lldb/test/API/api/multithreaded/test_listener_event_process_state.cpp
index 1e010b99a..c3e705dbc 100644
--- a/lldb/test/API/api/multithreaded/test_listener_event_process_state.cpp
+++ b/lldb/test/API/api/multithreaded/test_listener_event_process_state.cpp
@@ -36,26 +36,28 @@ void listener_func() {
if (got_event) {
if (!event.IsValid())
throw Exception("event is not valid in listener thread");
- // send process description
- SBProcess process = SBProcess::GetProcessFromEvent(event);
- if (!process.IsValid())
- throw Exception("process is not valid");
- if (SBProcess::GetStateFromEvent(event) != lldb::eStateStopped ||
SBProcess::GetRestartedFromEvent(event))
- continue; // Only interested in "stopped" events.
+ // send process description
+ SBProcess process = SBProcess::GetProcessFromEvent(event);
+ if (!process.IsValid())
+ throw Exception("process is not valid");
+ if (SBProcess::GetStateFromEvent(event) != lldb::eStateStopped ||
+ SBProcess::GetRestartedFromEvent(event))
+ continue; // Only interested in "stopped" events.
- SBStream description;
+ SBStream description;
- for (int i = 0; i < process.GetNumThreads(); ++i) {
- // send each thread description
- SBThread thread = process.GetThreadAtIndex(i);
- // send each frame function name
- uint32_t num_frames = thread.GetNumFrames();
- for(int j = 0; j < num_frames; ++j) {
- const char* function_name =
thread.GetFrameAtIndex(j).GetSymbol().GetName();
- if (function_name)
- g_frame_functions.push(string(function_name));
- }
+ for (int i = 0; i < process.GetNumThreads(); ++i) {
+ // send each thread description
+ SBThread thread = process.GetThreadAtIndex(i);
+ // send each frame function name
+ uint32_t num_frames = thread.GetNumFrames();
+ for (int j = 0; j < num_frames; ++j) {
+ const char *function_name =
+ thread.GetFrameAtIndex(j).GetSymbol().GetName();
+ if (function_name)
+ g_frame_functions.push(string(function_name));
}
+ }
}
}
}
@@ -64,7 +66,7 @@ void check_listener(SBDebugger &dbg) {
// check thread description
bool got_description = false;
string func_name = g_frame_functions.pop(5, got_description);
-
- if(got_description == false)
+
+ if (got_description == false)
throw Exception("Expected at least one frame function");
}
diff --git a/lldb/test/API/api/multithreaded/test_listener_resume.cpp
b/lldb/test/API/api/multithreaded/test_listener_resume.cpp
index 752e26520..885420954 100644
--- a/lldb/test/API/api/multithreaded/test_listener_resume.cpp
+++ b/lldb/test/API/api/multithreaded/test_listener_resume.cpp
@@ -41,8 +41,9 @@ void listener_func() {
if (process.GetState() == eStateStopped) {
SBError error = process.Continue();
if (!error.Success())
- throw Exception(string("Cannot continue process from listener
thread: ")
- + error.GetCString());
+ throw Exception(
+ string("Cannot continue process from listener thread: ") +
+ error.GetCString());
g_process_started.push(true);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/215551
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits