[PATCH v4 17/44] gdb: allow inferiors without threads in all_matching_threads_iterator
Markus Metzger <[email protected]>
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
When iterating over all threads, the iterator already skips inferiors
without threads. When iterating over a specific inferior, however, the
iterator crashes when encountering an inferior without threads.
Fix it.
---
gdb/thread-iter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/thread-iter.c b/gdb/thread-iter.c
index d7ccb176d61..2a424088b6e 100644
--- a/gdb/thread-iter.c
+++ b/gdb/thread-iter.c
@@ -113,7 +113,7 @@ all_matching_threads_iterator::all_matching_threads_iterator
m_mode = mode::ALL_THREADS_OF_INFERIOR;
m_inf = find_inferior_pid (filter_target, filter_ptid.pid ());
- if (m_inf != nullptr)
+ if (m_inf != nullptr && !m_inf->thread_list.empty ())
m_thr = &m_inf->thread_list.front ();
}
else
--
2.43.0
________________________________________
Intel Deutschland GmbH
Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany
Tel: +49 (89) 99143-0
www.intel.de
Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman
Chairperson of the Supervisory Board: Sonja Pierer
Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.