Skip to content

Conversation

@cooperp
Copy link
Contributor

@cooperp cooperp commented Dec 2, 2025

This is the LLVM piece of this work. There is also a clang piece, which adds this metadata to AllocaInst when the source does __attribute__((no_stack_protector)) on a variable.

We already have __attribute__((no_stack_protector)) on functions, but opting out the whole function might be too heavy a hammer. Instead this allows us to opt out of stack protectors on specific allocations we might have audited an know to be safe, but still allow the function to generate a stack protector if other allocations necessitate it.

@llvmbot
Copy link
Member

llvmbot commented Dec 2, 2025

@llvm/pr-subscribers-backend-aarch64

Author: None (cooperp)

Changes

This is the LLVM piece of this work. There is also a clang piece, which adds this metadata to AllocaInst when the source does __attribute__((no_stack_protector)) on a variable.

We already have __attribute__((no_stack_protector)) on functions, but opting out the whole function might be too heavy a hammer. Instead this allows us to opt out of stack protectors on specific allocations we might have audited an know to be safe, but still allow the function to generate a stack protector if other allocations necessitate it.


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

2 Files Affected:

  • (modified) llvm/lib/CodeGen/StackProtector.cpp (+5)
  • (added) llvm/test/CodeGen/AArch64/stack-protector-metadata.ll (+58)
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp
index 5fd5d6cce23df..66ea09975f412 100644
--- a/llvm/lib/CodeGen/StackProtector.cpp
+++ b/llvm/lib/CodeGen/StackProtector.cpp
@@ -431,6 +431,11 @@ bool SSPLayoutAnalysis::requiresStackProtector(Function *F,
   for (const BasicBlock &BB : *F) {
     for (const Instruction &I : BB) {
       if (const AllocaInst *AI = dyn_cast<AllocaInst>(&I)) {
+        if (MDNode* MD = AI->getMetadata("stack-protector")) {
+          auto* CI = mdconst::dyn_extract<ConstantInt>(MD->getOperand(0));
+          if (CI->isZero())
+            continue;
+        }
         if (AI->isArrayAllocation()) {
           auto RemarkBuilder = [&]() {
             return OptimizationRemark(DEBUG_TYPE, "StackProtectorAllocaOrArray",
diff --git a/llvm/test/CodeGen/AArch64/stack-protector-metadata.ll b/llvm/test/CodeGen/AArch64/stack-protector-metadata.ll
new file mode 100644
index 0000000000000..a0aa8859b1887
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/stack-protector-metadata.ll
@@ -0,0 +1,58 @@
+; RUN: llc -mtriple=aarch64-apple-darwin < %s -o - | FileCheck %s
+
+target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
+target triple = "arm64-apple-darwin25.1.0"
+
+@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
+
+; CHECK-LABEL: test1:
+; CHECK-NOT: ___stack_chk_guard
+
+; Function Attrs: noinline nounwind optnone
+define void @test1(ptr noundef %msg) #0 {
+entry:
+  %msg.addr = alloca ptr, align 8
+  %a = alloca [1000 x i8], align 1, !stack-protector !2
+  store ptr %msg, ptr %msg.addr, align 8
+  %arraydecay = getelementptr inbounds [1000 x i8], ptr %a, i64 0, i64 0
+  %0 = load ptr, ptr %msg.addr, align 8
+  %call = call ptr @strcpy(ptr noundef %arraydecay, ptr noundef %0) #3
+  %arraydecay1 = getelementptr inbounds [1000 x i8], ptr %a, i64 0, i64 0
+  %call2 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %arraydecay1)
+  ret void
+}
+
+
+; CHECK-LABEL: test2:
+; CHECK: ___stack_chk_guard
+
+; Function Attrs: noinline nounwind optnone
+define void @test2(ptr noundef %msg) #0 {
+entry:
+  %msg.addr = alloca ptr, align 8
+  %b = alloca [1000 x i8], align 1
+  store ptr %msg, ptr %msg.addr, align 8
+  %arraydecay = getelementptr inbounds [1000 x i8], ptr %b, i64 0, i64 0
+  %0 = load ptr, ptr %msg.addr, align 8
+  %call = call ptr @strcpy(ptr noundef %arraydecay, ptr noundef %0) #3
+  %arraydecay1 = getelementptr inbounds [1000 x i8], ptr %b, i64 0, i64 0
+  %call2 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %arraydecay1)
+  ret void
+}
+
+; Function Attrs: nounwind
+declare ptr @strcpy(ptr noundef, ptr noundef) #1
+
+declare i32 @printf(ptr noundef, ...) #2
+
+attributes #0 = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" ssp }
+attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+attributes #3 = { nounwind }
+
+!llvm.module.flags = !{!0}
+!llvm.ident = !{!1}
+
+!0 = !{i32 1, !"wchar_size", i32 4}
+!1 = !{!"clang version 22.0.0"}
+!2 = !{i32 0}

@cooperp cooperp requested review from ahatanak and ributzka December 2, 2025 00:27
@github-actions
Copy link

github-actions bot commented Dec 2, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Collaborator

@ributzka ributzka left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

for (const BasicBlock &BB : *F) {
for (const Instruction &I : BB) {
if (const AllocaInst *AI = dyn_cast<AllocaInst>(&I)) {
if (MDNode* MD = AI->getMetadata("stack-protector")) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if stack-protector is 1? Should it force a stack protector, or is that an unexpected value?

Copy link
Contributor

@apple-fcloutier apple-fcloutier Dec 4, 2025

Choose a reason for hiding this comment

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

I like the idea too, though this is meant to support __attribute__((no_stack_protector)) on locals and I don't think there's a matching __attribute__((stack_protector)) to piggyback on. Could be useful in some paranoid cases, though.

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

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

The metadata needs to be documented in LangRef.

…otection.

This is the LLVM piece of this work.  The clang work permitted the no_stack_protector
attribute on local variables. That generated new metadata which is used here to
skip any alloca's which would otherwise require a stack protector.
@cooperp cooperp force-pushed the dev/pete/llvm-no-stack-protector branch from c81e7db to eb3cd8e Compare December 8, 2025 22:42
@github-actions
Copy link

github-actions bot commented Dec 8, 2025

🐧 Linux x64 Test Results

  • 166908 tests passed
  • 2917 tests skipped
  • 1 test failed

Failed Tests

(click on a test name to see its output)

lldb-api

lldb-api.tools/lldb-dap/output/TestDAP_output.py
Script:
--
/usr/bin/python3 /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./lib --env LLVM_INCLUDE_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/include --env LLVM_TOOLS_DIR=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin --libcxx-include-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/include/c++/v1 --libcxx-include-target-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/include/x86_64-unknown-linux-gnu/c++/v1 --libcxx-library-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./lib/x86_64-unknown-linux-gnu --arch x86_64 --build-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex --lldb-module-cache-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/lldb --compiler /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/clang --dsymutil /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./bin --lldb-obj-root /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lldb --lldb-libs-dir /home/gha/actions-runner/_work/llvm-project/llvm-project/build/./lib --cmake-build-type Release /home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/test/API/tools/lldb-dap/output -p TestDAP_output.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project revision 130d64de543ebd8f070bab4dfc8ccd5ed0639bf2)
  clang revision 130d64de543ebd8f070bab4dfc8ccd5ed0639bf2
  llvm revision 130d64de543ebd8f070bab4dfc8ccd5ed0639bf2
Skipping the following test categories: msvcstl, dsym, pdb, gmodules, debugserver, objc

--
Command Output (stderr):
--
========= DEBUG ADAPTER PROTOCOL LOGS =========
FAIL: LLDB (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang-x86_64) :: test_output (TestDAP_output.TestDAP_output.test_output)
[22:58:08.641] (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}
[22:58:08.641] DAP.cpp:1007 (stdio) queued (command=initialize seq=1)
[22:58:08.641] (stdio) <-- {"body":{"$__lldb_version":"lldb version 22.0.0git (https://github.com/llvm/llvm-project revision 130d64de543ebd8f070bab4dfc8ccd5ed0639bf2)\n  clang revision 130d64de543ebd8f070bab4dfc8ccd5ed0639bf2\n  llvm revision 130d64de543ebd8f070bab4dfc8ccd5ed0639bf2","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,"supportsDataBreakpointBytes":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":1,"success":true,"type":"response"}
[22:58:08.642] (stdio) --> {"command":"launch","type":"request","arguments":{"program":"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/tools/lldb-dap/output/TestDAP_output.test_output/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/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/module-cache-lldb/lldb-api\"","settings set use-color false","settings set show-statusline false"],"exitCommands":["?script print('out\\0\\0', end='\\r\\n', file=sys.stdout)","?script print('err\\0\\0', end='\\r\\n', file=sys.stderr)"],"disableASLR":false,"enableAutoVariableSummaries":false,"enableSyntheticChildDebugging":false,"displayExtendedBacktrace":false},"seq":2}
[22:58:08.643] DAP.cpp:1007 (stdio) queued (command=launch seq=2)
[22:58:08.646] (stdio) <-- {"body":{"category":"console","output":"Running initCommands:\n"},"event":"output","seq":2,"type":"event"}
[22:58:08.646] (stdio) <-- {"body":{"category":"console","output":"(lldb) settings clear --all\n"},"event":"output","seq":3,"type":"event"}
[22:58:08.646] (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set symbols.enable-external-lookup false\n"},"event":"output","seq":4,"type":"event"}
[22:58:08.646] (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set target.inherit-tcc true\n"},"event":"output","seq":5,"type":"event"}
[22:58:08.646] (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set target.disable-aslr false\n"},"event":"output","seq":6,"type":"event"}
[22:58:08.646] (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set target.detach-on-error false\n"},"event":"output","seq":7,"type":"event"}
[22:58:08.646] (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set target.auto-apply-fixits false\n"},"event":"output","seq":8,"type":"event"}
[22:58:08.646] (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set plugin.process.gdb-remote.packet-timeout 60\n"},"event":"output","seq":9,"type":"event"}
[22:58:08.646] (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set symbols.clang-modules-cache-path \"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/module-cache-lldb/lldb-api\"\n"},"event":"output","seq":10,"type":"event"}
[22:58:08.646] (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set use-color false\n"},"event":"output","seq":11,"type":"event"}
[22:58:08.647] (stdio) <-- {"body":{"category":"console","output":"(lldb) settings set show-statusline false\n"},"event":"output","seq":12,"type":"event"}
[22:58:08.688] (stdio) <-- {"command":"launch","request_seq":2,"seq":13,"success":true,"type":"response"}
[22:58:08.688] (stdio) <-- {"event":"initialized","seq":14,"type":"event"}
[22:58:08.688] (stdio) --> {"command":"setBreakpoints","type":"request","arguments":{"source":{"path":"main.c"},"sourceModified":false,"lines":[10],"breakpoints":[{"line":10}]},"seq":3}
[22:58:08.688] DAP.cpp:1007 (stdio) queued (command=setBreakpoints seq=3)
[22:58:08.689] (stdio) <-- {"body":{"module":{"addressRange":"0x7c3688d1d000","id":"520E0587-8220-FB2F-C6D2-8FF46B63B3FD-5D48E763","name":"ld-linux-x86-64.so.2","path":"/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2","symbolStatus":"Symbols not found."},"reason":"new"},"event":"module","seq":15,"type":"event"}
[22:58:08.689] (stdio) <-- {"body":{"module":{"addressRange":"0x7ffd4d109000","id":"935E8301-3E94-6C72-593D-620D433BE6E8-4F9BB79F","name":"[vdso]","path":"[vdso]","symbolStatus":"Symbols not found."},"reason":"new"},"event":"module","seq":16,"type":"event"}
[22:58:08.689] (stdio) <-- {"body":{"module":{"addressRange":"0x5cee09727000","debugInfoSize":"1.1KB","id":"0B9B2F64","name":"a.out","path":"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/tools/lldb-dap/output/TestDAP_output.test_output/a.out","symbolFilePath":"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/tools/lldb-dap/output/TestDAP_output.test_output/a.out","symbolStatus":"Symbols loaded."},"reason":"new"},"event":"module","seq":17,"type":"event"}
[22:58:08.691] (stdio) <-- {"body":{"breakpoints":[{"column":3,"id":1,"instructionReference":"0x5CEE09728189","line":10,"source":{"name":"main.c","path":"/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/test/API/tools/lldb-dap/output/main.c"},"verified":true}]},"command":"setBreakpoints","request_seq":3,"seq":18,"success":true,"type":"response"}
[22:58:08.691] (stdio) <-- {"body":{"breakpoint":{"column":3,"id":1,"instructionReference":"0x5CEE09728189","line":10,"verified":true},"reason":"changed"},"event":"breakpoint","seq":19,"type":"event"}
[22:58:08.692] (stdio) --> {"command":"configurationDone","type":"request","arguments":{},"seq":4}
[22:58:08.692] DAP.cpp:1007 (stdio) queued (command=configurationDone seq=4)
[22:58:08.692] (stdio) <-- {"body":{"capabilities":{"supportsModuleSymbolsRequest":true,"supportsRestartRequest":true,"supportsStepInTargetsRequest":true}},"event":"capabilities","seq":20,"type":"event"}
[22:58:08.692] (stdio) <-- {"body":{"isLocalProcess":true,"name":"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/tools/lldb-dap/output/TestDAP_output.test_output/a.out","pointerSize":64,"startMethod":"launch","systemProcessId":1586211},"event":"process","seq":21,"type":"event"}
[22:58:08.692] (stdio) <-- {"command":"configurationDone","request_seq":4,"seq":22,"success":true,"type":"response"}
[22:58:08.693] (stdio) --> {"command":"threads","type":"request","arguments":{},"seq":5}
[22:58:08.693] DAP.cpp:1007 (stdio) queued (command=threads seq=5)
[22:58:08.693] (stdio) <-- {"body":{"threads":[{"id":1586211,"name":"a.out"}]},"command":"threads","request_seq":5,"seq":23,"success":true,"type":"response"}
[22:58:08.725] (stdio) <-- {"body":{"module":{"addressRange":"0x7c3688c07000","id":"E22764DB","name":"libc++.so.1","path":"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/x86_64-unknown-linux-gnu/libc++.so.1","symbolFilePath":"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/x86_64-unknown-linux-gnu/libc++.so.1","symbolStatus":"Symbols loaded."},"reason":"new"},"event":"module","seq":24,"type":"event"}
[22:58:08.725] (stdio) <-- {"body":{"module":{"addressRange":"0x7c3688bbe000","id":"F89EEB3C","name":"libc++abi.so.1","path":"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/x86_64-unknown-linux-gnu/libc++abi.so.1","symbolFilePath":"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/x86_64-unknown-linux-gnu/libc++abi.so.1","symbolStatus":"Symbols loaded."},"reason":"new"},"event":"module","seq":25,"type":"event"}
[22:58:08.725] (stdio) <-- {"body":{"module":{"addressRange":"0x7c3688bae000","id":"11EA0258","name":"libunwind.so.1","path":"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/x86_64-unknown-linux-gnu/libunwind.so.1","symbolFilePath":"/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/x86_64-unknown-linux-gnu/libunwind.so.1","symbolStatus":"Symbols loaded."},"reason":"new"},"event":"module","seq":26,"type":"event"}
[22:58:08.725] (stdio) <-- {"body":{"module":{"addressRange":"0x7c3688a94000","id":"30724452-88DD-2ABA-348B-F583C65F7050-9AAB8141","name":"libgcc_s.so.1","path":"/lib/x86_64-linux-gnu/libgcc_s.so.1","symbolStatus":"Symbols not found."},"reason":"new"},"event":"module","seq":27,"type":"event"}
[22:58:08.725] (stdio) <-- {"body":{"module":{"addressRange":"0x7c3688880000","id":"274EEC48-8D23-0825-A136-FA9C4D85370F-ED7A0A5E","name":"libc.so.6","path":"/lib/x86_64-linux-gnu/libc.so.6","symbolStatus":"Symbols not found."},"reason":"new"},"event":"module","seq":28,"type":"event"}
[22:58:08.725] (stdio) <-- {"body":{"module":{"addressRange":"0x7c3688ac2000","id":"F834D730-8D26-6021-8ED4-F7486A58E28C-8464FE4B","name":"libm.so.6","path":"/lib/x86_64-linux-gnu/libm.so.6","symbolStatus":"Symbols not found."},"reason":"new"},"event":"module","seq":29,"type":"event"}
[22:58:08.725] (stdio) <-- {"body":{"module":{"addressRange":"0x7c3688875000","id":"D2D793C5-CDFA-B4C2-E083-F41AAF689B69-4B62EACD","name":"libatomic.so.1","path":"/lib/x86_64-linux-gnu/libatomic.so.1","symbolStatus":"Symbols not found."},"reason":"new"},"event":"module","seq":30,"type":"event"}
[22:58:08.727] (stdio) <-- {"body":{"category":"stdout","output":"abcdefghi\r\n"},"event":"output","seq":31,"type":"event"}
[22:58:08.728] (stdio) <-- {"body":{"allThreadsStopped":true,"description":"breakpoint 1.1","hitBreakpointIds":[1],"preserveFocusHint":false,"reason":"breakpoint","threadCausedFocus":true,"threadId":1586211},"event":"stopped","seq":32,"type":"event"}
[22:58:08.979] (stdio) --> {"command":"threads","type":"request","arguments":{},"seq":6}
[22:58:08.979] DAP.cpp:1007 (stdio) queued (command=threads seq=6)
[22:58:08.979] (stdio) <-- {"body":{"threads":[{"id":1586211,"name":"a.out"}]},"command":"threads","request_seq":6,"seq":33,"success":true,"type":"response"}
[22:58:08.983] (stdio) --> {"command":"continue","type":"request","arguments":{"threadId":1586211},"seq":7}
[22:58:08.983] DAP.cpp:1007 (stdio) queued (command=continue seq=7)
[22:58:08.984] (stdio) <-- {"body":{"allThreadsContinued":true},"command":"continue","request_seq":7,"seq":34,"success":true,"type":"response"}
[22:58:08.985] (stdio) <-- {"body":{"allThreadsContinued":true,"threadId":1586211},"event":"continued","seq":35,"type":"event"}
[22:58:08.986] (stdio) <-- {"body":{"category":"stdout","output":"hello world\r\n"},"event":"output","seq":36,"type":"event"}
[22:58:08.986] (stdio) <-- {"body":{"category":"stdout","output":"finally\u0000\u0000"},"event":"output","seq":37,"type":"event"}
[22:58:08.986] (stdio) <-- {"body":{"category":"console","output":"Process 1586211 exited with status = 0 (0x00000000) \n"},"event":"output","seq":38,"type":"event"}
[22:58:09.024] (stdio) <-- {"body":{"category":"console","output":"out\u0000\u0000\r\n"},"event":"output","seq":39,"type":"event"}
[22:58:09.025] (stdio) <-- {"body":{"exitCode":0},"event":"exited","seq":40,"type":"event"}
[22:58:09.025] (stdio) --> {"command":"disconnect","type":"request","arguments":{},"seq":8}
[22:58:09.025] DAP.cpp:1007 (stdio) queued (command=disconnect seq=8)
[22:58:09.028] (stdio) <-- {"body":{"$__lldb_statistics":{"commands":"{\"settings clear\":1}","memory":"{\"strings\":{\"bytesTotal\":1056768,\"bytesUnused\":428707,\"bytesUsed\":628061}}","plugins":"{\"abi\":[{\"enabled\":true,\"name\":\"SysV-arm64\"},{\"enabled\":true,\"name\":\"ABIMacOSX_arm64\"},{\"enabled\":true,\"name\":\"SysV-arm\"},{\"enabled\":true,\"name\":\"macosx-arm\"},{\"enabled\":true,\"name\":\"sysv-hexagon\"},{\"enabled\":true,\"name\":\"sysv-loongarch\"},{\"enabled\":true,\"name\":\"sysv-mips\"},{\"enabled\":true,\"name\":\"sysv-mips64\"},{\"enabled\":true,\"name\":\"sysv-msp430\"},{\"enabled\":true,\"name\":\"sysv-ppc\"},{\"enabled\":true,\"name\":\"sysv-ppc64\"},{\"enabled\":true,\"name\":\"sysv-riscv\"},{\"enabled\":true,\"name\":\"sysv-s390x\"},{\"enabled\":true,\"name\":\"abi.macosx-i386\"},{\"enabled\":true,\"name\":\"sysv-i386\"},{\"enabled\":true,\"name\":\"sysv-x86_64\"},{\"enabled\":true,\"name\":\"windows-x86_64\"}],\"architecture\":[{\"enabled\":true,\"name\":\"arm\"},{\"enabled\":true,\"name\":\"mips\"},{\"enabled\":true,\"name\":\"ppc64\"},{\"enabled\":true,\"name\":\"aarch64\"}],\"disassembler\":[{\"enabled\":true,\"name\":\"llvm-mc\"}],\"dynamic-loader\":[{\"enabled\":true,\"name\":\"darwin-kernel\"},{\"enabled\":true,\"name\":\"freebsd-kernel\"},{\"enabled\":true,\"name\":\"macosx-dyld\"},{\"enabled\":true,\"name\":\"macos-dyld\"},{\"enabled\":true,\"name\":\"posix-dyld\"},{\"enabled\":true,\"name\":\"static\"},{\"enabled\":true,\"name\":\"hexagon-dyld\"},{\"enabled\":true,\"name\":\"windows-dyld\"},{\"enabled\":true,\"name\":\"wasm-dyld\"}],\"emulate-instruction\":[{\"enabled\":true,\"name\":\"arm\"},{\"enabled\":true,\"name\":\"arm64\"},{\"enabled\":true,\"name\":\"LoongArch\"},{\"enabled\":true,\"name\":\"mips32\"},{\"enabled\":true,\"name\":\"mips64\"},{\"enabled\":true,\"name\":\"ppc64\"},{\"enabled\":true,\"name\":\"riscv\"}],\"instrumentation-runtime\":[{\"enabled\":true,\"name\":\"AddressSanitizer\"},{\"enabled\":true,\"name\":\"Libsanitizers-ASan\"},{\"enabled\":true,\"name\":\"BoundsSafety\"},{\"enabled\":true,\"name\":\"MainThreadChecker\"},{\"enabled\":true,\"name\":\"ThreadSanitizer\"},{\"enabled\":true,\"name\":\"UndefinedBehaviorSanitizer\"}],\"jit-loader\":[{\"enabled\":true,\"name\":\"gdb\"}],\"language\":[{\"enabled\":true,\"name\":\"cplusplus\"},{\"enabled\":true,\"name\":\"objc\"},{\"enabled\":true,\"name\":\"objcplusplus\"}],\"language-runtime\":[{\"enabled\":true,\"name\":\"itanium\"},{\"enabled\":true,\"name\":\"apple-objc-v2\"},{\"enabled\":true,\"name\":\"apple-objc-v1\"},{\"enabled\":true,\"name\":\"gnustep-objc-libobjc2\"}],\"memory-history\":[{\"enabled\":true,\"name\":\"asan\"}],\"object-container\":[{\"enabled\":true,\"name\":\"bsd-archive\"},{\"enabled\":true,\"name\":\"mach-o\"},{\"enabled\":true,\"name\":\"mach-o-fileset\"}],\"object-file\":[{\"enabled\":true,\"name\":\"breakpad\"},{\"enabled\":true,\"name\":\"COFF\"},{\"enabled\":true,\"name\":\"elf\"},{\"enabled\":true,\"name\":\"JSON\"},{\"enabled\":true,\"name\":\"mach-o\"},{\"enabled\":true,\"name\":\"minidump\"},{\"enabled\":true,\"name\":\"pdb\"},{\"enabled\":true,\"name\":\"pe-coff\"},{\"enabled\":true,\"name\":\"xcoff\"},{\"enabled\":true,\"name\":\"wasm\"}],\"operating-system\":[{\"enabled\":true,\"name\":\"python\"}],\"platform\":[{\"enabled\":true,\"name\":\"remote-AIX\"},{\"enabled\":true,\"name\":\"remote-linux\"},{\"enabled\":true,\"name\":\"remote-android\"},{\"enabled\":true,\"name\":\"remote-freebsd\"},{\"enabled\":true,\"name\":\"remote-gdb-server\"},{\"enabled\":true,\"name\":\"darwin\"},{\"enabled\":true,\"name\":\"remote-ios\"},{\"enabled\":true,\"name\":\"remote-macosx\"},{\"enabled\":true,\"name\":\"host\"},{\"enabled\":true,\"name\":\"remote-netbsd\"},{\"enabled\":true,\"name\":\"remote-openbsd\"},{\"enabled\":true,\"name\":\"qemu-user\"},{\"enabled\":true,\"name\":\"remote-windows\"}],\"process\":[{\"enabled\":true,\"name\":\"ScriptedProcess\"},{\"enabled\":true,\"name\":\"elf-core\"},{\"enabled\":true,\"name\":\"mach-o-core\"},{\"enabled\":true,\"name\":\"minidump\"},{\"enabled\":true,\"name\":\"wasm\"},{\"enabled\":true,\"name\":\"gdb-remote\"}],\"register-type-builder\":[{\"enabled\":true,\"name\":\"register-types-clang\"}],\"repl\":[{\"enabled\":true,\"name\":\"ClangREPL\"}],\"script-interpreter\":[{\"enabled\":true,\"name\":\"script-none\"},{\"enabled\":true,\"name\":\"script-python\"}],\"scripted-interface\":[{\"enabled\":true,\"name\":\"OperatingSystemPythonInterface\"},{\"enabled\":true,\"name\":\"ScriptedPlatformPythonInterface\"},{\"enabled\":true,\"name\":\"ScriptedProcessPythonInterface\"},{\"enabled\":true,\"name\":\"ScriptedStopHookPythonInterface\"},{\"enabled\":true,\"name\":\"ScriptedBreakpointPythonInterface\"},{\"enabled\":true,\"name\":\"ScriptedThreadPlanPythonInterface\"},{\"enabled\":true,\"name\":\"ScriptedFrameProviderPythonInterface\"}],\"structured-data\":[{\"enabled\":true,\"name\":\"darwin-log\"}],\"symbol-file\":[{\"enabled\":true,\"name\":\"breakpad\"},{\"enabled\":true,\"name\":\"CTF\"},{\"enabled\":true,\"name\":\"dwarf\"},{\"enabled\":true,\"name\":\"dwarf-debugmap\"},{\"enabled\":true,\"name\":\"JSON\"},{\"enabled\":true,\"name\":\"native-pdb\"},{\"enabled\":true,\"name\":\"pdb\"},{\"enabled\":true,\"name\":\"symtab\"}],\"symbol-locator\":[{\"enabled\":true,\"name\":\"debuginfod\"},{\"enabled\":true,\"name\":\"Default\"}],\"symbol-vendor\":[{\"enabled\":true,\"name\":\"ELF\"},{\"enabled\":true,\"name\":\"PE-COFF\"},{\"enabled\":true,\"name\":\"WASM\"}],\"system-runtime\":[{\"enabled\":true,\"name\":\"systemruntime-macosx\"}],\"trace-exporter\":[{\"enabled\":true,\"name\":\"ctf\"}],\"type-system\":[{\"enabled\":true,\"name\":\"clang\"}],\"unwind-assembly\":[{\"enabled\":true,\"name\":\"inst-emulation\"},{\"enabled\":true,\"name\":\"x86\"}]}","targets":"[{\"breakpoints\":[{\"details\":{\"Breakpoint\":{\"BKPTOptions\":{\"AutoContinue\":false,\"ConditionText\":\"\",\"EnabledState\":true,\"IgnoreCount\":0,\"OneShotState\":false},\"BKPTResolver\":{\"Options\":{\"Column\":0,\"Exact\":false,\"FileName\":\"/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/test/API/tools/lldb-dap/output/main.c\",\"Inlines\":true,\"LineNumber\":10,\"Offset\":0,\"SkipPrologue\":true},\"Type\":\"FileAndLine\"},\"Hardware\":false,\"Names\":[\"dap\"],\"SearchFilter\":{\"Options\":{},\"Type\":\"Unconstrained\"}}},\"hitCount\":1,\"id\":1,\"internal\":false,\"numLocations\":1,\"numResolvedLocations\":1,\"resolveTime\":0.001114},{\"details\":{\"Breakpoint\":{\"BKPTOptions\":{\"AutoContinue\":false,\"ConditionText\":\"\",\"EnabledState\":true,\"IgnoreCount\":0,\"OneShotState\":false},\"BKPTResolver\":{\"Options\":{\"Language\":\"c\",\"NameMask\":[4,4,4,4,4,4],\"Offset\":0,\"SkipPrologue\":false,\"SymbolNames\":[\"_dl_debug_state\",\"rtld_db_dlactivity\",\"__dl_rtld_db_dlactivity\",\"r_debug_state\",\"_r_debug_state\",\"_rtld_debug_state\"]},\"Type\":\"SymbolName\"},\"Hardware\":false,\"SearchFilter\":{\"Options\":{\"ModuleList\":[\"/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2\"]},\"Type\":\"Modules\"}}},\"hitCount\":2,\"id\":-1,\"internal\":true,\"kindDescription\":\"shared-library-event\",\"numLocations\":1,\"numResolvedLocations\":1,\"resolveTime\":0.000155}],\"dyldPluginName\":\"posix-dyld\",\"expressionEvaluation\":{\"failures\":0,\"successes\":0},\"firstStopTime\":0.022358757999999999,\"frameVariable\":{\"failures\":0,\"successes\":0},\"launchOrAttachTime\":0.017395678000000001,\"moduleIdentifiers\":[1029189744,1029779824,1028051280,138325461569040,138325260242256,138325797114672,138325394459584,138325058934320,138324991806576,138324589153392],\"signals\":[{\"SIGSTOP\":1}],\"sourceMapDeduceCount\":0,\"sourceRealpathAttemptCount\":0,\"sourceRealpathCompatibleCount\":0,\"stopCount\":8,\"summaryProviderStatistics\":[],\"targetCreateTime\":0.017117,\"totalBreakpointResolveTime\":0.0012689999999999999,\"totalSharedLibraryEventHitCount\":2}]","totalDebugInfoByteSize":1165,"totalDebugInfoEnabled":1,"totalDebugInfoIndexLoadedFromCache":0,"totalDebugInfoIndexSavedToCache":0,"totalDebugInfoIndexTime":0.014619999999999999,"totalDebugInfoParseTime":9.5000000000000005e-05,"totalDwoErrorCount":0,"totalDwoFileCount":0,"totalLoadedDwoFileCount":0,"totalModuleCount":10,"totalModuleCountHasDebugInfo":1,"totalModuleCountWithIncompleteTypes":0,"totalModuleCountWithVariableErrors":0,"totalSymbolLocatorTime":"{\"Default\":0.0073229999999999996,\"debuginfod\":1.9999999999999999e-06}","totalSymbolTableIndexTime":0.014554000000000003,"totalSymbolTableParseTime":0.071056999999999995,"totalSymbolTableStripped":0,"totalSymbolTableSymbolCount":12617,"totalSymbolTablesLoaded":10,"totalSymbolTablesLoadedFromCache":0,"totalSymbolTablesSavedToCache":0}},"event":"terminated","seq":41,"type":"event"}
[22:58:09.028] (stdio) <-- {"command":"disconnect","request_seq":8,"seq":42,"success":true,"type":"response"}
[22:58:09.028] (stdio) <-- {"body":{"category":"console","output":"err\u0000\u0000\r\n"},"event":"output","seq":43,"type":"event"}

========= END =========
======================================================================
FAIL: test_output (TestDAP_output.TestDAP_output.test_output)
   Test output handling for the running process.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/gha/actions-runner/_work/llvm-project/llvm-project/lldb/test/API/tools/lldb-dap/output/TestDAP_output.py", line 49, in test_output
    self.assertIn(
AssertionError: 'out\x00\x00\r\nerr\x00\x00\r\n' not found in 'Running initCommands:\n(lldb) settings clear --all\n(lldb) settings set symbols.enable-external-lookup false\n(lldb) settings set target.inherit-tcc true\n(lldb) settings set target.disable-aslr false\n(lldb) settings set target.detach-on-error false\n(lldb) settings set target.auto-apply-fixits false\n(lldb) settings set plugin.process.gdb-remote.packet-timeout 60\n(lldb) settings set symbols.clang-modules-cache-path "/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lldb-test-build.noindex/module-cache-lldb/lldb-api"\n(lldb) settings set use-color false\n(lldb) settings set show-statusline false\nProcess 1586211 exited with status = 0 (0x00000000) \nout\x00\x00\r\n' : full console message not found
Config=x86_64-/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/clang
----------------------------------------------------------------------
Ran 1 test in 0.759s

FAILED (failures=1)

--

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants