Bug 222248 - lldb cannot save core file from debug target process
Summary: lldb cannot save core file from debug target process
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-12 06:07 UTC by gergely.czuczy
Modified: 2017-09-15 02:45 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gergely.czuczy 2017-09-12 06:07:56 UTC
Hello,

Apparently it seems that the ObjectFile plugins got left out during importing llvm, and because of this, it's not possible to save the core of the process currently being debugged:
On aarch64, r322723:
root@build-pine64:/usr/ports/editors/emacs-devel/work/emacs-f44184f# cd lisp
l' -batch --no-site-file --no-site-lisp --eval '(setq load-prefer-newer t)'  -f batch-byte-compile emacs-lisp/macroexp.el
(lldb) target create "../src/bootstrap-emacs"
Current executable set to '../src/bootstrap-emacs' (aarch64).
(lldb) settings set -- target.run-args  "-batch" "--no-site-file" "--no-site-lisp" "--eval" "(setq load-prefer-newer t)" "-f" "batch-byte-compile" "emacs-lisp/macroexp.el"
(lldb) r
Process 1016 launching
Process 1016 launched: '../src/bootstrap-emacs' (aarch64)
Process 1016 stopped
* thread #1, name = 'bootstrap-emacs', stop reason = signal SIGSEGV: invalid address (fault address: 0x41b17978)
    frame #0: 0x0000000000228460 bootstrap-emacs`xnrealloc(pa=0x0000000000000000, nitems=0, item_size=1102150015) at alloc.c:939
   936  {
   937    eassert (0 <= nitems && 0 < item_size);
   938    ptrdiff_t nbytes;
-> 939    if (INT_MULTIPLY_WRAPV (nitems, item_size, &nbytes) || SIZE_MAX < nbytes)
   940      memory_full (SIZE_MAX);
   941    return xrealloc (pa, nbytes);
   942  }
(lldb) process save-core /root/foo.core
error: Failed to save core file for process: no ObjectFile plugins were able to save a core for this process
(lldb)


On amd64 11-STABLE r311927:
$ lldb
(lldb) process attach --pid 54625
Process 54625 stopped

Executable module set to "/usr/bin/systat".
Architecture set to: x86_64--freebsd11.0.
(lldb) process save-core foobar.core
error: Failed to save core file for process: no ObjectFile plugins were able to save a core for this process


Sharing cores of currently being debugged processes can be very helpful, when repoting issues with various software. For an example, currently I'm trying to figure out while emacs-devel segfaults during build on aarch64, and the autogenerated core is different, due to the process' internal sigsegv handler.
Comment 1 Ed Maste freebsd_committer 2017-09-13 01:38:55 UTC
Only ObjectFilePECOFF and ObjectFileMachO currently implement a SaveCore method; this needs to be addressed in upstream LLDB before we can import it. Would you kindly file a bug to track this at https://bugs.llvm.org/ ?
Comment 2 gergely.czuczy 2017-09-13 08:12:05 UTC
The LLVM bug report: https://bugs.llvm.org/show_bug.cgi?id=34590