labath wrote:

> Ah, I misunderstood what the nature of the failure was. I tried running the 
> shell test, and it's failing for different reasons. I almost never touch 
> shell tests, I find them really hard to debug so I'm not sure what the 
> problem is. If I run it by hand,
> 
> ```
> (lldb) settings set platform.plugin.darwin.ignored-exceptions 
> EXC_BAD_INSTRUCTION
> (lldb) b sigill_handler
> Breakpoint 1: where = a.out`sigill_handler + 20 at 
> signal-in-leaf-function-aarch64.c:10:34, address = 0x0000000100003f4c
> (lldb) r
> Process 25854 launched: '/tmp/a.out' (arm64)
> Process 25854 stopped
> * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGILL
>     frame #0: 0x0000000100003f2c a.out`signal_generating_add at 
> signal-in-leaf-function-aarch64.c:5:3
>    2          #include <unistd.h>
>    3          
>    4          int __attribute__((naked)) signal_generating_add(int a, int b) {
> -> 5            asm("add w0, w1, w0\n\t"
>    6                "udf #0xdead\n\t"
>    7                "ret");
>    8          }
> (lldb) c
> Process 25854 resuming
> Process 25854 stopped
> * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
>     frame #0: 0x0000000100003f4c a.out`sigill_handler(signo=4) at 
> signal-in-leaf-function-aarch64.c:10:34
>    7                "ret");
>    8          }
>    9          
> -> 10         void sigill_handler(int signo) { _exit(0); }
>    11         
>    12         int main() {
>    13           signal(SIGILL, sigill_handler);
> (lldb) bt
> * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
>   * frame #0: 0x0000000100003f4c a.out`sigill_handler(signo=4) at 
> signal-in-leaf-function-aarch64.c:10:34
>     frame #1: 0x0000000197f93584 libsystem_platform.dylib`_sigtramp + 56
>     frame #2: 0x0000000100003f7c a.out`main at 
> signal-in-leaf-function-aarch64.c:14:3
>     frame #3: 0x0000000197bda0e0 dyld`start + 2360
> (lldb) 
> ```
> 
> which all looks good to me, but it the shell test fails with
It's not completely correct -- the frame for `signal_generating_add` is 
missing. That's what the error message is complaining about.

The test stops the process before and after injecting a signal and verifies 
that the relevant parts of backtrace (i.e., calls to `signal_generating_add` 
and `main`) are present (and have the same PC) in both places.

> 
> ```
> /Volumes/work/llvm/llvm-project/lldb/test/Shell/Unwind/signal-in-leaf-function-aarch64.test:26:10:
>  error: CHECK: expected string not found in input
> # CHECK: frame #{{[0-9]+}}: [[ADD]] {{.*}}`signal_generating_add

^ This is the most important part of the message.

Btw, at the top of the failure message lit will print the commands executed as 
a part of this test. For most tests (this one included), you can just yank the 
lldb command out of there and run it in a terminal to debug.

https://github.com/llvm/llvm-project/pull/91321
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to