Skip to content

[lldb] Provide lr value in faulting frame on arm64 #138805

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

Conversation

jasonmolenda
Copy link
Collaborator

When a frameless function faults or is interrupted asynchronously, the UnwindPlan MAY have no register location rule for the return address register (lr on arm64); the value is simply live in the lr register when it was interrupted, and the frame below this on the stack -- e.g. sigtramp on a Unix system -- has the full register context, including that register.

RegisterContextUnwind::SavedLocationForRegister, when asked to find the caller's pc value, will first see if there is a pc register location. If there isn't, on a Return Address Register architecture like arm/mips/riscv, we rewrite the register request from "pc" to "RA register", and search for a location.

On frame 0 (the live frame) and an interrupted frame, the UnwindPlan may have no register location rule for the RA Reg, that is valid. A frameless function that never calls another may simply keep the return address in the live register the whole way. Our instruction emulation unwind plans explicitly add a rule (see Pavel's May 2024 change #91321 ), but an UnwindPlan sourced from debug_frame may not.

I've got a case where this exactly happens - clang debug_frame for arm64 where there is no register location for the lr in a frameless function. There is a fault in the middle of this frameless function and we only get the lr value from the fault handler below this frame if lr has a register location of IsSame, in line with Pavel's 2024 change.

Similar to how we see a request of the RA Reg from frame 0 after failing to find an unwind location for the pc register, the same style of special casing is needed when this is a function that was interrupted.

Without this change, we can find the pc of the frame that was executing when it was interrupted, but we need $lr to find its caller, and we don't descend down to the trap handler to get that value, truncating the stack.

rdar://145614545

When a frameless function faults or is interrupted asynchronously,
the UnwindPlan MAY have no register location rule for the return
address register (lr on arm64); the value is simply live in the
lr register when it was interrupted, and the frame below this on
the stack -- e.g. sigtramp on a Unix system -- has the full
register context, including that register.

RegisterContextUnwind::SavedLocationForRegister, when asked to find
the caller's pc value, will first see if there is a pc register
location.  If there isn't, on a Return Address Register architecture
like arm/mips/riscv, we rewrite the register request from "pc" to
"RA register", and search for a location.

On frame 0 (the live frame) and an interrupted frame, the UnwindPlan
may have no register location rule for the RA Reg, that is valid.
A frameless function that never calls another may simply keep the
return address in the live register the whole way.  Our instruction
emulation unwind plans explicitly add a rule (see Pavel's May 2024
change llvm#91321 ), but an
UnwindPlan sourced from debug_frame may not.

I've got a case where this exactly happens - clang debug_frame for
arm64 where there is no register location for the lr in a frameless
function.  There is a fault in the middle of this frameless function
and we only get the lr value from the fault handler below this frame
if lr has a register location of `IsSame`, in line with Pavel's
2024 change.

Similar to how we see a request of the RA Reg from frame 0 after
failing to find an unwind location for the pc register, the same
style of special casing is needed when this is a function that
was interrupted.

Without this change, we can find the pc of the frame that was
executing when it was interrupted, but we need $lr to find its
caller, and we don't descend down to the trap handler to get that
value, truncating the stack.

rdar://145614545
@jasonmolenda jasonmolenda requested a review from JDevlieghere as a code owner May 7, 2025 05:49
@llvmbot llvmbot added the lldb label May 7, 2025
@llvmbot
Copy link
Member

llvmbot commented May 7, 2025

@llvm/pr-subscribers-lldb

Author: Jason Molenda (jasonmolenda)

Changes

When a frameless function faults or is interrupted asynchronously, the UnwindPlan MAY have no register location rule for the return address register (lr on arm64); the value is simply live in the lr register when it was interrupted, and the frame below this on the stack -- e.g. sigtramp on a Unix system -- has the full register context, including that register.

RegisterContextUnwind::SavedLocationForRegister, when asked to find the caller's pc value, will first see if there is a pc register location. If there isn't, on a Return Address Register architecture like arm/mips/riscv, we rewrite the register request from "pc" to "RA register", and search for a location.

On frame 0 (the live frame) and an interrupted frame, the UnwindPlan may have no register location rule for the RA Reg, that is valid. A frameless function that never calls another may simply keep the return address in the live register the whole way. Our instruction emulation unwind plans explicitly add a rule (see Pavel's May 2024 change #91321 ), but an UnwindPlan sourced from debug_frame may not.

I've got a case where this exactly happens - clang debug_frame for arm64 where there is no register location for the lr in a frameless function. There is a fault in the middle of this frameless function and we only get the lr value from the fault handler below this frame if lr has a register location of IsSame, in line with Pavel's 2024 change.

Similar to how we see a request of the RA Reg from frame 0 after failing to find an unwind location for the pc register, the same style of special casing is needed when this is a function that was interrupted.

Without this change, we can find the pc of the frame that was executing when it was interrupted, but we need $lr to find its caller, and we don't descend down to the trap handler to get that value, truncating the stack.

rdar://145614545


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

1 Files Affected:

  • (modified) lldb/source/Target/RegisterContextUnwind.cpp (+15-4)
diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp
index 3ed49e12476dd..23a86bee2518b 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -1377,6 +1377,7 @@ RegisterContextUnwind::SavedLocationForRegister(
         }
       }
 
+      // Check if the active_row has a register location listed.
       if (regnum.IsValid() &&
           active_row->GetRegisterInfo(regnum.GetAsKind(unwindplan_registerkind),
                                       unwindplan_regloc)) {
@@ -1390,11 +1391,10 @@ RegisterContextUnwind::SavedLocationForRegister(
       // This is frame 0 and we're retrieving the PC and it's saved in a Return
       // Address register and it hasn't been saved anywhere yet -- that is,
       // it's still live in the actual register. Handle this specially.
-
       if (!have_unwindplan_regloc && return_address_reg.IsValid() &&
-          IsFrameZero()) {
-        if (return_address_reg.GetAsKind(eRegisterKindLLDB) !=
-            LLDB_INVALID_REGNUM) {
+          return_address_reg.GetAsKind(eRegisterKindLLDB) !=
+              LLDB_INVALID_REGNUM) {
+        if (IsFrameZero()) {
           lldb_private::UnwindLLDB::ConcreteRegisterLocation new_regloc;
           new_regloc.type = UnwindLLDB::ConcreteRegisterLocation::
               eRegisterInLiveRegisterContext;
@@ -1408,6 +1408,17 @@ RegisterContextUnwind::SavedLocationForRegister(
                        return_address_reg.GetAsKind(eRegisterKindLLDB),
                        return_address_reg.GetAsKind(eRegisterKindLLDB));
           return UnwindLLDB::RegisterSearchResult::eRegisterFound;
+        } else if (BehavesLikeZerothFrame()) {
+          // This function was interrupted asynchronously -- it faulted,
+          // an async interrupt, a timer fired, a debugger expression etc.
+          // The caller's pc is in the Return Address register, but the
+          // UnwindPlan for this function may have no location rule for
+          // the RA reg.
+          // This means that the caller's return address is in the RA reg
+          // when the function was interrupted--descend down one stack frame
+          // to retrieve it from the trap handler's saved context.
+          unwindplan_regloc.SetSame();
+          have_unwindplan_regloc = true;
         }
       }
 

@jasonmolenda
Copy link
Collaborator Author

While working on this bug, I started musing about how we could switch the logic for how to handle registers more into UnwindPlans, wrote a little discourse with the idea. https://discourse.llvm.org/t/unhappiness-with-the-lldb-unwinder-register-passing-up-the-stack-interrup-trap-sigtramp-frames/86058

It's not something I'll be doing in the near term, but I know I'd like to get back to this.

@jasonmolenda
Copy link
Collaborator Author

Also while initially working on this issue I found I could fix it in two places in SavedLocationForRegister without considering the entirety of the method. This made me unhappy so I spent a bit of time going over all of SavedLocationForRegister until I felt confident I understood it, and then wrote the scariest NFC patch where I removed chunks of it (that are doing nothing) and restructured it so it was a lot easier to read, I thought. But I want to maybe bring that up separately because it's a lot of change and this method has a lot of edge cases - many tricky to test, and not tested well.

@jasonmolenda jasonmolenda requested review from labath and jimingham May 7, 2025 05:54
@jasonmolenda
Copy link
Collaborator Author

to be clear, when I mention a big chunk of SavedLocationForRegister which I don't think is actually doing anything -- I refuse to look at the history, but it looks suspiciously like something I wrote a decade ago :)

@jasonmolenda
Copy link
Collaborator Author

I am also not thrilled with the GetAsKind method for register numbering returning LLDB_INVALID_REGNUM, the code reads so poorly in this method because of it. But returning an optional would make other code more verbose unless I carried optionals through a lot further. I haven't been annoyed enough to try doing that yet.

@labath
Copy link
Collaborator

labath commented May 7, 2025

This makes sense to me, but is there any way to write a test case for it?

It sounds like something similar to this test could work. In fact, given that this test is disabled on darwin, I'm wondering if this patch does not fix it by any chance?

@jasonmolenda
Copy link
Collaborator Author

FTR that test is skipped on darwin because _sigtramp in libc on aarch64 doesn't have any hand-supplied eh_frame right now :/

I have a test case put together, with a few functions written in assembly with hand-added cfi directives. It's probably darwin specific assembly, obviously aarch64 only, but it exercises exactly the bug I am fixing. will wrap it up into a proper test in a tiny bit (hopefully tonight)

via the UnwindPlan.  And use the trap handler flag for
zeroth frame so we can properly unwind a frameless function
that was interrupted while in the trap handler function.
@jasonmolenda
Copy link
Collaborator Author

jasonmolenda commented May 8, 2025

I'm thinking I'll write an API test that instruction steps through the whole binary and backtraces at each point, making sure it can get every function between the current one & main at all points, just for fun extra stress testing. I was testing it like that by hand as I wrote the test input files.

to trap() and break_to_debugger() for fun, and add
unwind instructions for the epilogue of trap().

When stopped in `break_to_debugger`,
```
  * frame #0: 0x00000001000003e8 a.out`break_to_debugger + 4
    frame swiftlang#1: 0x00000001000003d8 a.out`trap + 16
    frame swiftlang#2: 0x00000001000003c0 a.out`to_be_interrupted + 20
    frame swiftlang#3: 0x0000000100000398 a.out`main + 32
```

Normally we can't provide a volatile register (e.g. x0) up
the stack.  And we can provide a non-volatile register (e.g. x20)
up the stack.  I added an IsSame rule for trap() and break_to_debugger()
for x0, so it CAN be passed up the stack.  And I added an Undefined
rule for x20 to trap() so it CAN'T be provided up the stack.

If a user selects `to_be_interrupted` and does `register read`,
they'll get x0 and they won't get x20.  From `main`, they will not
get x0 or x20 (x0 because `to_be_interrupted` doesn't have an IsSame
rule).
Also fix one bug in the by-hand unwind state in
the assembly file.
ways in these hand-written UnwindPlans.
this compiling on linux?
I think maybe the only difference is that the
symbol names are prefixed with _ on darwin?
@jasonmolenda
Copy link
Collaborator Author

OK finished writing the test case. It starts at main() and instruction steps through the test program, checking that it can backtrace all the way to main() (including all the frames in the middle) at each instruction.

I also added tests for the non-ABI compliant fetching of x0 mid-stack and x20 being unfetchable mid-stack, with the hand-written eh_frame instructions in the assembly file. It has nothing to do with the frameless function that faults that I'm trying to fix here, but it was interesting that it works as I wanted so I'll add a test on it.

I have the test marked as skipUnlessDarwin but I'm not sure there's much to keep it from working on Linux. Maybe that I had to prefix the symbol names with _ on dawin? Might be easiest to update the .c file to call either to_be_interrupted or _to_be_interrupted depending on the OS if that's it.

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to com up with this test case. Pavel already signed off on the implementation so I think this is good to merge.

C_SOURCES := main.c

interrupt-and-trap-funcs.o: interrupt-and-trap-funcs.s
$(CC) $(CFLAGS) -c -o interrupt-and-trap-funcs.o $(SRCDIR)/interrupt-and-trap-funcs.s
Copy link
Member

Choose a reason for hiding this comment

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

Should this pass a triple? I assume this works locally because you're on an arm64 host?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ach, that reminds me I need to skip this test unless arm64.

Darwin.

There's a slight syntax diff for the ADRP + ADD pair and the label
name.  And the function names in Darwin are prepended with an _ and
not on linux.

clang on darwin runs the .s file through the preprocessor, but it
doesn't seem to on linux.  I renamed interrupt-and-trap-funcs.s to
interrupt-and-trap-funcs.c and run it through the preprocessor then
assemble it in Makefile now.

The linux version would probably run on other AArch64 systems like
FreeBSD but I haven't checked those.
because it can run on darwin or linux aarch64.
Copy link

github-actions bot commented May 10, 2025

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

@jasonmolenda
Copy link
Collaborator Author

Minor syntax adaptations to the assembly file to build on an aarch64 unbuntu 24.04, test updated and will run on linux or darwin now.

Add two more checks for non-ABI compliant register availability
from the custom UnwindPlans.
@jasonmolenda
Copy link
Collaborator Author

Ah, lldb-server doesn't secretly migrate the pc past a builtin_debugtrap() BRK instruction on linux like debugserver does, the test will inf loop never advancing past the BRK.

where it does not advance past this BRK instruction automatically.

Also add a limit on instruction stepping, so if this does get stuck
in a loop it won't run forever.

I haven't tested this on a linux system yet but in by-hand running
on the binary, I saw the lldb-server behavior w.r.t builtin_debugtrap
and this should be necessary.
.s file -- the Test python file also hardcodes the names of the
functions and I don't want to prepend _ on linux to those names.
@jasonmolenda jasonmolenda merged commit e897cb1 into llvm:main May 10, 2025
8 of 9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 10, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-shell :: Register/x86-zmm-write.test (2882 of 2895)
UNSUPPORTED: lldb-shell :: ScriptInterpreter/Lua/breakpoint_callback.test (2883 of 2895)
UNSUPPORTED: lldb-shell :: ScriptInterpreter/Python/Crashlog/altered_threadState.test (2884 of 2895)
UNSUPPORTED: lldb-shell :: ScriptInterpreter/Lua/bindings.test (2885 of 2895)
UNSUPPORTED: lldb-shell :: Unwind/windows-unaligned-x86_64.test (2886 of 2895)
UNSUPPORTED: lldb-shell :: Heap/heap-cstr.test (2887 of 2895)
PASS: lldb-unit :: Utility/./UtilityTests/116/129 (2888 of 2895)
UNSUPPORTED: lldb-shell :: ScriptInterpreter/Lua/persistent_state.test (2889 of 2895)
UNSUPPORTED: lldb-shell :: ScriptInterpreter/Lua/io.test (2890 of 2895)
UNRESOLVED: lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py (2891 of 2895)
******************** TEST 'lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py' FAILED ********************
Script:
--
/usr/bin/python3 /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./lib --env LLVM_INCLUDE_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/include --env LLVM_TOOLS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --arch x86_64 --build-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex --lldb-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/lldb --compiler /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/clang --dsymutil /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./bin --lldb-obj-root /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb --lldb-libs-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./lib -t /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -p TestUnwindFramelessFaulted.py
--
Exit Code: 1

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

--
Command Output (stderr):
--
Change dir to: /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted
runCmd: settings clear --all

output: 

runCmd: settings set symbols.enable-external-lookup false

output: 

runCmd: settings set target.inherit-tcc true

output: 

runCmd: settings set target.disable-aslr false

output: 

runCmd: settings set target.detach-on-error false

output: 

runCmd: settings set target.auto-apply-fixits false

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 10, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-api :: functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py (685 of 2165)
UNSUPPORTED: lldb-api :: functionalities/type_lookup/TestTypeLookup.py (686 of 2165)
PASS: lldb-api :: functionalities/type_find_first/TestFindFirstType.py (687 of 2165)
PASS: lldb-api :: functionalities/type_get_module/TestTypeGetModule.py (688 of 2165)
PASS: lldb-api :: functionalities/type_types/TestFindTypes.py (689 of 2165)
UNSUPPORTED: lldb-api :: functionalities/ubsan/basic/TestUbsanBasic.py (690 of 2165)
UNSUPPORTED: lldb-api :: functionalities/ubsan/user-expression/TestUbsanUserExpression.py (691 of 2165)
UNSUPPORTED: lldb-api :: functionalities/unwind/ehframe/TestEhFrameUnwind.py (692 of 2165)
PASS: lldb-api :: functionalities/statusline/TestStatusline.py (693 of 2165)
UNRESOLVED: lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py (694 of 2165)
******************** TEST 'lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -p TestUnwindFramelessFaulted.py
--
Exit Code: 1

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

--
Command Output (stderr):
--
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted)
======================================================================
ERROR: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted)
----------------------------------------------------------------------
Error when building test subject.

Build Command:
/usr/bin/gmake VPATH=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -C /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.test_frameless_faulted_unwind -I /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -f /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/Makefile all ARCH=aarch64 CC=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang CC_TYPE=clang CXX=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang++ LLVM_AR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-ar AR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-ar OBJCOPY=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-objcopy STRIP=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-strip ARCHIVER=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-ar DWP=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-dwp CLANG_MODULE_CACHE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api LLDB_OBJ_ROOT=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb OS=Linux HOST_OS=Linux

Build Command Output:
gmake: Entering directory '/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.test_frameless_faulted_unwind'
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang -g -O0   -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb/include -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -include /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h -fno-limit-debug-info   -MT main.o -MD -MP -MF main.d -c -o main.o /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/main.c
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang -g -O0   -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb/include -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -include /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h -fno-limit-debug-info   -E -o interrupt-and-trap-funcs.s /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/interrupt-and-trap-funcs.c
/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang -g -O0   -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb/include -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -include /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h -fno-limit-debug-info   -c -o interrupt-and-trap-funcs.o interrupt-and-trap-funcs.s
clang: warning: argument unused during compilation: '-O0' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-include /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-fno-limit-debug-info' [-Wunused-command-line-argument]
/usr/include/asm-generic/int-ll64.h:20:20: error: unexpected token in argument list
typedef __signed__ char __s8;
                   ^
/usr/include/asm-generic/int-ll64.h:21:18: error: unexpected token in argument list
typedef unsigned char __u8;

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 10, 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/15782

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-api :: functionalities/type_lookup/TestTypeLookup.py (689 of 3022)
PASS: lldb-api :: functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py (690 of 3022)
PASS: lldb-api :: functionalities/type_find_first/TestFindFirstType.py (691 of 3022)
PASS: lldb-api :: functionalities/type_get_module/TestTypeGetModule.py (692 of 3022)
UNSUPPORTED: lldb-api :: functionalities/ubsan/basic/TestUbsanBasic.py (693 of 3022)
UNSUPPORTED: lldb-api :: functionalities/ubsan/user-expression/TestUbsanUserExpression.py (694 of 3022)
PASS: lldb-api :: functionalities/type_types/TestFindTypes.py (695 of 3022)
UNSUPPORTED: lldb-api :: functionalities/unwind/aarch64_unwind_pac/TestAArch64UnwindPAC.py (696 of 3022)
UNSUPPORTED: lldb-api :: functionalities/unwind/ehframe/TestEhFrameUnwind.py (697 of 3022)
UNRESOLVED: lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py (698 of 3022)
******************** TEST 'lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.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 /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -p TestUnwindFramelessFaulted.py
--
Exit Code: 1

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

--
Command Output (stderr):
--
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted)
======================================================================
ERROR: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted)
----------------------------------------------------------------------
Error when building test subject.

Build Command:
/usr/bin/gmake VPATH=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -C /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.test_frameless_faulted_unwind -I /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -f /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/Makefile all ARCH=armv8l CC=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang CC_TYPE=clang CXX=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang++ LLVM_AR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-ar AR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-ar OBJCOPY=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-objcopy STRIP=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-strip ARCHIVER=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-ar DWP=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-dwp CLANG_MODULE_CACHE_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api LLDB_OBJ_ROOT=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb OS=Linux HOST_OS=Linux

Build Command Output:
gmake: Entering directory '/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.test_frameless_faulted_unwind'
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang -g -O0   -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -include /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h -fno-limit-debug-info   -MT main.o -MD -MP -MF main.d -c -o main.o /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/main.c
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang -g -O0   -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -include /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h -fno-limit-debug-info   -E -o interrupt-and-trap-funcs.s /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/interrupt-and-trap-funcs.c
/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang -g -O0   -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -include /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h -fno-limit-debug-info   -c -o interrupt-and-trap-funcs.o interrupt-and-trap-funcs.s
clang: warning: argument unused during compilation: '-O0' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-include /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-fno-limit-debug-info' [-Wunused-command-line-argument]
/usr/include/asm-generic/int-ll64.h:20:20: error: unexpected token in argument list
typedef __signed__ char __s8;
                   ^
/usr/include/asm-generic/int-ll64.h:21:18: error: unexpected token in argument list
typedef unsigned char __u8;

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 10, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 16 (test-check-lldb-api) failure: Test just built components: check-lldb-api completed (failure)
...
UNSUPPORTED: lldb-api :: functionalities/tty/TestTerminal.py (685 of 1267)
UNSUPPORTED: lldb-api :: functionalities/type_lookup/TestTypeLookup.py (686 of 1267)
PASS: lldb-api :: functionalities/type_find_first/TestFindFirstType.py (687 of 1267)
PASS: lldb-api :: functionalities/type_get_module/TestTypeGetModule.py (688 of 1267)
PASS: lldb-api :: functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py (689 of 1267)
UNSUPPORTED: lldb-api :: functionalities/ubsan/basic/TestUbsanBasic.py (690 of 1267)
PASS: lldb-api :: functionalities/type_types/TestFindTypes.py (691 of 1267)
UNSUPPORTED: lldb-api :: functionalities/ubsan/user-expression/TestUbsanUserExpression.py (692 of 1267)
UNSUPPORTED: lldb-api :: functionalities/unwind/ehframe/TestEhFrameUnwind.py (693 of 1267)
UNRESOLVED: lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py (694 of 1267)
******************** TEST 'lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py' FAILED ********************
Script:
--
/usr/bin/python3.12 /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin --libcxx-include-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/c++/v1 --libcxx-include-target-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/aarch64-unknown-linux-gnu/c++/v1 --libcxx-library-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib/aarch64-unknown-linux-gnu --arch aarch64 --build-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/lldb --compiler /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang --dsymutil /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin --lldb-obj-root /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb --lldb-libs-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib --platform-url connect://jetson-agx-2198.lab.llvm.org:1234 --platform-working-dir /home/ubuntu/lldb-tests --sysroot /mnt/fs/jetson-agx-ubuntu --env ARCH_CFLAGS=-mcpu=cortex-a78 --platform-name remote-linux --skip-category=lldb-server /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -p TestUnwindFramelessFaulted.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision e897cb139ee6ef5c145fed5394c4d96baa658e6b)
  clang revision e897cb139ee6ef5c145fed5394c4d96baa658e6b
  llvm revision e897cb139ee6ef5c145fed5394c4d96baa658e6b
Setting up remote platform 'remote-linux'
Connecting to remote platform 'remote-linux' at 'connect://jetson-agx-2198.lab.llvm.org:1234'...
Connected.
Setting remote platform working directory to '/home/ubuntu/lldb-tests'...
Skipping the following test categories: ['lldb-server', 'dsym', 'gmodules', 'debugserver', 'objc', 'lldb-dap']

--
Command Output (stderr):
--
WARNING:root:Custom libc++ is not supported for remote runs: ignoring --libcxx arguments
FAIL: LLDB (/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64) :: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted.test_frameless_faulted_unwind)
======================================================================
ERROR: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted.test_frameless_faulted_unwind)
----------------------------------------------------------------------
Error when building test subject.

Build Command:
/usr/bin/gmake VPATH=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -C /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.test_frameless_faulted_unwind -I /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -f /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/Makefile all ARCH=aarch64 CC=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang CC_TYPE=clang CXX=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang++ LLVM_AR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/llvm-ar AR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/llvm-ar OBJCOPY=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/llvm-objcopy STRIP=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/llvm-strip ARCHIVER=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/llvm-ar DWP=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/llvm-dwp SDKROOT=/mnt/fs/jetson-agx-ubuntu CLANG_MODULE_CACHE_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api LIBCPP_INCLUDE_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/c++/v1 LIBCPP_LIBRARY_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib/aarch64-unknown-linux-gnu LIBCPP_INCLUDE_TARGET_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/aarch64-unknown-linux-gnu/c++/v1 LLDB_OBJ_ROOT=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb OS=Linux HOST_OS=Linux

Build Command Output:
gmake: Entering directory '/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.test_frameless_faulted_unwind'
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang -g -O0 --sysroot "/mnt/fs/jetson-agx-ubuntu"  -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/include -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -include /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h -fno-limit-debug-info   -MT main.o -MD -MP -MF main.d -c -o main.o /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/main.c
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang -g -O0 --sysroot "/mnt/fs/jetson-agx-ubuntu"  -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/include -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -include /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h -fno-limit-debug-info   -E -o interrupt-and-trap-funcs.s /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/interrupt-and-trap-funcs.c
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang -g -O0 --sysroot "/mnt/fs/jetson-agx-ubuntu"  -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/../../../../..//include -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/include -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -include /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h -fno-limit-debug-info   -c -o interrupt-and-trap-funcs.o interrupt-and-trap-funcs.s
clang: warning: argument unused during compilation: '-O0' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-include /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make/test_common.h' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-fno-limit-debug-info' [-Wunused-command-line-argument]

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 10, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 17 (test-check-lldb-api) failure: Test just built components: check-lldb-api completed (failure)
...
UNSUPPORTED: lldb-api :: functionalities/tty/TestTerminal.py (685 of 1267)
UNSUPPORTED: lldb-api :: functionalities/type_lookup/TestTypeLookup.py (686 of 1267)
PASS: lldb-api :: functionalities/type_find_first/TestFindFirstType.py (687 of 1267)
PASS: lldb-api :: functionalities/type_get_module/TestTypeGetModule.py (688 of 1267)
PASS: lldb-api :: functionalities/type_types/TestFindTypes.py (689 of 1267)
UNSUPPORTED: lldb-api :: functionalities/ubsan/basic/TestUbsanBasic.py (690 of 1267)
UNSUPPORTED: lldb-api :: functionalities/ubsan/user-expression/TestUbsanUserExpression.py (691 of 1267)
PASS: lldb-api :: functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py (692 of 1267)
UNSUPPORTED: lldb-api :: functionalities/unwind/ehframe/TestEhFrameUnwind.py (693 of 1267)
UNRESOLVED: lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py (694 of 1267)
******************** TEST 'lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.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 --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\functionalities\unwind\frameless-faulted -p TestUnwindFramelessFaulted.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision e897cb139ee6ef5c145fed5394c4d96baa658e6b)
  clang revision e897cb139ee6ef5c145fed5394c4d96baa658e6b
  llvm revision e897cb139ee6ef5c145fed5394c4d96baa658e6b
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', 'dsym', 'gmodules', 'debugserver', 'objc', 'lldb-dap']


--
Command Output (stderr):
--
FAIL: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted.test_frameless_faulted_unwind)

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

ERROR: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted.test_frameless_faulted_unwind)

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

Error when building test subject.



Build Command:

@jasonmolenda
Copy link
Collaborator Author

I had two commits to address bots. The first was my skipIf to run the test only darwin/linux only for arm64/aarch64 acted like an or so it could run on either of those. Second, the aarch64-ubuntu bot failed when I had it my assembly file named ".c" and did clang -E -o interrupt-and-trap-funcs.s interrupt-and-trap-funcs.c to run it through the preprocessor - clang on that system when run by the API tests injected a bunch of C headers and it failed to compile as assembly then.

For now, I changed the test to only run on Darwin.

jasonmolenda added a commit that referenced this pull request May 10, 2025
This test is failing on the LLDB Incremental bot (arm64), which is
running an older set of tools (Xcode 15.2) and OS (macOS 14.1) and
the CFI directives must not be emitted correctly by either the tools
or the OS.  I will need to reproduce how this is compiling on that
older setup and see what the issue is.  Reverting for now so the
bots are not blocked.

This reverts commit e897cb1.
@jasonmolenda
Copy link
Collaborator Author

I reverted it entirely when the lldb incremental arm64 bot failed the test. On that older Xcode/OS (Xcode 15.2, macOS 14.1) there was something wrong with the CFI directives and the backtrace out of trap() failed. On a modern macOS system this works fine. I'll set up an older system and repo.

jasonmolenda added a commit that referenced this pull request May 12, 2025
Re-landing this patch with small tweaks to address CI bot failures
as it was run on many different configurations.  I think the test
may run on aarch64 Linux systems now.

When a frameless function faults or is interrupted asynchronously, the
UnwindPlan MAY have no register location rule for the return address
register (lr on arm64); the value is simply live in the lr register when
it was interrupted, and the frame below this on the stack -- e.g.
sigtramp on a Unix system -- has the full register context, including
that register.

RegisterContextUnwind::SavedLocationForRegister, when asked to find the
caller's pc value, will first see if there is a pc register location. If
there isn't, on a Return Address Register architecture like
arm/mips/riscv, we rewrite the register request from "pc" to "RA
register", and search for a location.

On frame 0 (the live frame) and an interrupted frame, the UnwindPlan may
have no register location rule for the RA Reg, that is valid. A
frameless function that never calls another may simply keep the return
address in the live register the whole way. Our instruction emulation
unwind plans explicitly add a rule (see Pavel's May 2024 change
#91321 ), but an UnwindPlan
sourced from debug_frame may not.

I've got a case where this exactly happens - clang debug_frame for arm64
where there is no register location for the lr in a frameless function.
There is a fault in the middle of this frameless function and we only
get the lr value from the fault handler below this frame if lr has a
register location of `IsSame`, in line with Pavel's 2024 change.

Similar to how we see a request of the RA Reg from frame 0 after failing
to find an unwind location for the pc register, the same style of
special casing is needed when this is a function that was interrupted.

Without this change, we can find the pc of the frame that was executing
when it was interrupted, but we need $lr to find its caller, and we
don't descend down to the trap handler to get that value, truncating the
stack.

rdar://145614545
jasonmolenda added a commit to jasonmolenda/llvm-project that referenced this pull request May 12, 2025
Re-landing this patch with small tweaks to address CI bot failures
as it was run on many different configurations.  I think the test
may run on aarch64 Linux systems now.

When a frameless function faults or is interrupted asynchronously, the
UnwindPlan MAY have no register location rule for the return address
register (lr on arm64); the value is simply live in the lr register when
it was interrupted, and the frame below this on the stack -- e.g.
sigtramp on a Unix system -- has the full register context, including
that register.

RegisterContextUnwind::SavedLocationForRegister, when asked to find the
caller's pc value, will first see if there is a pc register location. If
there isn't, on a Return Address Register architecture like
arm/mips/riscv, we rewrite the register request from "pc" to "RA
register", and search for a location.

On frame 0 (the live frame) and an interrupted frame, the UnwindPlan may
have no register location rule for the RA Reg, that is valid. A
frameless function that never calls another may simply keep the return
address in the live register the whole way. Our instruction emulation
unwind plans explicitly add a rule (see Pavel's May 2024 change
llvm#91321 ), but an UnwindPlan
sourced from debug_frame may not.

I've got a case where this exactly happens - clang debug_frame for arm64
where there is no register location for the lr in a frameless function.
There is a fault in the middle of this frameless function and we only
get the lr value from the fault handler below this frame if lr has a
register location of `IsSame`, in line with Pavel's 2024 change.

Similar to how we see a request of the RA Reg from frame 0 after failing
to find an unwind location for the pc register, the same style of
special casing is needed when this is a function that was interrupted.

Without this change, we can find the pc of the frame that was executing
when it was interrupted, but we need $lr to find its caller, and we
don't descend down to the trap handler to get that value, truncating the
stack.

rdar://145614545
(cherry picked from commit b957cc0)
labath added a commit to labath/llvm-project that referenced this pull request May 12, 2025
test_common is force-included into every compilation, which causes
problems when we're compiling assembly code, as we were in llvm#138805.

This avoids that as we can include the header only when it's needed.
@labath
Copy link
Collaborator

labath commented May 12, 2025

I looked at why the test fails on linux. It turns out it's due to a bunch of reasons, but most of them are unrelated to the problem at hand. #139545 and #139550 fix the surrounding issues, and c290e55 is enough to fix the test itself.

I needed to change the compile command because, for some reason the compiler was not finding the temporary file. I didn't look at what causes the difference because I think this is more robust and idiomatic.

I also needed to remove the brk #0xf000 instruction because lldb is not able to step over it -- it just ends up spinning forever. FWICS, it's not actually necessary now that you're stepping through the test. Nonetheless, this is a bug -- one that @DavidSpickett might be interested in :)

Interestingly, the mac debug server does not step onto the breakpoint instruction at all. It skips over it when stepping over the previous instruction (i.e. that single step operation actually steps two instructions). This is most likely also some kind of a bug.

FTR that test is skipped on darwin because _sigtramp in libc on aarch64 doesn't have any hand-supplied eh_frame right now :/

Oh... FWIW, we're in the same situation on aarch64 linux, but here we hard code the plan into lldb in PlatformLinux::GetTrapHandlerUnwindPlan (which we can, because it's part of the OS ABI). Maybe you could do the same?

labath added a commit that referenced this pull request May 13, 2025
…139550)

test_common is force-included into every compilation, which causes
problems when we're compiling assembly code, as we were in #138805.

This avoids that as we can include the header only when it's needed.
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.

5 participants