[ob] Fix segfault for libthread_db failures
Daniel Jacobowitz
drow@false.org
Mon Feb 5 20:07:00 GMT 2007
I think this bug appeared when I rearranged the interaction between
linux-thread-db.c and linux-nat.c. It's now possible to reach
check_for_thread_db (formerly thread_db_new_objfile) even if the
libthread_db load failed. So it's important to make sure that succeeded
before we try to call into it.
This shows up as a segfault after "run" if you have no libthread_db,
or if you link GDB statically (in which case it can not load libthread_db).
Checked in after testing it fixed on x86_64-linux.
--
Daniel Jacobowitz
CodeSourcery
2007-02-05 Daniel Jacobowitz <dan@codesourcery.com>
* linux-thread-db.c (check_for_thread_db): Return early if we have
no libthread_db support.
Index: src/gdb/thread-db.c
===================================================================
--- src.orig/gdb/thread-db.c 2007-02-05 05:58:18.000000000 -0800
+++ src/gdb/thread-db.c 2007-02-05 11:44:10.000000000 -0800
@@ -627,6 +627,10 @@ check_for_thread_db (void)
td_err_e err;
static int already_loaded;
+ /* Do nothing if we couldn't load libthread_db.so.1. */
+ if (td_ta_new_p == NULL)
+ return;
+
/* First time through, report that libthread_db was successfuly
loaded. Can't print this in in thread_db_load as, at that stage,
the interpreter and it's console haven't started. */
More information about the Gdb-patches
mailing list