This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[ob] unbreak "info thread"
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 17 Mar 2008 21:43:43 +0300
- Subject: [ob] unbreak "info thread"
As Luis Machado noticed, but recent -thread-info patch
causes "info thread" to get internal error if there are
no threads in the thread table -- which unfortunately
happens a lot.
Fixed with the attached obvious patch.
Sorry,
Volodya
Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.9232
diff -u -p -r1.9232 ChangeLog
--- gdb/ChangeLog 17 Mar 2008 17:30:28 -0000 1.9232
+++ gdb/ChangeLog 17 Mar 2008 18:39:20 -0000
@@ -1,3 +1,9 @@
+2008-03-17 Vladimir Prus <vladimir@codesourcery.com>
+
+ * thread.c (print_thread_info): Don't insist
+ on having current thread if there are no
+ threads at all.
+
2008-03-17 Pedro Alves <pedro@codesourcery.com>
* infcmd.c (attach_command_post_wait)
Index: gdb/thread.c
===================================================================
RCS file: /cvs/src/src/gdb/thread.c,v
retrieving revision 1.62
diff -u -p -r1.62 thread.c
--- gdb/thread.c 15 Mar 2008 13:53:25 -0000 1.62
+++ gdb/thread.c 17 Mar 2008 18:39:20 -0000
@@ -478,8 +478,8 @@ print_thread_info (struct ui_out *uiout,
if (requested_thread == -1)
{
- gdb_assert (current_thread != -1);
- if (ui_out_is_mi_like_p (uiout))
+ gdb_assert (current_thread != -1 || !thread_list);
+ if (current_thread != -1 && ui_out_is_mi_like_p (uiout))
ui_out_field_int (uiout, "current-thread-id", current_thread);
}