to it, delete the original thread, reset the new thread's
ptid, and switch to it. */
- if (ptid_equal (inferior_ptid, ptid))
+ if (inferior_ptid == ptid)
{
tp = new_thread (inf, null_ptid);
tpprev = NULL;
for (tp = thread_list; tp; tpprev = tp, tp = tp->next)
- if (ptid_equal (tp->ptid, ptid))
+ if (tp->ptid == ptid)
break;
if (!tp)
struct thread_info *tp;
for (tp = thread_list; tp; tp = tp->next)
- if (ptid_equal (tp->ptid, ptid))
+ if (tp->ptid == ptid)
return tp;
return NULL;
* Calls a callback function once for each thread, so long as
* the callback function returns false. If the callback function
* returns true, the iteration will end and the current thread
- * will be returned. This can be useful for implementing a
+ * will be returned. This can be useful for implementing a
* search for a thread with arbitrary attributes, or for applying
* some operation to every thread.
*
- * FIXME: some of the existing functionality, such as
+ * FIXME: some of the existing functionality, such as
* "Thread apply all", might be rewritten using this functionality.
*/
for (tp = thread_list; tp; tp = tp->next)
++result;
- return result;
+ return result;
}
int
struct thread_info *tp;
for (tp = thread_list; tp; tp = tp->next)
- if (ptid_equal (tp->ptid, ptid))
+ if (tp->ptid == ptid)
return tp->global_num;
return 0;
struct thread_info *tp;
for (tp = thread_list; tp; tp = tp->next)
- if (ptid_equal (tp->ptid, ptid))
+ if (tp->ptid == ptid)
return 1;
return 0; /* Never heard of 'im. */
if (tp->state == THREAD_EXITED)
continue;
- if (ptid_equal (tp->ptid, inferior_ptid))
+ if (tp->ptid == inferior_ptid)
current_thread = tp->global_num;
num++;
set_resumed (ptid_t ptid, int resumed)
{
struct thread_info *tp;
- int all = ptid_equal (ptid, minus_one_ptid);
+ int all = ptid == minus_one_ptid;
if (all || ptid_is_pid (ptid))
{
set_running (ptid_t ptid, int running)
{
struct thread_info *tp;
- int all = ptid_equal (ptid, minus_one_ptid);
+ int all = ptid == minus_one_ptid;
int any_started = 0;
- /* We try not to notify the observer if no thread has actually changed
- the running state -- merely to reduce the number of messages to
+ /* We try not to notify the observer if no thread has actually changed
+ the running state -- merely to reduce the number of messages to
frontend. Frontend is supposed to handle multiple *running just fine. */
if (all || ptid_is_pid (ptid))
{
set_executing (ptid_t ptid, int executing)
{
struct thread_info *tp;
- int all = ptid_equal (ptid, minus_one_ptid);
+ int all = ptid == minus_one_ptid;
if (all || ptid_is_pid (ptid))
{
threads_executing = 1;
/* Only clear the flag if the caller is telling us everything is
stopped. */
- else if (ptid_equal (minus_one_ptid, ptid))
+ else if (minus_one_ptid == ptid)
threads_executing = 0;
}
set_stop_requested (ptid_t ptid, int stop)
{
struct thread_info *tp;
- int all = ptid_equal (ptid, minus_one_ptid);
+ int all = ptid == minus_one_ptid;
if (all || ptid_is_pid (ptid))
{
int all;
int any_started = 0;
- all = ptid_equal (ptid, minus_one_ptid);
+ all = ptid == minus_one_ptid;
if (all || ptid_is_pid (ptid))
{
for (tp = thread_list; tp; tp = tp->next)
{
- if (tp->state == THREAD_EXITED)
- continue;
+ if (tp->state == THREAD_EXITED)
+ continue;
if (all || ptid_get_pid (ptid) == ptid_get_pid (tp->ptid))
{
if (set_running_thread (tp, tp->executing))
validate_registers_access (void)
{
/* No selected thread, no registers. */
- if (ptid_equal (inferior_ptid, null_ptid))
+ if (inferior_ptid == null_ptid)
error (_("No thread selected."));
/* Don't try to read from a dead thread. */
can_access_registers_ptid (ptid_t ptid)
{
/* No thread, no registers. */
- if (ptid_equal (ptid, null_ptid))
+ if (ptid == null_ptid)
return false;
/* Don't try to read from a dead thread. */
if (uiout->is_mi_like_p ())
{
/* Compatibility. */
- if (ptid_equal (tp->ptid, current_ptid))
+ if (tp->ptid == current_ptid)
uiout->text ("* ");
else
uiout->text (" ");
}
else
{
- if (ptid_equal (tp->ptid, current_ptid))
+ if (tp->ptid == current_ptid)
uiout->field_string ("current", "*");
else
uiout->field_skip ("current");
if (pid == -1 && requested_threads == NULL)
{
if (uiout->is_mi_like_p ()
- && !ptid_equal (inferior_ptid, null_ptid))
+ && inferior_ptid != null_ptid)
{
int num = ptid_to_global_thread_id (inferior_ptid);
uiout->field_int ("current-thread-id", num);
}
- if (!ptid_equal (inferior_ptid, null_ptid) && is_exited (inferior_ptid))
+ if (inferior_ptid != null_ptid && is_exited (inferior_ptid))
uiout->message ("\n\
The current thread <Thread ID %s> has terminated. See `help thread'.\n",
print_thread_id (inferior_thread ()));
- else if (thread_list != NULL
- && ptid_equal (inferior_ptid, null_ptid))
+ else if (thread_list != NULL && inferior_ptid == null_ptid)
uiout->message ("\n\
No selected thread. See `help thread'.\n");
}
/* Implementation of the "info threads" command.
Note: this has the drawback that it _really_ switches
- threads, which frees the frame cache. A no-side
- effects info-threads command would be nicer. */
+ threads, which frees the frame cache. A no-side
+ effects info-threads command would be nicer. */
static void
info_threads_command (char *arg, int from_tty)
/* Switch the program space as well, if we can infer it from the now
current thread. Otherwise, it's up to the caller to select the
space it wants. */
- if (!ptid_equal (ptid, null_ptid))
+ if (ptid != null_ptid)
{
struct inferior *inf;
set_current_inferior (inf);
}
- if (ptid_equal (ptid, inferior_ptid))
+ if (ptid == inferior_ptid)
return;
inferior_ptid = ptid;
/* We don't check for is_stopped, because we're called at times
while in the TARGET_RUNNING state, e.g., while handling an
internal event. */
- if (!ptid_equal (inferior_ptid, null_ptid)
+ if (inferior_ptid != null_ptid
&& !is_exited (ptid)
&& !is_executing (ptid))
stop_pc = regcache_read_pc (get_thread_regcache (ptid));
/* The running state of the originally selected thread may have
changed, so we have to recheck it here. */
- if (!ptid_equal (inferior_ptid, null_ptid)
+ if (inferior_ptid != null_ptid
&& old->was_stopped
&& is_stopped (inferior_ptid)
&& target_has_registers
old->inf_id = current_inferior ()->num;
old->was_removable = current_inferior ()->removable;
- if (!ptid_equal (inferior_ptid, null_ptid))
+ if (inferior_ptid != null_ptid)
{
struct frame_info *frame;
int i = 0, k;
/* Save a copy of the thread_list in case we execute detach
- command. */
+ command. */
tp_array = XNEWVEC (struct thread_info *, tc);
make_cleanup (xfree, tp_array);
ALL_NON_EXITED_THREADS (tp)
- {
- tp_array[i] = tp;
- tp->incref ();
- i++;
- }
+ {
+ tp_array[i] = tp;
+ tp->incref ();
+ i++;
+ }
/* Because we skipped exited threads, we may end up with fewer
threads in the array than the total count of threads. */
gdb_assert (i <= tc);
make_cleanup (set_thread_refcount, &ta_cleanup);
for (k = 0; k != i; k++)
- if (thread_alive (tp_array[k]))
- {
- switch_to_thread (tp_array[k]->ptid);
- printf_filtered (_("\nThread %s (%s):\n"),
+ if (thread_alive (tp_array[k]))
+ {
+ switch_to_thread (tp_array[k]->ptid);
+ printf_filtered (_("\nThread %s (%s):\n"),
print_thread_id (tp_array[k]),
target_pid_to_str (inferior_ptid));
- execute_command (cmd, from_tty);
+ execute_command (cmd, from_tty);
- /* Restore exact command used previously. */
- strcpy (cmd, saved_cmd);
+ /* Restore exact command used previously. */
+ strcpy (cmd, saved_cmd);
}
}
{
if (tidstr == NULL)
{
- if (ptid_equal (inferior_ptid, null_ptid))
+ if (inferior_ptid == null_ptid)
error (_("No thread selected"));
if (target_has_stack)
if (result == GDB_RC_FAIL)
return;
- /* Print if the thread has not changed, otherwise an event will be sent. */
- if (ptid_equal (inferior_ptid, previous_ptid))
+ /* Print if the thread has not changed, otherwise an event will
+ be sent. */
+ if (inferior_ptid == previous_ptid)
{
print_selected_thread_frame (current_uiout,
USER_SELECTED_THREAD
{
struct thread_info *info;
- if (ptid_equal (inferior_ptid, null_ptid))
+ if (inferior_ptid == null_ptid)
error (_("No thread selected"));
arg = skip_spaces (arg);
int print_thread_events = 1;
static void
show_print_thread_events (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+ struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file,
_("Printing of thread events is %s.\n"),
- value);
+ value);
}
static int
threads exist. */
static struct value *
-thread_id_per_inf_num_make_value (struct gdbarch *gdbarch, struct internalvar *var,
+thread_id_per_inf_num_make_value (struct gdbarch *gdbarch,
+ struct internalvar *var,
void *ignore)
{
return thread_num_make_value_helper (gdbarch, 0);
{
static struct cmd_list_element *thread_apply_list = NULL;
- add_info ("threads", info_threads_command,
+ add_info ("threads", info_threads_command,
_("Display currently known threads.\n\
Usage: info threads [-gid] [ID]...\n\
-gid: Show global thread IDs.\n\
add_com_alias ("t", "thread", class_run, 1);
add_setshow_boolean_cmd ("thread-events", no_class,
- &print_thread_events, _("\
+ &print_thread_events, _("\
Set printing of thread events (such as thread start and exit)."), _("\
Show printing of thread events (such as thread start and exit)."), NULL,
- NULL,
- show_print_thread_events,
- &setprintlist, &showprintlist);
+ NULL,
+ show_print_thread_events,
+ &setprintlist, &showprintlist);
create_internalvar_type_lazy ("_thread", &thread_funcs, NULL);
create_internalvar_type_lazy ("_gthread", >hread_funcs, NULL);