Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gdb doesn't read the core dump on macOS

Tags:

gdb

core

lldb

I've installed gdb formulae from Homebrew on OSX 10.10.5 to send a backtrace to developers of weechat (because weechat installed with Homebrew crashes every time I do /exit).

And got this problem when trying to read the core file:

gdb /usr/local/bin/weechat /cores/core.70087
GNU gdb (GDB) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin14.5.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/weechat...(no debugging symbols found)...done.
"/cores/core.70087": no core file handler recognizes format
(gdb)

I've tried to do this with with lldb instead of gdb:

$ lldb /usr/local/bin/weechat /cores/core.70087
(lldb) target create "/usr/local/bin/weechat"
Current executable set to '/usr/local/bin/weechat' (x86_64).
(lldb) settings set -- target.run-args  "/cores/core.70087"
(lldb) bt full
error: bt [<digit>|all]
(lldb) bt all
error: invalid process
(lldb) bt
error: invalid process
(lldb) thread backtrace
error: invalid process
(lldb)

Have no idea what am I doing, just trying to do whatever I can to address these crashes.

like image 292
Drew Avatar asked Sep 23 '15 05:09

Drew


People also ask

What is the use of GDB core dump file?

GDB can be used to read the core dump file and view some useful information about the program when it crashed. Dumping core is also very useful in situations where faults occur intermittently. It allows you to inspect what might have happened even in situations where the fault is difficult to trigger.

How do I use GDB on a Mac?

Fortunately the rest of this guide walks you through all of the steps you'll need in order to use gdb effectively on your Mac. In order to give gdb the permissions it needs, you'll need to generate a self-signed certificate. Launch Keychain Access application: Applications > Utilities > Keychain Access.

What can GDB do for You?

This can include use after free, buffer overflow, and dereferencing the NULL pointer. GDB can be used to read the core dump file and view some useful information about the program when it crashed.

What does GDB output when it crashes on a line?

Immediately, GDB will output the line it crashed on. We now know from this output that invalid memory was accessed on line 51, so we look at the memory that is accessed on that line. There is one memory access on this line curr->data, so we are either not allowed to dereference curr or we are not allowed to read data.


1 Answers

You should be able to launch lldb as

$ lldb --core "/cores/core.70087"
like image 194
Enrico Granata Avatar answered Sep 30 '22 21:09

Enrico Granata