Bug 253881 - /usr/bin/lldb: Unable to backtrace a core dump
Summary: /usr/bin/lldb: Unable to backtrace a core dump
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-toolchain (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-26 21:56 UTC by Dmitri Goutnik
Modified: 2021-03-15 00:34 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitri Goutnik freebsd_committer 2021-02-26 21:56:03 UTC
$ uname -v
FreeBSD 14.0-CURRENT #2 main-888ae5725: Fri Feb 26 14:32:59 -05 2021

$ /usr/bin/lldb -v
lldb version 11.0.1 (git@github.com:llvm/llvm-project.git revision llvmorg-11.0.1-0-g43ff75f2c3fe)
  clang revision llvmorg-11.0.1-0-g43ff75f2c3fe
  llvm revision llvmorg-11.0.1-0-g43ff75f2c3fe

$ cc -v
FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)
Target: x86_64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin

$ cat <<EOD > testcase.c
#include <signal.h>

int
main(void)
{
    raise(SIGABRT);
}
EOD

$ cc -g testcase.c

$ ./a.out
Abort trap (core dumped)

$ /usr/bin/lldb a.out -c a.out.core
(lldb) target create "a.out" --core "a.out.core"
Core file '/home/dg/tmp/abort/a.out.core' (x86_64) was loaded.

(lldb) bt
Program aborted due to an unhandled Error:
Error value was Success. (Note: Success values must still be checked prior to being destroyed).
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /usr/bin/lldb a.out -c a.out.core
1.      HandleCommand(command = "bt")
#0 0x0000000003b35a0e PrintStackTrace /usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:13
#1 0x0000000003b33ea7 RunSignalHandlers /usr/src/contrib/llvm-project/llvm/lib/Support/Signals.cpp:69:18
#2 0x0000000003b35f80 SignalHandler /usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:0:3
#3 0x0000000804cdde52 handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
Abort trap (core dumped)
Comment 1 Dimitry Andric freebsd_committer 2021-03-05 20:33:25 UTC
Interesting, this works just fine for me on 14.0-CURRENT #0 main-n245108-1bf86687c2eb (as of 2021-02-26):

% lldb a.out -c a.out.core
(lldb) target create "a.out" --core "a.out.core"
Core file '/share/dim/bugs/bug253881/a.out.core' (x86_64) was loaded.

(lldb) bt
This version of LLDB has no plugin for the mipsassem language. Inspection of frame variables will be limited.
* thread #1, name = 'a.out', stop reason = signal SIGABRT
  * frame #0: 0x000000080038437a libc.so.7`__sys_thr_kill at thr_kill.S:4
    frame #1: 0x00000008002f90f4 libc.so.7`__raise(s=6) at raise.c:52:10
    frame #2: 0x0000000000201892 a.out`main at testcase.c:6:5
    frame #3: 0x0000000000201690 a.out`_start(ap=<unavailable>, cleanup=<unavailable>) at crt1_c.c:75:7

Is it possible for you to debug the lldb.core file with, say, gdb? :)