/* Multi-process/thread control for GDB, the GNU debugger.
- Copyright (C) 1986-2018 Free Software Foundation, Inc.
+ Copyright (C) 1986-2019 Free Software Foundation, Inc.
Contributed by Lynx Real-Time Systems, Inc. Los Gatos, CA.
#include "symtab.h"
#include "frame.h"
#include "inferior.h"
-#include "environ.h"
+#include "common/environ.h"
#include "value.h"
#include "target.h"
#include "gdbthread.h"
{
if (thr->thread_fsm != NULL)
{
- thread_fsm_clean_up (thr->thread_fsm, thr);
- thread_fsm_delete (thr->thread_fsm);
+ thr->thread_fsm->clean_up (thr);
+ delete thr->thread_fsm;
thr->thread_fsm = NULL;
}
}
result->priv.reset (priv);
if (print_thread_events)
- printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid));
+ printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid).c_str ());
annotate_new_thread ();
return result;
step_over_chain_remove (&step_over_queue_head, tp);
}
-/* Delete thread TP. If SILENT, don't notify the observer of this
- exit. */
+/* Delete the thread referenced by THR. If SILENT, don't notifyi
+ the observer of this exit.
+
+ THR must not be NULL or a failed assertion will be raised. */
static void
delete_thread_1 (thread_info *thr, bool silent)
{
- struct thread_info *tp, *tpprev;
+ gdb_assert (thr != nullptr);
- tpprev = NULL;
+ struct thread_info *tp, *tpprev = NULL;
for (tp = thr->inf->thread_list; tp; tpprev = tp, tp = tp->next)
if (tp == thr)
static std::string
thread_target_id_str (thread_info *tp)
{
- const char *target_id = target_pid_to_str (tp->ptid);
+ std::string target_id = target_pid_to_str (tp->ptid);
const char *extra_info = target_extra_thread_info (tp);
const char *name = tp->name != nullptr ? tp->name : target_thread_name (tp);
if (extra_info != nullptr && name != nullptr)
- return string_printf ("%s \"%s\" (%s)", target_id, name, extra_info);
+ return string_printf ("%s \"%s\" (%s)", target_id.c_str (), name,
+ extra_info);
else if (extra_info != nullptr)
- return string_printf ("%s (%s)", target_id, extra_info);
+ return string_printf ("%s (%s)", target_id.c_str (), extra_info);
else if (name != nullptr)
- return string_printf ("%s \"%s\"", target_id, name);
+ return string_printf ("%s \"%s\"", target_id.c_str (), name);
else
return target_id;
}
if (!flags.quiet)
printf_filtered (_("\nThread %s (%s):\n"),
print_thread_id (thr),
- target_pid_to_str (inferior_ptid));
+ target_pid_to_str (inferior_ptid).c_str ());
printf_filtered ("%s", cmd_result.c_str ());
}
}
if (!flags.quiet)
printf_filtered (_("\nThread %s (%s):\n"),
print_thread_id (thr),
- target_pid_to_str (inferior_ptid));
+ target_pid_to_str (inferior_ptid).c_str ());
if (flags.cont)
printf_filtered ("%s\n", ex.message);
else
if (tp->state == THREAD_EXITED)
printf_filtered (_("[Current thread is %s (%s) (exited)]\n"),
print_thread_id (tp),
- target_pid_to_str (inferior_ptid));
+ target_pid_to_str (inferior_ptid).c_str ());
else
printf_filtered (_("[Current thread is %s (%s)]\n"),
print_thread_id (tp),
- target_pid_to_str (inferior_ptid));
+ target_pid_to_str (inferior_ptid).c_str ());
}
else
error (_("No stack."));
match++;
}
- tmp = target_pid_to_str (tp->ptid);
- if (tmp != NULL && re_exec (tmp))
+ std::string name = target_pid_to_str (tp->ptid);
+ if (!name.empty () && re_exec (name.c_str ()))
{
printf_filtered (_("Thread %s has target id '%s'\n"),
- print_thread_id (tp), tmp);
+ print_thread_id (tp), name.c_str ());
match++;
}
uiout->text ("[Switching to thread ");
uiout->field_string ("new-thread-id", print_thread_id (tp));
uiout->text (" (");
- uiout->text (target_pid_to_str (inferior_ptid));
+ uiout->text (target_pid_to_str (inferior_ptid).c_str ());
uiout->text (")]");
}
}