Resolving a MySQL Stack Trace

Newly modified mysqld source code (the code for mysqld itself—not application code) will crash from time to time. The result might be something like the following in mysqld.log:

Jul 10 09:06:45 boxxxx mysqld: thd: 0x680b6c0
Jul 10 09:06:45 boxxxx mysqld: Attempting backtrace. You can use the following information to find out
Jul 10 09:06:45 boxxxx mysqld: where mysqld died. If you see no messages after this, something went
Jul 10 09:06:45 boxxxx mysqld: terribly wrong...
Jul 10 09:06:45 boxxxx mysqld: stack_bottom = 0x451b4db0 thread_stack 0x40000
Jul 10 09:06:45 boxxxx mysqld: [0x7319ee]
Jul 10 09:06:45 boxxxx mysqld: [0x4abfa0]
Jul 10 09:06:45 boxxxx mysqld: [0x607990]
Jul 10 09:06:45 boxxxx mysqld: [0x4b35e0]
Jul 10 09:06:45 boxxxx mysqld: [0x4a904c]
Jul 10 09:06:45 boxxxx mysqld: [0x4b1911]
Jul 10 09:06:45 boxxxx mysqld: [0x603a8d]
Jul 10 09:06:45 boxxxx mysqld: [0x7ab539]
Jul 10 09:06:45 boxxxx mysqld: Trying to get some variables.

I use MySQL's resolve_stack_dump utility (in the distribution's extra directory) to translate that into:

0x7319ee my_print_stacktrace + 46
0x4abfa0 handle_segfault + 800
0x607990 __restore_rt + 0
0x4b35e0 my_new_fn(int, char const*) + 96
0x4a904c close_connection(THD*, unsigned int, bool) + 188
0x4b1911 handle_one_connection + 1857
0x603a8d start_thread + 221
0x7ab539 clone + 121

Instructions are at http://dev.mysql.com/doc/refman/5.1/en/using-stack-trace.html