-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb][test] Fix TestMultipleDebuggers test on non-x86, other small issues #101169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ssues This test has been flaky lately (llvm#101162) and I disabled it everywhere initially. I found that it always uses "x86_64" for the program architecture so the test was "passing" elsewhere but I don't think it was meant to. So I have added a define to pass on the host's architecture when compiling. This makes it work on AArch64 as well. While I'm here I've fixed the uint64_t formatting warnings by using the defined formats that'll work everywhere. In addition, I found that the function names include "()" on Linux, so now we check for "foo" or "foo()". The test cpp file has never been formatted so I've not done that either, just kept to the local style. I've removed the Linux skip to see if any of this helps the timeouts, and to verify the build command changes. If the timeouts come back I'll disable it again.
You can test this locally with the following command:git-clang-format --diff 533a22941e9acee1460fbd054fbfa57b82d660e5 491bf0e33eb5ee997a05f3aa141d5e4b2f0a064c --extensions cpp -- lldb/test/API/api/multiple-debuggers/multi-process-driver.cpp View the diff from clang-format here.diff --git a/lldb/test/API/api/multiple-debuggers/multi-process-driver.cpp b/lldb/test/API/api/multiple-debuggers/multi-process-driver.cpp
index 64728fb7c2..57a6585ee0 100644
--- a/lldb/test/API/api/multiple-debuggers/multi-process-driver.cpp
+++ b/lldb/test/API/api/multiple-debuggers/multi-process-driver.cpp
@@ -13,10 +13,10 @@
// that are hit when lldb is being used to debug multiple processes
// simultaneously.
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <inttypes.h>
#include "lldb/API/LLDB.h"
#include "lldb/API/SBCommandInterpreter.h"
@@ -106,21 +106,24 @@ void *do_one_debugger (void *in)
if (debugger.IsValid ())
{
debugger.SetAsync (true);
- SBTarget target = debugger.CreateTargetWithFileAndArch(inferior_process_name,
- STR(LLDB_HOST_ARCH));
+ SBTarget target = debugger.CreateTargetWithFileAndArch(
+ inferior_process_name, STR(LLDB_HOST_ARCH));
SBCommandInterpreter command_interp = debugger.GetCommandInterpreter();
if (target.IsValid())
{
SBBreakpoint bar_br = target.BreakpointCreateByName ("bar", "testprog");
if (!bar_br.IsValid())
{
- printf ("#%" PRIu64 ": failed to set breakpoint on bar, exiting.\n", threadnum);
- exit (1);
+ printf("#%" PRIu64
+ ": failed to set breakpoint on bar, exiting.\n",
+ threadnum);
+ exit(1);
}
SBBreakpoint foo_br = target.BreakpointCreateByName ("foo", "testprog");
if (!foo_br.IsValid())
{
- printf ("#%" PRIu64 ": Failed to set breakpoint on foo()\n", threadnum);
+ printf("#%" PRIu64 ": Failed to set breakpoint on foo()\n",
+ threadnum);
}
SBLaunchInfo launch_info (NULL);
@@ -141,17 +144,25 @@ void *do_one_debugger (void *in)
if (!walk_stack_to_main (process.GetThreadAtIndex(0)))
{
- printf ("#%" PRIu64 ": backtrace while @ foo() failed\n", threadnum);
- completed_threads_array[threadnum] = true;
- return (void *) 1;
+ printf("#%" PRIu64 ": backtrace while @ foo() failed\n",
+ threadnum);
+ completed_threads_array[threadnum] = true;
+ return (void *)1;
}
// On Linux the () are included.
- const char* hit_fn = process.GetThreadAtIndex(0).GetFrameAtIndex(0).GetFunctionName();
- if (strcmp (hit_fn, "foo") != 0 && strcmp (hit_fn, "foo()") != 0)
- {
+ const char *hit_fn = process.GetThreadAtIndex(0)
+ .GetFrameAtIndex(0)
+ .GetFunctionName();
+ if (strcmp(hit_fn, "foo") != 0 &&
+ strcmp(hit_fn, "foo()") != 0) {
#if DEBUG == 1
- printf ("#%" PRIu64 ": First breakpoint did not stop at foo(), instead stopped at '%s'\n", threadnum, process.GetThreadAtIndex(0).GetFrameAtIndex(0).GetFunctionName());
+ printf("#%" PRIu64 ": First breakpoint did not stop at "
+ "foo(), instead stopped at '%s'\n",
+ threadnum,
+ process.GetThreadAtIndex(0)
+ .GetFrameAtIndex(0)
+ .GetFunctionName());
#endif
completed_threads_array[threadnum] = true;
return (void*) 1;
@@ -163,25 +174,30 @@ void *do_one_debugger (void *in)
if (process.GetState() == StateType::eStateExited)
{
- printf ("#%" PRIu64 ": Process exited\n", threadnum);
- completed_threads_array[threadnum] = true;
- return (void *) 1;
+ printf("#%" PRIu64 ": Process exited\n", threadnum);
+ completed_threads_array[threadnum] = true;
+ return (void *)1;
}
if (!walk_stack_to_main (process.GetThreadAtIndex(0)))
{
- printf ("#%" PRIu64 ": backtrace while @ bar() failed\n", threadnum);
- completed_threads_array[threadnum] = true;
- return (void *) 1;
+ printf("#%" PRIu64 ": backtrace while @ bar() failed\n",
+ threadnum);
+ completed_threads_array[threadnum] = true;
+ return (void *)1;
}
- hit_fn = process.GetThreadAtIndex(0).GetFrameAtIndex(0).GetFunctionName();
- if (strcmp (hit_fn, "bar") != 0 && strcmp (hit_fn, "bar()") != 0)
- {
- printf ("#%" PRIu64 ": First breakpoint did not stop at bar()\n", threadnum);
- completed_threads_array[threadnum] = true;
- return (void*) 1;
+ hit_fn = process.GetThreadAtIndex(0)
+ .GetFrameAtIndex(0)
+ .GetFunctionName();
+ if (strcmp(hit_fn, "bar") != 0 &&
+ strcmp(hit_fn, "bar()") != 0) {
+ printf("#%" PRIu64
+ ": First breakpoint did not stop at bar()\n",
+ threadnum);
+ completed_threads_array[threadnum] = true;
+ return (void *)1;
}
process.Kill();
@@ -191,7 +207,7 @@ void *do_one_debugger (void *in)
SBDebugger::Destroy(debugger);
#if DEBUG == 1
- printf ("#%" PRIu64 ": All good!\n", threadnum);
+ printf("#%" PRIu64 ": All good!\n", threadnum);
#endif
successful_threads_array[threadnum] = true;
completed_threads_array[threadnum] = true;
@@ -199,26 +215,26 @@ void *do_one_debugger (void *in)
}
else
{
- printf("#%" PRIu64 ": process failed to launch\n", threadnum);
- successful_threads_array[threadnum] = false;
- completed_threads_array[threadnum] = true;
- return (void*) 0;
+ printf("#%" PRIu64 ": process failed to launch\n", threadnum);
+ successful_threads_array[threadnum] = false;
+ completed_threads_array[threadnum] = true;
+ return (void *)0;
}
}
else
{
- printf ("#%" PRIu64 ": did not get valid target\n", threadnum);
- successful_threads_array[threadnum] = false;
- completed_threads_array[threadnum] = true;
- return (void*) 0;
+ printf("#%" PRIu64 ": did not get valid target\n", threadnum);
+ successful_threads_array[threadnum] = false;
+ completed_threads_array[threadnum] = true;
+ return (void *)0;
}
}
else
{
- printf ("#%" PRIu64 ": did not get debugger\n", threadnum);
- successful_threads_array[threadnum] = false;
- completed_threads_array[threadnum] = true;
- return (void*) 0;
+ printf("#%" PRIu64 ": did not get debugger\n", threadnum);
+ successful_threads_array[threadnum] = false;
+ completed_threads_array[threadnum] = true;
+ return (void *)0;
}
completed_threads_array[threadnum] = true;
return (void*) 1;
|
JDevlieghere
approved these changes
Jul 30, 2024
jasonmolenda
approved these changes
Jul 30, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the good cleanup.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This test has been flaky lately (#101162) and I disabled it everywhere initially.
I found that it always uses "x86_64" for the program architecture so the test was "passing" elsewhere but I don't think it was meant to. So I have added a define to pass on the host's architecture when compiling. This makes it work on AArch64 as well.
While I'm here I've fixed the uint64_t formatting warnings by using the defined formats that'll work everywhere.
In addition, I found that the function names include "()" on Linux, so now we check for "foo" or "foo()".
The test cpp file has never been, or was only partially formatted so I've not formatted the changes, just kept to the local style.
I've removed the Linux skip to see if any of this helps the timeouts, and to verify the build command changes. If the timeouts come back I'll disable it again.