Fix PR gdb/19676: Internal error in linux-thread.db.c if /proc not mounted
authorPedro Alves <palves@redhat.com>
Tue, 15 Mar 2016 16:33:04 +0000 (16:33 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 15 Mar 2016 16:33:04 +0000 (16:33 +0000)
commit1eb2dbb8d73c344e199fd04531ec3f649e2835b2
treeb48b1745291e203ee679454306f7a82740ad061f
parent16b4184277c4ad5b4a20278060fd3f6259d1ed49
Fix PR gdb/19676: Internal error in linux-thread.db.c if /proc not mounted

If /proc is not mounted, GDB fails an assertion in find_new_threads_once:

 Continuing.
 .../src/gdb/linux-thread-db.c:1249: internal-error: find_new_threads_once: Assertion `!target_has_execution' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Quit this debugging session? (y or n)

That was supposed to catch misuses of td_ta_thr_iter, which is unsafe
for live debugging.  However, if /proc is not mounted, we still
fallback to using it.

I didn't bother with a warning, because GDB already prints several
others related to failing to open /proc files.

gdb/ChangeLog:
2016-03-15  Pedro Alves  <palves@redhat.com>

PR gdb/19676
* linux-thread-db.c (try_thread_db_load_1): Leave
info->td_ta_thr_iter_p NULL iff debugging a live process and we
have /proc access.
(find_new_threads_once): Assert that we have a non-NULL
info->td_ta_thr_iter_p instead of checking whether the target has
execution.
gdb/ChangeLog
gdb/linux-thread-db.c