This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Remove stale handling of exited threads
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 9 Nov 2008 10:54:34 +0300
- Subject: Remove stale handling of exited threads
I've noticed that print_thread_info has this logic:
for(...)
{
...
if (tp->state_ == THREAD_EXITED)
continue;
if (tp->state_ == THREAD_EXITED)
....
}
The subsequent checks for THREAD_EXITED were added long time ago, and then
are stale at this point. I've checked the below patch as obvious.
- Volodya
* thread.c (print_thread_info): Eliminate now useless checks
for exited threads.
---
gdb/thread.c | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/gdb/thread.c b/gdb/thread.c
index 892aca0..316319a 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -681,17 +681,14 @@ print_thread_info (struct ui_out *uiout, int requested_thread, int pid)
ui_out_text (uiout, " ");
ui_out_field_string (uiout, "target-id", target_tid_to_str (tp->ptid));
- if (tp->state_ != THREAD_EXITED)
+ extra_info = target_extra_thread_info (tp);
+ if (extra_info)
{
- extra_info = target_extra_thread_info (tp);
- if (extra_info)
- {
- ui_out_text (uiout, " (");
- ui_out_field_string (uiout, "details", extra_info);
- ui_out_text (uiout, ")");
- }
- ui_out_text (uiout, " ");
+ ui_out_text (uiout, " (");
+ ui_out_field_string (uiout, "details", extra_info);
+ ui_out_text (uiout, ")");
}
+ ui_out_text (uiout, " ");
if (tp->state_ == THREAD_RUNNING)
ui_out_text (uiout, "(running)\n");
@@ -709,9 +706,7 @@ print_thread_info (struct ui_out *uiout, int requested_thread, int pid)
if (ui_out_is_mi_like_p (uiout))
{
char *state = "stopped";
- if (tp->state_ == THREAD_EXITED)
- state = "exited";
- else if (tp->state_ == THREAD_RUNNING)
+ if (tp->state_ == THREAD_RUNNING)
state = "running";
ui_out_field_string (uiout, "state", state);
}
--
1.5.3.5