[Dovecot] Backtraces without core dumps

Timo Sirainen tss at iki.fi
Sun Nov 19 13:51:09 UTC 2006


Since getting core dumps seems to be difficult sometimes, especially  
with login processes, I've now added code to log the backtrace when  
Dovecot crashes in some assert check (or some other reason why it  
decides to abort()). This code works with Linux and Solaris, but I  
don't know about BSDs. Apparently there exists libexecinfo library  
which could be used.

I think this code could be used to log backtraces also for segfaults,  
but that's more risky so I didn't do it yet. Maybe it should be done  
only optionally.

If you're interested in trying, the code is now in CVS and in the  
latest nightly snapshot.

When it crashes, it prints something like:

Panic: file client.c: line 55 (client_create): assertion failed:  
(my_client != NULL)
Error: Backtrace: ./imap [0x80b2ffa] -> ./imap [0x80b2ecc] -> ./imap  
[0x805bbb3] -> ./imap(main+0x426) [0x80634a6] -> /lib/tls/libc.so.6 
(__libc_start_main+0xc8) [0xb7e53ea8] -> ./imap [0x80566a1]

Looks like the symbol name resolving doesn't work all that great. But  
here gdb will help you:

gdb ./imap
(gdb) b *0x80b2ffa
Breakpoint 1 at 0x80b2ffa: file failures.c, line 126.
(gdb) b *0x80b2ecc
Breakpoint 2 at 0x80b2ecc: file failures.c, line 185.
(gdb) b *0x805bbb3
Breakpoint 3 at 0x805bbb3
(gdb) b *0x80634a6
Breakpoint 4 at 0x80634a6: file main.c, line 223.

That went pretty well, except for some reason it couldn't figure out  
where 0x805bbb3 was. To get some kind of an idea about that, you can do:

(gdb) x 0x805bbb3
0x805bbb3 <client_create+467>:  0x90909090

If someone knows better ways to do all of this, please tell me too :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20061119/d5f86d9b/attachment.pgp 


More information about the dovecot mailing list