| Issue |
84327
|
| Summary |
TestPlatformConnect.py fails on AArch64 FreeBSD 14.0
|
| Labels |
lldb,
platform:freebsd
|
| Assignees |
|
| Reporter |
DavidSpickett
|
```
ec2-user@freebsd:~/llvm-project $ uname -a
FreeBSD freebsd 14.0-RELEASE-p5 FreeBSD 14.0-RELEASE-p5 #0: Tue Feb 13 23:49:05 UTC 2024 [email protected]:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64
```
This is running on an AWS Graviton instance, just in case hardware or virtualisation is a factor here.
```
********************
FAIL: lldb-api :: commands/platform/connect/TestPlatformConnect.py (22 of 2135)
******************** TEST 'lldb-api :: commands/platform/connect/TestPlatformConnect.py' FAILED ********************
Script:
--
/usr/local/bin/python3 /home/ec2-user/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env ARCHIVER=/usr/bin/llvm-ar --env OBJCOPY=/usr/bin/llvm-objcopy --env LLVM_LIBS_DIR=/home/ec2-user/build-llvm/./lib --env LLVM_INCLUDE_DIR=/home/ec2-user/build-llvm/include --env LLVM_TOOLS_DIR=/home/ec2-user/build-llvm/./bin --arch aarch64 --build-dir /home/ec2-user/build-llvm/lldb-test-build.noindex --lldb-module-cache-dir /home/ec2-user/build-llvm/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/ec2-user/build-llvm/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/ec2-user/build-llvm/./bin/lldb --compiler /home/ec2-user/build-llvm/./bin/clang --dsymutil /home/ec2-user/build-llvm/./bin/dsymutil --llvm-tools-dir /home/ec2-user/build-llvm/./bin --lldb-libs-dir /home/ec2-user/build-llvm/./lib /home/ec2-user/llvm-project/lldb/test/API/commands/platform/connect -p TestPlatformConnect.py
--
Exit Code: 1
Command Output (stdout):
--
lldb version 19.0.0git (https://github.com/llvm/llvm-project.git revision 52d5b8e02d258e4c32864eb1bb943cfae119b1d6)
clang revision 52d5b8e02d258e4c32864eb1bb943cfae119b1d6
llvm revision 52d5b8e02d258e4c32864eb1bb943cfae119b1d6
Skipping the following test categories: ['libc++', 'libstdcxx', 'dsym', 'gmodules', 'debugserver', 'objc']
--
Command Output (stderr):
--
failed to start gdbserver: timed out
SIGHUP received, exiting lldb-server...
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/ec2-user/build-llvm/bin/lldb-server platform --listen [::1]:0 --socket-file /home/ec2-user/build-llvm/lldb-test-build.noindex/commands/platform/connect/TestPlatformConnect.test_platform_process_connect/port -- /home/ec2-user/build-llvm/lldb-test-build.noindex/commands/platform/connect/TestPlatformConnect.test_platform_process_connect/a.out foo
#0 0x00000000008aab68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/ec2-user/build-llvm/bin/lldb-server+0x8aab68)
#1 0x00000000008a8a78 llvm::sys::RunSignalHandlers() (/home/ec2-user/build-llvm/bin/lldb-server+0x8a8a78)
#2 0x00000000008ab2a4 SignalHandler(int) Signals.cpp:0:0
#3 0x0000000083b10034 handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
FAIL: LLDB (/home/ec2-user/build-llvm/bin/clang-aarch64) :: test_platform_process_connect (TestPlatformConnect.TestPlatformProcessConnect)
======================================================================
FAIL: test_platform_process_connect (TestPlatformConnect.TestPlatformProcessConnect)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ec2-user/llvm-project/lldb/test/API/commands/platform/connect/TestPlatformConnect.py", line 44, in test_platform_process_connect
lldbutil.run_break_set_by_symbol(self, "main")
File "/home/ec2-user/llvm-project/lldb/packages/Python/lldbsuite/test/lldbutil.py", line 416, in run_break_set_by_symbol
check_breakpoint_result(
File "/home/ec2-user/llvm-project/lldb/packages/Python/lldbsuite/test/lldbutil.py", line 588, in check_breakpoint_result
test.assertTrue(
AssertionError: False is not true : Expecting one or more locations, got none.
Config=aarch64-/home/ec2-user/build-llvm/bin/clang
----------------------------------------------------------------------
Ran 1 test in 10.382s
FAILED (failures=1)
```
It appears that the `lldb-server platform` never sees the port number that the `lldb-server gdbserver` writes to the pipe, despite the latter process getting as far as launching the inferior. Which as far as I can tell means it did write to the pipe or at least think it did.
I was not able to find a logic error and also found that you could work around this by building in debug mode (`-O0`) which feels like a race condition to me. Or perhaps an assumption lldb makes about pipe synchronisation that is only true for Linux.
Also, adding a single printf in a specific place in the code would make it work in a release+asserts build:
```
diff --git a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
index 0a832ebad13a..ada202e4ca34 100644
--- a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
+++ b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp
@@ -275,6 +275,7 @@ ProcessLauncherPosixFork::LaunchProcess(const ProcessLaunchInfo &launch_info,
}
if (pid == 0) {
// child process
+ printf("Child process!\n"); fflush(stdout);
pipe.CloseReadFileDescriptor();
ChildFunc(pipe.ReleaseWriteFileDescriptor(), fork_launch_info);
}
```
I guess this delays some step enough to make it work, but I could not figure out what.
I'm going to XFAIL this on AArch64 for the time being.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs