https://github.com/vogelsgesang created 
https://github.com/llvm/llvm-project/pull/109594

On Ubuntu 22.04, the top-most stack frame is the function 
`__pthread_kill_implementation`. Add it to the list of detected functions.

```
(lldb) bt
* thread #1, name = 'a.out', stop reason = signal SIGABRT
  * frame #0: 0x00007ffff7bc29fc libc.so.6`__GI___pthread_kill [inlined] 
__pthread_kill_implementation(no_tid=0, signo=6, threadid=140737349064512) at 
pthread_kill.c:44:76
    frame #1: 0x00007ffff7bc29b0 libc.so.6`__GI___pthread_kill [inlined] 
__pthread_kill_internal(signo=6, threadid=140737349064512) at 
pthread_kill.c:78:10
    frame #2: 0x00007ffff7bc29b0 
libc.so.6`__GI___pthread_kill(threadid=140737349064512, signo=6) at 
pthread_kill.c:89:10
    frame #3: 0x00007ffff7b6e476 libc.so.6`__GI_raise(sig=6) at raise.c:26:13
    frame #4: 0x00007ffff7b547f3 libc.so.6`__GI_abort at abort.c:79:7
    frame #5: 0x00007ffff7b5471b libc.so.6`__assert_fail_base(fmt="%s%s%s:%u: 
%s%sAssertion `%s' failed.\n%n", assertion="false", file="test-func-ptr.cpp", 
line=27, function="int main()") at assert.c:92:3
    frame #6: 0x00007ffff7b65e96 
libc.so.6`__GI___assert_fail(assertion="false", file="test-func-ptr.cpp", 
line=27, function="int main()") at assert.c:101:3
    frame #7: 0x0000555555556359 a.out`main at test-func-ptr.cpp:27:5
```

I did not add a testcase because it would require a specific glibc.

>From a9ce74cd70770c304fc1493ce642ebc383f47179 Mon Sep 17 00:00:00 2001
From: Adrian Vogelsgesang <avogelsges...@salesforce.com>
Date: Sun, 22 Sep 2024 21:12:17 +0000
Subject: [PATCH] Fix assert frame recognizer for Ubuntu 22.04

On Ubuntu 22.04, the top-most stack frame is the function
`__pthread_kill_implementation`. Add it to the list of detected
functions.

```
(lldb) bt
* thread #1, name = 'a.out', stop reason = signal SIGABRT
  * frame #0: 0x00007ffff7bc29fc libc.so.6`__GI___pthread_kill [inlined] 
__pthread_kill_implementation(no_tid=0, signo=6, threadid=140737349064512) at 
pthread_kill.c:44:76
    frame #1: 0x00007ffff7bc29b0 libc.so.6`__GI___pthread_kill [inlined] 
__pthread_kill_internal(signo=6, threadid=140737349064512) at 
pthread_kill.c:78:10
    frame #2: 0x00007ffff7bc29b0 
libc.so.6`__GI___pthread_kill(threadid=140737349064512, signo=6) at 
pthread_kill.c:89:10
    frame #3: 0x00007ffff7b6e476 libc.so.6`__GI_raise(sig=6) at raise.c:26:13
    frame #4: 0x00007ffff7b547f3 libc.so.6`__GI_abort at abort.c:79:7
    frame #5: 0x00007ffff7b5471b libc.so.6`__assert_fail_base(fmt="%s%s%s:%u: 
%s%sAssertion `%s' failed.\n%n", assertion="false", file="test-func-ptr.cpp", 
line=27, function="int main()") at assert.c:92:3
    frame #6: 0x00007ffff7b65e96 
libc.so.6`__GI___assert_fail(assertion="false", file="test-func-ptr.cpp", 
line=27, function="int main()") at assert.c:101:3
    frame #7: 0x0000555555556359 a.out`main at test-func-ptr.cpp:27:5
```

I did not add a testcase because it would require a specific glibc.
---
 lldb/source/Target/AssertFrameRecognizer.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lldb/source/Target/AssertFrameRecognizer.cpp 
b/lldb/source/Target/AssertFrameRecognizer.cpp
index 00b1f54023f168..0c90e8db32c9b5 100644
--- a/lldb/source/Target/AssertFrameRecognizer.cpp
+++ b/lldb/source/Target/AssertFrameRecognizer.cpp
@@ -36,6 +36,7 @@ bool GetAbortLocation(llvm::Triple::OSType os, SymbolLocation 
&location) {
     location.symbols.push_back(ConstString("__GI_raise"));
     location.symbols.push_back(ConstString("gsignal"));
     location.symbols.push_back(ConstString("pthread_kill"));
+    location.symbols.push_back(ConstString("__pthread_kill_implementation"));
     location.symbols_are_regex = true;
     break;
   default:

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to