Skip to content

Conversation

@lb90
Copy link
Contributor

@lb90 lb90 commented Oct 27, 2025

CreateProcess fails with ERROR_INVALID_PARAMETER when duplicate HANDLEs are passed via PROC_THREAD_ATTRIBUTE_HANDLE_LIST. This can happen, for example, if stdout and stdin are the same device (e.g. a bidirectional named pipe), or if stdout and stderr are the same device.

Fixes msys2/MINGW-packages#26030

@lb90 lb90 requested a review from JDevlieghere as a code owner October 27, 2025 17:18
@github-actions
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the lldb label Oct 27, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 27, 2025

@llvm/pr-subscribers-lldb

Author: None (lb90)

Changes

Fixes msys2/MINGW-packages#26030


Full diff: https://github.com/llvm/llvm-project/pull/165281.diff

1 Files Affected:

  • (modified) lldb/source/Host/windows/ProcessLauncherWindows.cpp (+6)
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
index f5adadaf061bf..ab151f1a9a0ac 100644
--- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -15,6 +15,7 @@
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Program.h"
 
+#include <algorithm>
 #include <string>
 #include <vector>
 
@@ -122,6 +123,11 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
         act->GetFD() == act->GetActionArgument())
       inherited_handles.push_back(reinterpret_cast<HANDLE>(act->GetFD()));
   }
+  // Remove duplicate HANDLEs
+  std::sort(inherited_handles.begin(), inherited_handles.end());
+  inherited_handles.erase(
+      std::unique(inherited_handles.begin(), inherited_handles.end()),
+      inherited_handles.end());
   if (!inherited_handles.empty()) {
     if (!UpdateProcThreadAttribute(
             startupinfoex.lpAttributeList, /*dwFlags=*/0,

@charles-zablit
Copy link
Contributor

Thanks for submitting this patch!

This looks good to me, I just wonder if it would make sense to convert this inherited_handles vector to an std::unordered_set?

I think It would make it clearer that we should only have unique handles in this data structure. What do you think?

@lb90 lb90 force-pushed the lldb-remove-duplicated-handles branch from 65250c7 to 76cf6d1 Compare October 28, 2025 09:47
@lb90
Copy link
Contributor Author

lb90 commented Oct 28, 2025

Nice idea! Changed :)

Copy link
Contributor

@charles-zablit charles-zablit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this patch!

@charles-zablit charles-zablit merged commit 5430d7a into llvm:main Oct 29, 2025
10 checks passed
@github-actions
Copy link

@lb90 Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 29, 2025

LLVM Buildbot has detected a new failure on builder lldb-x86_64-win running on as-builder-10 while building lldb at step 8 "test-check-lldb-unit".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/211/builds/3323

Here is the relevant piece of the build log for the reference
Step 8 (test-check-lldb-unit) failure: Test just built components: check-lldb-unit completed (failure)
******************** TEST 'lldb-unit :: Host/./HostTests.exe/28/80' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\unittests\Host\.\HostTests.exe-lldb-unit-38324-28-80.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=80 GTEST_SHARD_INDEX=28 C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\unittests\Host\.\HostTests.exe
--

Script:
--
C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\unittests\Host\.\HostTests.exe --gtest_filter=Host.LaunchProcessDuplicatesHandle
--
C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\unittests\Host\HostTest.cpp(163): error: Value of: llvm::detail::TakeError(Host::LaunchProcess(info).takeError())
Expected: succeeded
  Actual: failed  (The parameter is incorrect.)
Google Test trace:
C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\unittests\Host\HostTest.cpp(152): Pipe handles are: 260/268


C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\unittests\Host\HostTest.cpp:163
Value of: llvm::detail::TakeError(Host::LaunchProcess(info).takeError())
Expected: succeeded
  Actual: failed  (The parameter is incorrect.)
Google Test trace:
C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\unittests\Host\HostTest.cpp(152): Pipe handles are: 260/268



********************

Step 9 (test-check-lldb-api) failure: Test just built components: check-lldb-api completed (failure)
******************** TEST 'lldb-api :: commands/disassemble/basic/TestDisassembleBreakpoint.py' FAILED ********************
Script:
--
C:/Python312/python.exe C:/buildbot/as-builder-10/lldb-x86-64/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=C:/buildbot/as-builder-10/lldb-x86-64/build/./lib --env LLVM_INCLUDE_DIR=C:/buildbot/as-builder-10/lldb-x86-64/build/include --env LLVM_TOOLS_DIR=C:/buildbot/as-builder-10/lldb-x86-64/build/./bin --arch x86_64 --build-dir C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex --lldb-module-cache-dir C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-lldb\lldb-api --clang-module-cache-dir C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-clang\lldb-api --executable C:/buildbot/as-builder-10/lldb-x86-64/build/./bin/lldb.exe --compiler C:/buildbot/as-builder-10/lldb-x86-64/build/./bin/clang.exe --dsymutil C:/buildbot/as-builder-10/lldb-x86-64/build/./bin/dsymutil.exe --make C:/ninja/make.exe --llvm-tools-dir C:/buildbot/as-builder-10/lldb-x86-64/build/./bin --lldb-obj-root C:/buildbot/as-builder-10/lldb-x86-64/build/tools/lldb --lldb-libs-dir C:/buildbot/as-builder-10/lldb-x86-64/build/./lib --cmake-build-type Release --skip-category=lldb-dap C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\API\commands\disassemble\basic -p TestDisassembleBreakpoint.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 5430d7a9e60b0feb899862d287351e14aeeab6bd)
  clang revision 5430d7a9e60b0feb899862d287351e14aeeab6bd
  llvm revision 5430d7a9e60b0feb899862d287351e14aeeab6bd
Skipping the following test categories: ['lldb-dap', 'libc++', 'libstdcxx', 'dwo', 'dsym', 'gmodules', 'debugserver', 'objc', 'fork', 'pexpect']


--
Command Output (stderr):
--
FAIL: LLDB (C:\buildbot\as-builder-10\lldb-x86-64\build\bin\clang.exe-x86_64) :: test (TestDisassembleBreakpoint.DisassemblyTestCase.test)

FAIL: LLDB (C:\buildbot\as-builder-10\lldb-x86-64\build\bin\clang.exe-x86_64) :: test (TestDisassembleBreakpoint.DisassemblyTestCase.test)

======================================================================

FAIL: test (TestDisassembleBreakpoint.DisassemblyTestCase.test)

----------------------------------------------------------------------

Traceback (most recent call last):

  File "C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\API\commands\disassemble\basic\TestDisassembleBreakpoint.py", line 17, in test

    target, _, _, bkpt = lldbutil.run_to_source_breakpoint(

                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\packages\Python\lldbsuite\test\lldbutil.py", line 1017, in run_to_source_breakpoint

    return run_to_breakpoint_do_run(

           ^^^^^^^^^^^^^^^^^^^^^^^^^

  File "C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\packages\Python\lldbsuite\test\lldbutil.py", line 897, in run_to_breakpoint_do_run

    test.assertFalse(error.Fail(), "Process launch failed: %s" % (error.GetCString()))

AssertionError: True is not false : Process launch failed: The parameter is incorrect. 

Config=x86_64-C:\buildbot\as-builder-10\lldb-x86-64\build\bin\clang.exe

...
Step 10 (test-check-lldb-shell) failure: Test just built components: check-lldb-shell completed (failure)
******************** TEST 'lldb-shell :: Commands/command-script-import.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
echo 'b main' > C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Commands\Output\command-script-import.test.tmp.in
# executed command: echo 'b main'
# note: command had no output on stdout or stderr
# RUN: at line 3
echo 'run' >> C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Commands\Output\command-script-import.test.tmp.in
# executed command: echo run
# note: command had no output on stdout or stderr
# RUN: at line 4
echo 'command script import C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Commands/Inputs/frame.py' >> C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Commands\Output\command-script-import.test.tmp.in
# executed command: echo 'command script import C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Commands/Inputs/frame.py'
# note: command had no output on stdout or stderr
# RUN: at line 6
c:\buildbot\as-builder-10\lldb-x86-64\build\bin\clang.exe --target=specify-a-target-or-use-a-_host-substitution --target=x86_64-pc-windows-msvc -fmodules-cache-path=C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-clang\lldb-shell -g -O0 C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Commands/Inputs/main.c -o C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Commands\Output\command-script-import.test.tmp.out
# executed command: 'c:\buildbot\as-builder-10\lldb-x86-64\build\bin\clang.exe' --target=specify-a-target-or-use-a-_host-substitution --target=x86_64-pc-windows-msvc '-fmodules-cache-path=C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-clang\lldb-shell' -g -O0 'C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Commands/Inputs/main.c' -o 'C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Commands\Output\command-script-import.test.tmp.out'
# .---command stderr------------
# | clang: warning: argument unused during compilation: '-fmodules-cache-path=C:/buildbot/as-builder-10/lldb-x86-64/build/lldb-test-build.noindex/module-cache-clang\lldb-shell' [-Wunused-command-line-argument]
# `-----------------------------
# RUN: at line 7
c:\buildbot\as-builder-10\lldb-x86-64\build\bin\lldb.exe --no-lldbinit -S C:/buildbot/as-builder-10/lldb-x86-64/build/tools/lldb\test\Shell\lit-lldb-init-quiet -b -s C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Commands\Output\command-script-import.test.tmp.in -o 'script print("script: {}".format(lldb.frame))' C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Commands\Output\command-script-import.test.tmp.out | c:\buildbot\as-builder-10\lldb-x86-64\build\bin\filecheck.exe C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Commands\command-script-import.test
# executed command: 'c:\buildbot\as-builder-10\lldb-x86-64\build\bin\lldb.exe' --no-lldbinit -S 'C:/buildbot/as-builder-10/lldb-x86-64/build/tools/lldb\test\Shell\lit-lldb-init-quiet' -b -s 'C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Commands\Output\command-script-import.test.tmp.in' -o 'script print("script: {}".format(lldb.frame))' 'C:\buildbot\as-builder-10\lldb-x86-64\build\tools\lldb\test\Shell\Commands\Output\command-script-import.test.tmp.out'
# .---command stderr------------
# | error: The parameter is incorrect.
# `-----------------------------
# error: command failed with exit status: 1
# executed command: 'c:\buildbot\as-builder-10\lldb-x86-64\build\bin\filecheck.exe' 'C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Commands\command-script-import.test'
# .---command stderr------------
# | C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Commands\command-script-import.test:10:10: error: CHECK: expected string not found in input
# | # CHECK: frame.py: None
# |          ^
# | <stdin>:1:1: note: scanning from here
# | (lldb) command source -s 0 'C:/buildbot/as-builder-10/lldb-x86-64/build/tools/lldb\test\Shell\lit-lldb-init-quiet'
# | ^
# | <stdin>:11:46: note: possible intended match here
# | (lldb) script print("script: {}".format(lldb.frame))
# |                                              ^
# | 
# | Input file: <stdin>
# | Check file: C:\buildbot\as-builder-10\lldb-x86-64\llvm-project\lldb\test\Shell\Commands\command-script-import.test
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1: (lldb) command source -s 0 'C:/buildbot/as-builder-10/lldb-x86-64/build/tools/lldb\test\Shell\lit-lldb-init-quiet' 
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 29, 2025

LLVM Buildbot has detected a new failure on builder lldb-arm-ubuntu running on linaro-lldb-arm-ubuntu while building lldb at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/18/builds/22358

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-api :: tools/lldb-dap/attach/TestDAP_attach.py (1203 of 3740)
UNSUPPORTED: lldb-api :: tools/lldb-dap/attach/TestDAP_attachByPortNum.py (1204 of 3740)
PASS: lldb-api :: tools/lldb-dap/breakpoint-assembly/TestDAP_breakpointAssembly.py (1205 of 3740)
UNSUPPORTED: lldb-api :: tools/lldb-dap/breakpoint-events/TestDAP_breakpointEvents.py (1206 of 3740)
PASS: lldb-api :: tools/lldb-dap/breakpoint/TestDAP_breakpointLocations.py (1207 of 3740)
PASS: lldb-api :: tools/lldb-dap/attach-commands/TestDAP_attachCommands.py (1208 of 3740)
PASS: lldb-api :: tools/lldb-dap/breakpoint/TestDAP_logpoints.py (1209 of 3740)
PASS: lldb-api :: terminal/TestEditline.py (1210 of 3740)
PASS: lldb-api :: tools/lldb-dap/breakpoint/TestDAP_setExceptionBreakpoints.py (1211 of 3740)
UNRESOLVED: lldb-api :: tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py (1212 of 3740)
******************** TEST 'lldb-api :: tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --arch armv8l --build-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib --cmake-build-type Release /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/tools/lldb-dap/breakpoint -p TestDAP_setBreakpoints.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 5430d7a9e60b0feb899862d287351e14aeeab6bd)
  clang revision 5430d7a9e60b0feb899862d287351e14aeeab6bd
  llvm revision 5430d7a9e60b0feb899862d287351e14aeeab6bd
Skipping the following test categories: ['libc++', 'msvcstl', 'dsym', 'gmodules', 'debugserver', 'objc']
[1, 2]

--
Command Output (stderr):
--
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py:338: UserWarning: received a malformed packet, expected 'seq != 0' for {'body': {'$__lldb_version': 'lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 5430d7a9e60b0feb899862d287351e14aeeab6bd)\n  clang revision 5430d7a9e60b0feb899862d287351e14aeeab6bd\n  llvm revision 5430d7a9e60b0feb899862d287351e14aeeab6bd', 'completionTriggerCharacters': ['.', ' ', '\t'], 'exceptionBreakpointFilters': [{'description': 'C++ Catch', 'filter': 'cpp_catch', 'label': 'C++ Catch', 'supportsCondition': True}, {'description': 'C++ Throw', 'filter': 'cpp_throw', 'label': 'C++ Throw', 'supportsCondition': True}, {'description': 'Objective-C Catch', 'filter': 'objc_catch', 'label': 'Objective-C Catch', 'supportsCondition': True}, {'description': 'Objective-C Throw', 'filter': 'objc_throw', 'label': 'Objective-C Throw', 'supportsCondition': True}], 'supportTerminateDebuggee': True, 'supportsBreakpointLocationsRequest': True, 'supportsCancelRequest': True, 'supportsCompletionsRequest': True, 'supportsConditionalBreakpoints': True, 'supportsConfigurationDoneRequest': True, 'supportsDataBreakpoints': True, 'supportsDelayedStackTraceLoading': True, 'supportsDisassembleRequest': True, 'supportsEvaluateForHovers': True, 'supportsExceptionFilterOptions': True, 'supportsExceptionInfoRequest': True, 'supportsFunctionBreakpoints': True, 'supportsHitConditionalBreakpoints': True, 'supportsInstructionBreakpoints': True, 'supportsLogPoints': True, 'supportsModuleSymbolsRequest': True, 'supportsModulesRequest': True, 'supportsReadMemoryRequest': True, 'supportsSetVariable': True, 'supportsSteppingGranularity': True, 'supportsValueFormattingOptions': True, 'supportsWriteMemoryRequest': True}, 'command': 'initialize', 'request_seq': 1, 'seq': 0, 'success': True, 'type': 'response'}
  warnings.warn(
========= DEBUG ADAPTER PROTOCOL LOGS =========
1761778651.749069452 (stdio) --> {"command":"initialize","type":"request","arguments":{"adapterID":"lldb-native","clientID":"vscode","columnsStartAt1":true,"linesStartAt1":true,"locale":"en-us","pathFormat":"path","supportsRunInTerminalRequest":true,"supportsVariablePaging":true,"supportsVariableType":true,"supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryEvent":true,"$__lldb_sourceInitFile":false},"seq":1}
1761778651.749300003 (stdio) queued (command=initialize seq=1)
1761778651.755900860 (stdio) <-- {"body":{"$__lldb_version":"lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 5430d7a9e60b0feb899862d287351e14aeeab6bd)\n  clang revision 5430d7a9e60b0feb899862d287351e14aeeab6bd\n  llvm revision 5430d7a9e60b0feb899862d287351e14aeeab6bd","completionTriggerCharacters":["."," ","\t"],"exceptionBreakpointFilters":[{"description":"C++ Catch","filter":"cpp_catch","label":"C++ Catch","supportsCondition":true},{"description":"C++ Throw","filter":"cpp_throw","label":"C++ Throw","supportsCondition":true},{"description":"Objective-C Catch","filter":"objc_catch","label":"Objective-C Catch","supportsCondition":true},{"description":"Objective-C Throw","filter":"objc_throw","label":"Objective-C Throw","supportsCondition":true}],"supportTerminateDebuggee":true,"supportsBreakpointLocationsRequest":true,"supportsCancelRequest":true,"supportsCompletionsRequest":true,"supportsConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsDataBreakpoints":true,"supportsDelayedStackTraceLoading":true,"supportsDisassembleRequest":true,"supportsEvaluateForHovers":true,"supportsExceptionFilterOptions":true,"supportsExceptionInfoRequest":true,"supportsFunctionBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsInstructionBreakpoints":true,"supportsLogPoints":true,"supportsModuleSymbolsRequest":true,"supportsModulesRequest":true,"supportsReadMemoryRequest":true,"supportsSetVariable":true,"supportsSteppingGranularity":true,"supportsValueFormattingOptions":true,"supportsWriteMemoryRequest":true},"command":"initialize","request_seq":1,"seq":0,"success":true,"type":"response"}
1761778651.758280516 (stdio) --> {"command":"launch","type":"request","arguments":{"program":"/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.test_clear_breakpoints_unset_breakpoints/a.out","initCommands":["settings clear --all","settings set symbols.enable-external-lookup false","settings set target.inherit-tcc true","settings set target.disable-aslr false","settings set target.detach-on-error false","settings set target.auto-apply-fixits false","settings set plugin.process.gdb-remote.packet-timeout 60","settings set symbols.clang-modules-cache-path \"/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api\"","settings set use-color false","settings set show-statusline false"],"disableASLR":false,"enableAutoVariableSummaries":false,"enableSyntheticChildDebugging":false,"displayExtendedBacktrace":false},"seq":2}
1761778651.758471251 (stdio) queued (command=launch seq=2)
1761778651.759070873 (stdio) <-- {"body":{"category":"console","output":"Running initCommands:\n"},"event":"output","seq":1,"type":"event"}
1761778651.759132385 (stdio) <-- {"body":{"category":"console","output":"(lldb) settings clear --all\n"},"event":"output","seq":2,"type":"event"}
1761778651.759148121 (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set symbols.enable-external-lookup false\n"},"event":"output","seq":3,"type":"event"}
1761778651.759162664 (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set target.inherit-tcc true\n"},"event":"output","seq":4,"type":"event"}
1761778651.759176254 (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set target.disable-aslr false\n"},"event":"output","seq":5,"type":"event"}
1761778651.759190083 (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set target.detach-on-error false\n"},"event":"output","seq":6,"type":"event"}
1761778651.759229422 (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set target.auto-apply-fixits false\n"},"event":"output","seq":7,"type":"event"}
1761778651.759243727 (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set plugin.process.gdb-remote.packet-timeout 60\n"},"event":"output","seq":8,"type":"event"}
1761778651.759259224 (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set symbols.clang-modules-cache-path \"/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api\"\n"},"event":"output","seq":9,"type":"event"}
1761778651.759273767 (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set use-color false\n"},"event":"output","seq":10,"type":"event"}
1761778651.759286880 (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set show-statusline false\n"},"event":"output","seq":11,"type":"event"}
1761778652.054436445 (stdio) <-- {"body":{"module":{"addressRange":"0xef14b000","debugInfoSize":"983.3KB","id":"C8C14F49-271D-D5EC-D97C-F1A70B997423-FCAC2BC1","name":"ld-linux-armhf.so.3","path":"/usr/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3","symbolFilePath":"/usr/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3","symbolStatus":"Symbols loaded."},"reason":"new"},"event":"module","seq":12,"type":"event"}
1761778652.054709435 (stdio) <-- {"body":{"module":{"addressRange":"0x5740000","debugInfoSize":"46.0KB","id":"FB363D51","name":"a.out","path":"/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.test_clear_breakpoints_unset_breakpoints/a.out","symbolFilePath":"/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/tools/lldb-dap/breakpoint/TestDAP_setBreakpoints.test_clear_breakpoints_unset_breakpoints/a.out","symbolStatus":"Symbols loaded."},"reason":"new"},"event":"module","seq":13,"type":"event"}

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 29, 2025

LLVM Buildbot has detected a new failure on builder lldb-remote-linux-win running on as-builder-10 while building lldb at step 16 "test-check-lldb-unit".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/197/builds/10355

Here is the relevant piece of the build log for the reference
Step 16 (test-check-lldb-unit) failure: Test just built components: check-lldb-unit completed (failure)
******************** TEST 'lldb-unit :: Host/./HostTests.exe/28/80' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\unittests\Host\.\HostTests.exe-lldb-unit-40112-28-80.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=80 GTEST_SHARD_INDEX=28 C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\unittests\Host\.\HostTests.exe
--

Script:
--
C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\unittests\Host\.\HostTests.exe --gtest_filter=Host.LaunchProcessDuplicatesHandle
--
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Host\HostTest.cpp(163): error: Value of: llvm::detail::TakeError(Host::LaunchProcess(info).takeError())
Expected: succeeded
  Actual: failed  (The parameter is incorrect.)
Google Test trace:
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Host\HostTest.cpp(152): Pipe handles are: 280/288


C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Host\HostTest.cpp:163
Value of: llvm::detail::TakeError(Host::LaunchProcess(info).takeError())
Expected: succeeded
  Actual: failed  (The parameter is incorrect.)
Google Test trace:
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Host\HostTest.cpp(152): Pipe handles are: 280/288



********************

Step 17 (test-check-lldb-api) failure: Test just built components: check-lldb-api completed (failure)
******************** TEST 'lldb-api :: commands/platform/basic/TestPlatformCommand.py' FAILED ********************
Script:
--
C:/Python312/python.exe C:/buildbot/as-builder-10/lldb-x-aarch64/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=C:/buildbot/as-builder-10/lldb-x-aarch64/build/./lib --env LLVM_INCLUDE_DIR=C:/buildbot/as-builder-10/lldb-x-aarch64/build/include --env LLVM_TOOLS_DIR=C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin --arch aarch64 --build-dir C:/buildbot/as-builder-10/lldb-x-aarch64/build/lldb-test-build.noindex --lldb-module-cache-dir C:/buildbot/as-builder-10/lldb-x-aarch64/build/lldb-test-build.noindex/module-cache-lldb\lldb-api --clang-module-cache-dir C:/buildbot/as-builder-10/lldb-x-aarch64/build/lldb-test-build.noindex/module-cache-clang\lldb-api --executable C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin/lldb.exe --compiler C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin/clang.exe --dsymutil C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin/dsymutil.exe --make C:/ninja/make.exe --llvm-tools-dir C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin --lldb-obj-root C:/buildbot/as-builder-10/lldb-x-aarch64/build/tools/lldb --lldb-libs-dir C:/buildbot/as-builder-10/lldb-x-aarch64/build/./lib --cmake-build-type Release --platform-url connect://jetson-agx-0086.lab.llvm.org:1234 --platform-working-dir /home/ubuntu/lldb-tests --sysroot c:/buildbot/fs/jetson-agx-ubuntu --env ARCH_CFLAGS=-mcpu=cortex-a78 --platform-name remote-linux --skip-category=lldb-server C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\test\API\commands\platform\basic -p TestPlatformCommand.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 5430d7a9e60b0feb899862d287351e14aeeab6bd)
  clang revision 5430d7a9e60b0feb899862d287351e14aeeab6bd
  llvm revision 5430d7a9e60b0feb899862d287351e14aeeab6bd
Setting up remote platform 'remote-linux'

Connecting to remote platform 'remote-linux' at 'connect://jetson-agx-0086.lab.llvm.org:1234'...

Connected.

Setting remote platform working directory to '/home/ubuntu/lldb-tests'...

Skipping the following test categories: ['lldb-server', 'libc++', 'msvcstl', 'dsym', 'gmodules', 'debugserver', 'objc', 'lldb-dap']


--
Command Output (stderr):
--
PASS: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_help_platform (TestPlatformCommand.PlatformCommandTestCase.test_help_platform)

PASS: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_help_shell_alias (TestPlatformCommand.PlatformCommandTestCase.test_help_shell_alias)

UNSUPPORTED: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_host_shell_interpreter (TestPlatformCommand.PlatformCommandTestCase.test_host_shell_interpreter) (skip on remote platform) 

PASS: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_list (TestPlatformCommand.PlatformCommandTestCase.test_list)

PASS: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_process_info_with_no_arg (TestPlatformCommand.PlatformCommandTestCase.test_process_info_with_no_arg)

PASS: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_process_list (TestPlatformCommand.PlatformCommandTestCase.test_process_list)

FAIL: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_shell (TestPlatformCommand.PlatformCommandTestCase.test_shell)

FAIL: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_shell_builtin (TestPlatformCommand.PlatformCommandTestCase.test_shell_builtin)

UNSUPPORTED: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_shell_timeout (TestPlatformCommand.PlatformCommandTestCase.test_shell_timeout) (Alias with option not supported by the command interpreter.) 

PASS: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_status (TestPlatformCommand.PlatformCommandTestCase.test_status)

======================================================================

FAIL: test_shell (TestPlatformCommand.PlatformCommandTestCase.test_shell)

...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 30, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-windows running on linaro-armv8-windows-msvc-05 while building lldb at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/141/builds/12624

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: commands/apropos/basic/TestApropos.py (16 of 2322)
PASS: lldb-api :: commands/breakpoint/command/list/TestBreakpointCommandList.py (17 of 2322)
PASS: lldb-api :: commands/apropos/with-process/TestAproposWithProcess.py (18 of 2322)
PASS: lldb-api :: commands/breakpoint/set/func-regex/TestBreakpointRegexError.py (19 of 2322)
PASS: lldb-api :: commands/command/container/TestContainerCommands.py (20 of 2322)
PASS: lldb-api :: commands/command/delete/TestCommandDelete.py (21 of 2322)
PASS: lldb-api :: commands/command/invalid-args/TestInvalidArgsCommand.py (22 of 2322)
UNSUPPORTED: lldb-api :: commands/command/language/TestFrameLanguageCommands.py (23 of 2322)
PASS: lldb-api :: commands/command/nested_alias/TestNestedAlias.py (24 of 2322)
PASS: lldb-api :: commands/command/regex/TestRegexCommand.py (25 of 2322)
FAIL: lldb-api :: commands/command/script/TestCommandScript.py (26 of 2322)
******************** TEST 'lldb-api :: commands/command/script/TestCommandScript.py' FAILED ********************
Script:
--
C:/Users/tcwg/scoop/apps/python/current/python.exe C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --env LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include --env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --arch aarch64 --build-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex --lldb-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-lldb\lldb-api --clang-module-cache-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-api --executable C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --compiler C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe --make C:/Users/tcwg/scoop/shims/make.exe --llvm-tools-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --lldb-obj-root C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb --lldb-libs-dir C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --cmake-build-type Release --skip-category=watchpoint C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\commands\command\script -p TestCommandScript.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 5430d7a9e60b0feb899862d287351e14aeeab6bd)
  clang revision 5430d7a9e60b0feb899862d287351e14aeeab6bd
  llvm revision 5430d7a9e60b0feb899862d287351e14aeeab6bd
Executing commands in 'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\commands\command\script\py_import'.
(lldb) script import sys, os
(lldb) script sys.path.append(os.path.join(os.getcwd(), os.pardir))
(lldb) script import welcome
(lldb) script import bug11569
(lldb) command script add welcome --class welcome.WelcomeCommand
(lldb) command script add targetname --class welcome.TargetnameCommand
(lldb) command script add longwait --function welcome.print_wait_impl
(lldb) command script import mysto.py --allow-reload
(lldb) command script add tell_sync --function welcome.check_for_synchro --synchronicity sync
(lldb) command script add tell_async --function welcome.check_for_synchro --synchronicity async
(lldb) command script add tell_curr --function welcome.check_for_synchro --synchronicity curr
(lldb) command script add takes_exe_ctx --function welcome.takes_exe_ctx
(lldb) command script import decorated.py
(lldb) command script import callables.py
(lldb) command script add -f callables.foobar foobar
(lldb) command script add -f callables.foobar4 foobar4
(lldb) command script add -f callables.vfoobar vfoobar
(lldb) command script add -f callables.v5foobar v5foobar
(lldb) command script add -f callables.FooBar.sfoobar sfoobar
(lldb) command script add -f callables.FooBar.cfoobar cfoobar
(lldb) command script add -f callables.FooBarObj.ifoobar ifoobar
(lldb) command script add -f callables.FooBar.sfoobar4 sfoobar4
(lldb) command script add -f callables.FooBar.cfoobar4 cfoobar4
(lldb) command script add -f callables.FooBarObj.ifoobar4 ifoobar4
(lldb) command script add -f callables.FooBarObj ofoobar

@charles-zablit
Copy link
Contributor

Hey @lb90, your PR broke some of the build bots. Can you please take a look?

@lb90
Copy link
Contributor Author

lb90 commented Oct 30, 2025

Uh, sorry for the breakage! Taking a look...

@DavidSpickett
Copy link
Collaborator

DavidSpickett commented Oct 30, 2025

LLVM Buildbot has detected a new failure on builder lldb-arm-ubuntu running on linaro-lldb-arm-ubuntu while building lldb at step 6 "test".

This one I suspect is a flaky lldb-dap change that actually landed before your changes.

This one is in fact due to earlier lldb-dap changes.

@DavidSpickett
Copy link
Collaborator

I didn't realise this was breaking 100s of tests, on Windows on Arm and x86_64 (https://lab.llvm.org/buildbot/#/builders/211/builds/3323). So I've reverted it for now.

@mstorsjo
Copy link
Member

Thanks for pushing a revert, I was just about to suggest that. I also ran into failures caused by this - see e.g. https://github.com/mstorsjo/llvm-mingw/actions/runs/18926652956/job/54057474985#step:6:1492.

There, you don’t see the actual error message though. Locally I’ve reproduced it too - it seems the failure isn’t deterministic though:

(lldb) r
Process 8264 launched: 'C:\code\llvm-mingw\test\aarch64\hello-exception.exe'
 (aarch64)
Process 8264 exited with status = 0 (0x00000000)
(lldb) r
error: The parameter is incorrect.
(lldb)

llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Oct 30, 2025
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 30, 2025
…165281)

CreateProcess fails with ERROR_INVALID_PARAMETER when duplicate HANDLEs
are passed via `PROC_THREAD_ATTRIBUTE_HANDLE_LIST`. This can happen, for
example, if stdout and stdin are the same device (e.g. a bidirectional
named pipe), or if stdout and stderr are the same device.

Fixes msys2/MINGW-packages#26030
aokblast pushed a commit to aokblast/llvm-project that referenced this pull request Oct 30, 2025
@charles-zablit
Copy link
Contributor

There, you don’t see the actual error message though. Locally I’ve reproduced it too - it seems the failure isn’t deterministic though:

My guess is that the order of the handles matters, and using an unordered_set shuffles the handles. The previous approach with std::sort and std::unique would also fail.

I suggest using a vector and checking if the value already exists before inserting. The vector will always have less than 10 values so there is no performance issues with an O(n) search.

@Michael137
Copy link
Member

There, you don’t see the actual error message though. Locally I’ve reproduced it too - it seems the failure isn’t deterministic though:

My guess is that the order of the handles matters, and using an unordered_set shuffles the handles. The previous approach with std::sort and std::unique would also fail.

I suggest using a vector and checking if the value already exists before inserting. The vector will always have less than 10 values so there is no performance issues with an O(n) search.

std::set or llvm::UniqueVector perhaps?

@charles-zablit
Copy link
Contributor

charles-zablit commented Oct 30, 2025

std::set or llvm::UniqueVector perhaps?

llvm::UniqueVector looks like what we need, thanks! I might be wrong but I think that std::set sorts the elements, while we want to preserve the insertion order.

@Michael137
Copy link
Member

std::set or llvm::UniqueVector perhaps?

llvm::UniqueVector looks like what we need, thanks! I might be wrong but I think that std::set sorts the elements, while we want to preserve the insertion order.

Ah yes missed the fact that you do t want them shuffled. Yea UniqueVector should do

@lb90
Copy link
Contributor Author

lb90 commented Oct 30, 2025

Perhaps the HANDLE array should be kept alive until the CreateProcess call?

@charles-zablit
Copy link
Contributor

Perhaps the HANDLE array should be kept alive until the CreateProcess call?

That's worth ensuring as well. Given the non deterministic nature of the test failures, my bet is on the insertion order. In the original code, replacing std::vector with llvm::UniqueVector would give us both the insertion order and the proper lifetime.

luciechoi pushed a commit to luciechoi/llvm-project that referenced this pull request Nov 1, 2025
DEBADRIBASAK pushed a commit to DEBADRIBASAK/llvm-project that referenced this pull request Nov 3, 2025
…165281)

CreateProcess fails with ERROR_INVALID_PARAMETER when duplicate HANDLEs
are passed via `PROC_THREAD_ATTRIBUTE_HANDLE_LIST`. This can happen, for
example, if stdout and stdin are the same device (e.g. a bidirectional
named pipe), or if stdout and stderr are the same device.

Fixes msys2/MINGW-packages#26030
DEBADRIBASAK pushed a commit to DEBADRIBASAK/llvm-project that referenced this pull request Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lldb can't run commands depending on output device type

7 participants