[Mono-dev] Debugging Mono applications under GDB

Zoltan Varga vargaz at gmail.com
Sat Nov 14 09:21:37 UTC 2015


Hi,

  The gdb support for mono might work only if the program is started from
gdb, not when it is attached to. If you aot your assemblies (see the mono
man page), the aot compiler generates debug info which gdb can read, so you
should get better stack traces. About the "../../gdb/dwarf2-frame.c:683:
internal-error: Unknown CFI encountered." error, that should already be
fixed in mono master.

                  Zoltan

On Mon, Nov 9, 2015 at 12:37 PM, Chris Swiedler <cswiedler at trionworlds.com>
wrote:

> We have a server application that’s being developed under Visual Studio
> and run under Mono 3.12. We’re generating .mdb files from the .pdbs that VS
> creates. With those deployed next to the executable, mono will give full
> callstacks with source and line information when logging exceptions, so I
> believe the .mdbs are correct.
>
>
>
> I’ve read http://www.mono-project.com/docs/debug+profile/debug/ so many
> times I can quote it by heart, but I still can’t get gdb to give me any
> useful symbols. I’m using gdb 7.6.1, so according to the docs, it should
> just use the JIT interface to get symbols.
>
>
>
> Is there any way to troubleshoot the loading of symbols by gdb? There are
> examples for how to generate xdb shared object files (I’ve tried them, but
> as doesn’t like some of the assembly that MONO_XDEBUG generates) but
> nothing on the new JIT interface other than "it should work".
>
>
>
> I do get errors like "../../gdb/dwarf2-frame.c:683: internal-error:
> Unknown CFI encountered." I’m not sure if those are relevant to my problem.
> A sample gdb session is below.
>
>
>
> Thanks,
>
> chris
>
>
>
> GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-64.el7 Copyright (C) 2013
> 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-redhat-linux-gnu".
>
> For bug reporting instructions, please see:
>
> <http://www.gnu.org/software/gdb/bugs/>.
>
> Attaching to process 21185
>
> Reading symbols from /usr/bin/mono-sgen...(no debugging symbols
> found)...done.
>
> Reading symbols from /lib64/libm.so.6...Reading symbols from
> /usr/lib/debug/usr/lib64/libm-2.17.so.debug...done.
>
> done.
>
> Loaded symbols for /lib64/libm.so.6
>
> Reading symbols from /lib64/librt.so.1...Reading symbols from
> /usr/lib/debug/usr/lib64/librt-2.17.so.debug...done.
>
> done.
>
> Loaded symbols for /lib64/librt.so.1
>
> Reading symbols from /lib64/libdl.so.2...Reading symbols from
> /usr/lib/debug/usr/lib64/libdl-2.17.so.debug...done.
>
> done.
>
> Loaded symbols for /lib64/libdl.so.2
>
> Reading symbols from /lib64/libpthread.so.0...Reading symbols from
> /usr/lib/debug/usr/lib64/libpthread-2.17.so.debug...done.
>
> done.
>
> [New LWP 21269]
>
> ...
>
> [New LWP 21187]
>
> [Thread debugging using libthread_db enabled] Using host libthread_db
> library "/lib64/libthread_db.so.1".
>
> Loaded symbols for /lib64/libpthread.so.0 Reading symbols from
> /lib64/libgcc_s.so.1...Reading symbols from
> /usr/lib/debug/usr/lib64/libgcc_s-4.8.3-20140911.so.1.debug...done.
>
> done.
>
> Loaded symbols for /lib64/libgcc_s.so.1
>
> Reading symbols from /lib64/libc.so.6...Reading symbols from
> /usr/lib/debug/usr/lib64/libc-2.17.so.debug...done.
>
> done.
>
> Loaded symbols for /lib64/libc.so.6
>
> Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from
> /usr/lib/debug/usr/lib64/ld-2.17.so.debug...done.
>
> done.
>
> Loaded symbols for /lib64/ld-linux-x86-64.so.2 Reading symbols from
> /lib64/libnss_files.so.2...Reading symbols from
> /usr/lib/debug/usr/lib64/libnss_files-2.17.so.debug...done.
>
> done.
>
> Loaded symbols for /lib64/libnss_files.so.2 Reading symbols from
> /usr/lib/mono/4.5/mscorlib.dll.so...done.
>
> Loaded symbols for /usr/lib/mono/4.5/mscorlib.dll.so Reading symbols from
> /usr/lib64/libMonoPosixHelper.so...done.
>
> Loaded symbols for /usr/lib64/libMonoPosixHelper.so Reading symbols from
> /lib64/libz.so.1...Reading symbols from
> /usr/lib/debug/usr/lib64/libz.so.1.2.7.debug...done.
>
> done.
>
> Loaded symbols for /lib64/libz.so.1
>
> Reading symbols from /lib64/libnss_dns.so.2...Reading symbols from
> /usr/lib/debug/usr/lib64/libnss_dns-2.17.so.debug...done.
>
> done.
>
> Loaded symbols for /lib64/libnss_dns.so.2 Reading symbols from
> /lib64/libresolv.so.2...Reading symbols from
> /usr/lib/debug/usr/lib64/libresolv-2.17.so.debug...done.
>
> done.
>
> Loaded symbols for /lib64/libresolv.so.2 clock_nanosleep (clock_id=1,
> flags=1, req=0x7fff271a8e80, rem=0xffffffffffffffff) at
> ../sysdeps/unix/sysv/linux/clock_nanosleep.c:49
>
> 49            LIBC_CANCEL_RESET (oldstate); Mono support loaded.
>
> (gdb) mono_backtrace 10
>
> #0  clock_nanosleep (clock_id=1, flags=1, req=0x7fff271a8e80,
> rem=0xffffffffffffffff) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:49
>
> 49            LIBC_CANCEL_RESET (oldstate);
>
> #1  0x0000000000618c78 in SleepEx ()
>
> #2  0x000000000058cc7a in ves_icall_System_Threading_Thread_Sleep_internal
> ()
>
> #3 0x413215c2 in  (wrapper managed-to-native)
> System.Threading.Thread:Sleep_internal (int) + 0x52 (0x41321570 0x413215ee)
> [0x20ee4f0 - LobbyServer.exe]
>
> #4  0x0000000002146a10 in ?? ()
>
> #5  0x00007fff271a9410 in ?? ()
>
> #6  0x00007f252cc01338 in ?? ()
>
> #7  0x00007fff271a9410 in ?? ()
>
> #8  0x00007f252cc00b18 in ?? ()
>
> #9  0x0000000002139ac0 in ?? ()
>
> (gdb) info threads
>
>   Id   Target Id         Frame
>
>   32   Thread 0x7f252b0ed700 (LWP 21187) "Finalizer" sem_wait () at
> ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
>
>   31   Thread 0x7f252aeec700 (LWP 21188) "mono-sgen" 0x00007f25337f6b7d in
> poll () at ../sysdeps/unix/syscall-template.S:81
>
>   30   Thread 0x7f2529e6f700 (LWP 21200) "Timer-Scheduler"
> pthread_cond_timedwait@@GLIBC_2.3.2 ()
>
>     at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
>
>   29   Thread 0x7f2529c6e700 (LWP 21202) "mono-sgen" 0x00007f2533801783 in
> epoll_wait () at ../sysdeps/unix/syscall-template.S:81
>
>   28   Thread 0x7f2529c29700 (LWP 21203) "IO Threadpool w" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   27   Thread 0x7f2529be4700 (LWP 21204) "mono-sgen" pthread_cond_wait@@GLIBC_2.3.2
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
>
>   26   Thread 0x7f25299df700 (LWP 21205) "mono-sgen" pthread_cond_wait@@GLIBC_2.3.2
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
>
>   25   Thread 0x7f2529370700 (LWP 21207) "IO Threadpool w" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   24   Thread 0x7f252932f700 (LWP 21208) "Threadpool moni" clock_nanosleep
> (clock_id=1, flags=1, req=0x7f252932ed40, rem=0xffffffffffffffff)
>
>     at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:49
>
>   23   Thread 0x7f25292ee700 (LWP 21209) "Threadpool work"
>
> ../../gdb/dwarf2-frame.c:683: internal-error: Unknown CFI encountered.
>
> A problem internal to GDB has been detected, further debugging may prove
> unreliable.
>
> Quit this debugging session? (y or n) n
>
> ../../gdb/dwarf2-frame.c:683: internal-error: Unknown CFI encountered.
>
> A problem internal to GDB has been detected, further debugging may prove
> unreliable.
>
> Create a core file of GDB? (y or n) n
>
>   22   Thread 0x7f25290a4700 (LWP 21211) "Threadpool work" sem_timedwait ()
>
>     at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   21   Thread 0x7f2528e9b700 (LWP 21213) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   20   Thread 0x7f2528c9a700 (LWP 21214) "IO Threadpool w" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   19   Thread 0x7f2528c51700 (LWP 21216) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   18   Thread 0x7f2528a50700 (LWP 21217) "IO Threadpool w" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   17   Thread 0x7f2528a07700 (LWP 21219) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   16   Thread 0x7f2528806700 (LWP 21221) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   15   Thread 0x7f2528601700 (LWP 21223) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   14   Thread 0x7f25283fc700 (LWP 21235) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   13   Thread 0x7f24ebfff700 (LWP 21237) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   12   Thread 0x7f24ebc73700 (LWP 21240) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   11   Thread 0x7f24eba72700 (LWP 21242) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   10   Thread 0x7f24eb871700 (LWP 21244) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   9    Thread 0x7f24eb670700 (LWP 21246) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   8    Thread 0x7f24eb46f700 (LWP 21248) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   7    Thread 0x7f24eb1eb700 (LWP 21250) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   6    Thread 0x7f24eafea700 (LWP 21252) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   5    Thread 0x7f24eade9700 (LWP 21253) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   4    Thread 0x7f24eabe8700 (LWP 21254) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   3    Thread 0x7f24ea9e7700 (LWP 21266) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
>   2    Thread 0x7f24ea7e6700 (LWP 21269) "Threadpool work" sem_timedwait
> () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S:101
>
> * 1    Thread 0x7f253481e780 (LWP 21185) "mono-sgen" clock_nanosleep
> (clock_id=1, flags=1, req=0x7fff271a8e80, rem=0xffffffffffffffff)
>
>     at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:49
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20151114/f6da6a65/attachment-0001.html>


More information about the Mono-devel-list mailing list