-
-
Notifications
You must be signed in to change notification settings - Fork 25
Debugging Symbols
If you ever need to install packages with debugging symbols, you need to modify your /etc/apt/sources.lists.d/<ppa>-<dist>.list
to contain main/debug
component in addition to main
:
Example for ppa:ondrej/php
for Ubuntu 14.04 Trusty Tahr:
# cat /etc/apt/sources.list.d/ondrej-php-trusty.list
deb http://ppa.launchpad.net/ondrej/php/ubuntu trusty main
deb http://ppa.launchpad.net/ondrej/php/ubuntu trusty main/debug
# deb-src http://ppa.launchpad.net/ondrej/php/ubuntu trusty main
After apt-get update
you can apt-get install <phpX.Y-foo>-dbgsym
, f.e.: apt-get install php-mongodb-dbgsym php7.0-fpm-dbgsym php7.0-common-dbgsym
.
Please note that while dbgsym packages are supported in Ubuntu, there are some packages that use older way of putting all debug symbols into '-dbg' package. Always use apt-cache search <package> dbg
to lookup whether there is a manual debug symbol package or not.
That would allow you together with libc6-dbg
and cyrus-sasl2-dbg
packages to create much nicer bt full
backtrace:
# apt-get install php-mongodb-dbgsym php7.0-fpm-dbgsym php7.0-common-dbgsym libc6-dbg cyrus-sasl2-dbg
# [...]
# gdb /usr/sbin/php-fpm7.0
(gdb) run -t
Starting program: /usr/sbin/php-fpm7.0 -t
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[15-Mar-2016 15:07:01] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful
Program received signal SIGSEGV, Segmentation fault.
zend_mm_free_heap (ptr=<optimized out>, heap=<optimized out>) at /build/php7.0-CpkoVe/php7.0-7.0.4/Zend/zend_alloc.c:1400
1400 /build/php7.0-CpkoVe/php7.0-7.0.4/Zend/zend_alloc.c: No such file or directory.
(gdb) bt full
#0 zend_mm_free_heap (ptr=<optimized out>, heap=<optimized out>) at /build/php7.0-CpkoVe/php7.0-7.0.4/Zend/zend_alloc.c:1400
chunk = 0x555555a00000
info = 1438578080
page_offset = 495
#1 _efree (ptr=0x555555bef3f0) at /build/php7.0-CpkoVe/php7.0-7.0.4/Zend/zend_alloc.c:2458
No locals.
#2 0x00007ffff32ccc85 in sasl_common_done () at ../../lib/common.c:686
No locals.
#3 0x00007ffff32c9d41 in sasl_client_done () at ../../lib/client.c:101
result = 0
#4 0x00007ffff3519bbe in _mongoc_do_cleanup () at /build/php-mongodb-xrFNrX/php-mongodb-1.1.4/mongodb-1.1.4/src/libmongoc/src/mongoc/mongoc-init.c:130
No locals.
#5 0x00007ffff5e1aa90 in pthread_once () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S:103
No locals.
#6 0x00007ffff7dea73a in _dl_fini () at dl-fini.c:252
array = 0x7ffff3757df0
i = 1
nmaps = 56
nloaded = <optimized out>
i = 18
l = 0x555555bce920
ns = 0
maps = 0x7fffffffde50
maps_size = 448
do_audit = 0
__PRETTY_FUNCTION__ = "_dl_fini"
#7 0x00007ffff5a84259 in __run_exit_handlers (status=status@entry=0, listp=0x7ffff5e066c8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true) at exit.c:82
atfct = <optimized out>
onfct = <optimized out>
cxafct = <optimized out>
f = <optimized out>
#8 0x00007ffff5a842a5 in __GI_exit (status=status@entry=0) at exit.c:104
No locals.
#9 0x0000555555824922 in fpm_init (argc=<optimized out>, argv=<optimized out>, config=<optimized out>, prefix=<optimized out>, pid=<optimized out>, test_conf=1, run_as_root=0, force_daemon=-1, force_stderr=0)
at /build/php7.0-CpkoVe/php7.0-7.0.4/sapi/fpm/fpm/fpm.c:72
__func__ = "fpm_init"
#10 0x0000555555632546 in main (argc=2, argv=0x7fffffffe578) at /build/php7.0-CpkoVe/php7.0-7.0.4/sapi/fpm/fpm/fpm_main.c:1863
exit_status = 0
c = -1
use_extended_info = 0
file_handle = {handle = {fd = 1, fp = 0x1, stream = {handle = 0x1, isatty = -134252512, mmap = {len = 140737354101960, pos = 140737351928209, map = 0x0, buf = 0x7ffff7fecab8 "\271[\275\367\377\177", old_handle = 0x1,
old_closer = 0x0}, reader = 0x1, fsizer = 0x7ffff7ff74c8, closer = 0x0}}, filename = 0x555555b81020 "", opened_path = 0x555555b81028, type = 1438126104, free_filename = 85 'U'}
orig_optind = 1
orig_optarg = 0x0
ini_entries_len = 0
max_requests = 500
requests = 0
fcgi_fd = 0
fpm_config = 0x0
fpm_prefix = 0x0
fpm_pid = 0x0
test_conf = 1
force_daemon = -1
force_stderr = 0
php_information = 0
php_allow_to_run_as_root = 0
__func__ = "main"
This is example of php-mongodb
segfault after the libsasl2 library call.