diff options
49 files changed, 233 insertions, 194 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e52d898..2b27c17 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,53 @@ 2018-07-03 Tom Tromey <tom@tromey.com> + * common/ptid.c (ptid_equal): Remove. + * common/ptid.h (ptid_equal): Don't declare. + * ada-tasks.c: Update. + * breakpoint.c: Update. + * common/agent.c: Update. + * corelow.c: Update. + * darwin-nat-info.c: Update. + * darwin-nat.c: Update. + * dcache.c: Update. + * dtrace-probe.c: Update. + * dummy-frame.c: Update. + * fbsd-nat.c: Update. + * frame.c: Update. + * gdbthread.h: Update. + * gnu-nat.c: Update. + * go32-nat.c: Update. + * inf-loop.c: Update. + * inf-ptrace.c: Update. + * infcall.c: Update. + * infcmd.c: Update. + * inflow.c: Update. + * infrun.c: Update. + * linux-fork.c: Update. + * linux-nat.c: Update. + * linux-thread-db.c: Update. + * mi/mi-cmd-var.c: Update. + * mi/mi-interp.c: Update. + * mi/mi-main.c: Update. + * nto-procfs.c: Update. + * ppc-linux-tdep.c: Update. + * procfs.c: Update. + * python/py-inferior.c: Update. + * python/py-record-btrace.c: Update. + * python/py-record.c: Update. + * ravenscar-thread.c: Update. + * regcache.c: Update. + * remote-sim.c: Update. + * remote.c: Update. + * sol-thread.c: Update. + * solib.c: Update. + * target.c: Update. + * tui/tui-stack.c: Update. + * varobj.c: Update. + * windows-nat.c: Update. + * windows-tdep.c: Update. + +2018-07-03 Tom Tromey <tom@tromey.com> + * common/ptid.c (ptid_match): Remove. * common/ptid.h (ptid_match): Don't declare. * fbsd-nat.c: Update. diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 04f286e..bd864c2 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -302,8 +302,7 @@ ada_get_task_number (thread_info *thread) data = get_ada_tasks_inferior_data (inf); for (i = 0; i < VEC_length (ada_task_info_s, data->task_list); i++) - if (ptid_equal (VEC_index (ada_task_info_s, data->task_list, i)->ptid, - thread->ptid)) + if (VEC_index (ada_task_info_s, data->task_list, i)->ptid == thread->ptid) return i + 1; return 0; /* No matching task found. */ @@ -370,7 +369,7 @@ ada_get_task_info_from_ptid (ptid_t ptid) for (i = 0; i < nb_tasks; i++) { task = VEC_index (ada_task_info_s, data->task_list, i); - if (ptid_equal (task->ptid, ptid)) + if (task->ptid == ptid) return task; } @@ -1111,7 +1110,7 @@ print_ada_task_info (struct ui_out *uiout, /* Print a star if this task is the current task (or the task currently selected). */ - if (ptid_equal (task_info->ptid, inferior_ptid)) + if (task_info->ptid == inferior_ptid) uiout->field_string ("current", "*"); else uiout->field_skip ("current"); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 41050b7..df1afac 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1546,8 +1546,8 @@ static int watchpoint_in_thread_scope (struct watchpoint *b) { return (b->pspace == current_program_space - && (ptid_equal (b->watchpoint_thread, null_ptid) - || (ptid_equal (inferior_ptid, b->watchpoint_thread) + && (b->watchpoint_thread == null_ptid + || (inferior_ptid == b->watchpoint_thread && !inferior_thread ()->executing))); } @@ -2904,7 +2904,7 @@ update_inserted_breakpoint_locations (void) if we aren't attached to any process yet, we should still insert breakpoints. */ if (!gdbarch_has_global_breakpoints (target_gdbarch ()) - && ptid_equal (inferior_ptid, null_ptid)) + && inferior_ptid == null_ptid) continue; val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks, @@ -2960,7 +2960,7 @@ insert_breakpoint_locations (void) if we aren't attached to any process yet, we should still insert breakpoints. */ if (!gdbarch_has_global_breakpoints (target_gdbarch ()) - && ptid_equal (inferior_ptid, null_ptid)) + && inferior_ptid == null_ptid) continue; val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks, @@ -4346,7 +4346,7 @@ bpstat_clear_actions (void) static void breakpoint_about_to_proceed (void) { - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) { struct thread_info *tp = inferior_thread (); @@ -7785,7 +7785,7 @@ print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc) uiout->field_skip ("addr"); annotate_field (5); uiout->text ("fork"); - if (!ptid_equal (c->forked_inferior_pid, null_ptid)) + if (c->forked_inferior_pid != null_ptid) { uiout->text (", process "); uiout->field_int ("what", c->forked_inferior_pid.pid ()); @@ -7900,7 +7900,7 @@ print_one_catch_vfork (struct breakpoint *b, struct bp_location **last_loc) uiout->field_skip ("addr"); annotate_field (5); uiout->text ("vfork"); - if (!ptid_equal (c->forked_inferior_pid, null_ptid)) + if (c->forked_inferior_pid != null_ptid) { uiout->text (", process "); uiout->field_int ("what", c->forked_inferior_pid.pid ()); diff --git a/gdb/common/agent.c b/gdb/common/agent.c index 65d5f19..8f80aee 100644 --- a/gdb/common/agent.c +++ b/gdb/common/agent.c @@ -234,7 +234,7 @@ agent_run_command (int pid, const char *cmd, int len) return -1; /* Need to read response with the inferior stopped. */ - if (!ptid_equal (ptid, null_ptid)) + if (ptid != null_ptid) { /* Stop thread PTID. */ DEBUG_AGENT ("agent: stop helper thread\n"); diff --git a/gdb/common/ptid.c b/gdb/common/ptid.c index b9a331a..22d79e2 100644 --- a/gdb/common/ptid.c +++ b/gdb/common/ptid.c @@ -24,11 +24,3 @@ ptid_t null_ptid = ptid_t::make_null (); ptid_t minus_one_ptid = ptid_t::make_minus_one (); - -/* See ptid.h. */ - -int -ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2) -{ - return ptid1 == ptid2; -} diff --git a/gdb/common/ptid.h b/gdb/common/ptid.h index 2fc84b9..03f5321 100644 --- a/gdb/common/ptid.h +++ b/gdb/common/ptid.h @@ -152,12 +152,4 @@ extern ptid_t null_ptid; extern ptid_t minus_one_ptid; - -/* The following functions are kept for backwards compatibility. The use of - the ptid_t methods is preferred. */ - -/* See ptid_t::operator== and ptid_t::operator!=. */ - -extern int ptid_equal (const ptid_t &ptid1, const ptid_t &ptid2); - #endif diff --git a/gdb/corelow.c b/gdb/corelow.c index 153afd8..ecf9665 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -444,7 +444,7 @@ core_target_open (const char *arg, int from_tty) bfd_map_over_sections (core_bfd, add_to_thread_list, bfd_get_section_by_name (core_bfd, ".reg")); - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) { /* Either we found no .reg/NN section, and hence we have a non-threaded core (single-threaded, from gdb's perspective), diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c index e68637f..f3c8de2 100644 --- a/gdb/darwin-nat-info.c +++ b/gdb/darwin-nat-info.c @@ -116,7 +116,7 @@ get_task_from_args (const char *args) if (args == NULL || *args == 0) { - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) printf_unfiltered (_("No inferior running\n")); darwin_inferior *priv = get_darwin_inferior (current_inferior ()); @@ -257,7 +257,7 @@ info_mach_ports_command (const char *args, int from_tty) printf_unfiltered (_(" gdb-exception")); else if (port == darwin_port_set) printf_unfiltered (_(" gdb-port_set")); - else if (!ptid_equal (inferior_ptid, null_ptid)) + else if (inferior_ptid != null_ptid) { struct inferior *inf = current_inferior (); darwin_inferior *priv = get_darwin_inferior (inf); @@ -731,7 +731,7 @@ info_mach_region_command (const char *exp, int from_tty) } address = value_as_address (val); - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) error (_("Inferior not available")); inf = current_inferior (); @@ -803,7 +803,7 @@ info_mach_exceptions_command (const char *args, int from_tty) { if (strcmp (args, "saved") == 0) { - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) printf_unfiltered (_("No inferior running\n")); darwin_inferior *priv = get_darwin_inferior (current_inferior ()); @@ -827,7 +827,7 @@ info_mach_exceptions_command (const char *args, int from_tty) { struct inferior *inf; - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) printf_unfiltered (_("No inferior running\n")); inf = current_inferior (); diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c index 9015f32..8104de5 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -942,7 +942,7 @@ darwin_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal) ptid = inferior_ptid; /* minus_one_ptid is RESUME_ALL. */ - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) { struct resume_inferior_threads_param param; @@ -1244,7 +1244,7 @@ darwin_wait (ptid_t ptid, struct target_waitstatus *status) darwin_dump_message (hdr, darwin_debug_flag > 11); res = darwin_decode_message (hdr, &thread, &inf, status); - if (ptid_equal (res, minus_one_ptid)) + if (res == minus_one_ptid) continue; /* Early return in case an inferior has exited. */ @@ -1517,7 +1517,7 @@ darwin_nat_target::kill () int status; int res; - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) return; gdb_assert (inf != NULL); @@ -2223,7 +2223,7 @@ static void set_enable_mach_exceptions (const char *args, int from_tty, struct cmd_list_element *c) { - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) { struct inferior *inf = current_inferior (); darwin_inferior *priv = get_darwin_inferior (inf); diff --git a/gdb/dcache.c b/gdb/dcache.c index 20b781f..f72b348 100644 --- a/gdb/dcache.c +++ b/gdb/dcache.c @@ -472,7 +472,7 @@ dcache_read_memory_partial (struct target_ops *ops, DCACHE *dcache, /* If this is a different inferior from what we've recorded, flush the cache. */ - if (! ptid_equal (inferior_ptid, dcache->ptid)) + if (inferior_ptid != dcache->ptid) { dcache_invalidate (dcache); dcache->ptid = inferior_ptid; @@ -608,7 +608,7 @@ dcache_info_1 (DCACHE *dcache, const char *exp) dcache ? (unsigned) dcache->line_size : dcache_line_size); - if (dcache == NULL || ptid_equal (dcache->ptid, null_ptid)) + if (dcache == NULL || dcache->ptid == null_ptid) { printf_filtered (_("No data cache available.\n")); return; diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c index 71530aa..fa4e06e 100644 --- a/gdb/dtrace-probe.c +++ b/gdb/dtrace-probe.c @@ -778,7 +778,7 @@ dtrace_probe::enable () /* Enabling a dtrace probe implies patching the text section of the running process, so make sure the inferior is indeed running. */ - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) error (_("No inferior running")); /* Fast path. */ @@ -802,7 +802,7 @@ dtrace_probe::disable () /* Disabling a dtrace probe implies patching the text section of the running process, so make sure the inferior is indeed running. */ - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) error (_("No inferior running")); /* Fast path. */ diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 4542887..115deac 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -1089,7 +1089,7 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) pid_t pid; /* Don't PT_CONTINUE a process which has a pending vfork done event. */ - if (ptid_equal (minus_one_ptid, ptid)) + if (minus_one_ptid == ptid) pid = inferior_ptid.pid (); else pid = ptid.pid (); @@ -1236,7 +1236,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, { #ifndef PTRACE_VFORK wptid = fbsd_next_vfork_done (); - if (!ptid_equal (wptid, null_ptid)) + if (wptid != null_ptid) { ourstatus->kind = TARGET_WAITKIND_VFORK_DONE; return wptid; @@ -1345,7 +1345,7 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, /* Make sure the other end of the fork is stopped too. */ child_ptid = fbsd_is_child_pending (child); - if (ptid_equal (child_ptid, null_ptid)) + if (child_ptid == null_ptid) { pid = waitpid (child, &status, 0); if (pid == -1) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 5e2d64e..a59999a 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,17 @@ 2018-07-03 Tom Tromey <tom@tromey.com> + * linux-low.c: Update. + * lynx-low.c: Update. + * mem-break.c: Update. + * nto-low.c: Update. + * remote-utils.c: Update. + * server.c: Update. + * spu-low.c: Update. + * target.c: Update. + * win32-low.c: Update. + +2018-07-03 Tom Tromey <tom@tromey.com> + * server.c: Update. 2018-07-03 Tom Tromey <tom@tromey.com> diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index cef528b..6e026f1 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -2635,7 +2635,7 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid, /* Check for a lwp with a pending status. */ - if (ptid_equal (filter_ptid, minus_one_ptid) || filter_ptid.is_pid ()) + if (filter_ptid == minus_one_ptid || filter_ptid.is_pid ()) { event_thread = find_thread_in_random ([&] (thread_info *thread) { @@ -2647,7 +2647,7 @@ linux_wait_for_event_filtered (ptid_t wait_ptid, ptid_t filter_ptid, if (debug_threads && event_thread) debug_printf ("Got a pending child %ld\n", lwpid_of (event_thread)); } - else if (!ptid_equal (filter_ptid, null_ptid)) + else if (filter_ptid != null_ptid) { requested_child = find_lwp_pid (filter_ptid); @@ -3159,7 +3159,7 @@ linux_wait_1 (ptid_t ptid, else any_resumed = 0; - if (ptid_equal (step_over_bkpt, null_ptid)) + if (step_over_bkpt == null_ptid) pid = linux_wait_for_event (ptid, &w, options); else { @@ -3248,7 +3248,7 @@ linux_wait_1 (ptid_t ptid, if it's not the single_step_breakpoint we are hitting. This avoids that a program would keep trapping a permanent breakpoint forever. */ - if (!ptid_equal (step_over_bkpt, null_ptid) + if (step_over_bkpt != null_ptid && event_child->stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT && (event_child->stepping || !single_step_breakpoint_inserted_here (event_child->stop_pc))) @@ -3736,7 +3736,7 @@ linux_wait_1 (ptid_t ptid, from among those that have had events. Giving equal priority to all LWPs that have had events helps prevent starvation. */ - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) { event_child->status_pending_p = 1; event_child->status_pending = w; @@ -3827,7 +3827,7 @@ linux_wait_1 (ptid_t ptid, ourstatus->value.sig = gdb_signal_from_host (WSTOPSIG (w)); } - gdb_assert (ptid_equal (step_over_bkpt, null_ptid)); + gdb_assert (step_over_bkpt == null_ptid); if (debug_threads) { @@ -3886,14 +3886,14 @@ linux_wait (ptid_t ptid, event_ptid = linux_wait_1 (ptid, ourstatus, target_options); } while ((target_options & TARGET_WNOHANG) == 0 - && ptid_equal (event_ptid, null_ptid) + && event_ptid == null_ptid && ourstatus->kind == TARGET_WAITKIND_IGNORE); /* If at least one stop was reported, there may be more. A single SIGCHLD can signal more than one child stop. */ if (target_is_async_p () && (target_options & TARGET_WNOHANG) != 0 - && !ptid_equal (event_ptid, null_ptid)) + && event_ptid != null_ptid) async_file_mark (); return event_ptid; @@ -4542,7 +4542,7 @@ linux_set_resume_request (thread_info *thread, thread_resume *resume, size_t n) for (int ndx = 0; ndx < n; ndx++) { ptid_t ptid = resume[ndx].thread; - if (ptid_equal (ptid, minus_one_ptid) + if (ptid == minus_one_ptid || ptid == thread->id /* Handle both 'pPID' and 'pPID.-1' as meaning 'all threads of PID'. */ @@ -4899,7 +4899,7 @@ finish_step_over (struct lwp_info *lwp) static void complete_ongoing_step_over (void) { - if (!ptid_equal (step_over_bkpt, null_ptid)) + if (step_over_bkpt != null_ptid) { struct lwp_info *lwp; int wstat; diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c index 8d79ab1..b68bbea 100644 --- a/gdb/gdbserver/lynx-low.c +++ b/gdb/gdbserver/lynx-low.c @@ -342,14 +342,14 @@ lynx_resume (struct thread_resume *resume_info, size_t n) LynxOS 178 is a little more sensitive, and triggers some unexpected signals (Eg SIG61) when we resume the inferior using a different thread. */ - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) ptid = current_process()->priv->last_wait_event_ptid; /* The ptid might still be minus_one_ptid; this can happen between the moment we create the inferior or attach to a process, and the moment we resume its execution for the first time. It is fine to use the current_thread's ptid in those cases. */ - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) ptid = ptid_of (current_thread); regcache_invalidate_pid (ptid.pid ()); @@ -422,7 +422,7 @@ lynx_wait_1 (ptid_t ptid, struct target_waitstatus *status, int options) int wstat; ptid_t new_ptid; - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) pid = lynx_ptid_get_pid (ptid_of (current_thread)); else pid = BUILDPID (lynx_ptid_get_pid (ptid), lynx_ptid_get_tid (ptid)); diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c index 7ad8c48..447afc7 100644 --- a/gdb/gdbserver/mem-break.c +++ b/gdb/gdbserver/mem-break.c @@ -1501,8 +1501,7 @@ delete_single_step_breakpoints (struct thread_info *thread) while (bp) { if (bp->type == single_step_breakpoint - && ptid_equal (((struct single_step_breakpoint *) bp)->ptid, - ptid_of (thread))) + && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread)) { struct thread_info *saved_thread = current_thread; @@ -1598,8 +1597,7 @@ uninsert_single_step_breakpoints (struct thread_info *thread) for (bp = proc->breakpoints; bp != NULL; bp = bp->next) { if (bp->type == single_step_breakpoint - && ptid_equal (((struct single_step_breakpoint *) bp)->ptid, - ptid_of (thread))) + && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread)) { gdb_assert (bp->raw->inserted > 0); @@ -1673,8 +1671,7 @@ has_single_step_breakpoints (struct thread_info *thread) while (bp) { if (bp->type == single_step_breakpoint - && ptid_equal (((struct single_step_breakpoint *) bp)->ptid, - ptid_of (thread))) + && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread)) return 1; else { @@ -1708,8 +1705,7 @@ reinsert_single_step_breakpoints (struct thread_info *thread) for (bp = proc->breakpoints; bp != NULL; bp = bp->next) { if (bp->type == single_step_breakpoint - && ptid_equal (((struct single_step_breakpoint *) bp)->ptid, - ptid_of (thread))) + && ((struct single_step_breakpoint *) bp)->ptid == ptid_of (thread)) { gdb_assert (bp->raw->inserted > 0); diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c index 21f6da6..236e555 100644 --- a/gdb/gdbserver/nto-low.c +++ b/gdb/gdbserver/nto-low.c @@ -94,8 +94,8 @@ nto_set_thread (ptid_t ptid) TRACE ("%s pid: %d tid: %ld\n", __func__, ptid.pid (), ptid.lwp ()); if (nto_inferior.ctl_fd != -1 - && !ptid_equal (ptid, null_ptid) - && !ptid_equal (ptid, minus_one_ptid)) + && ptid != null_ptid + && ptid != minus_one_ptid) { pthread_t tid = ptid.lwp (); diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index ac57ce5..45d5c8d 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -1222,7 +1222,7 @@ prepare_resume_reply (char *buf, ptid_t ptid, in GDB will claim this event belongs to inferior_ptid if we do not specify a thread, and there's no way for gdbserver to know what inferior_ptid is. */ - if (1 || !ptid_equal (cs.general_thread, ptid)) + if (1 || cs.general_thread != ptid) { int core = -1; /* In non-stop, don't change the general thread behind diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 3c58c6e..e5d226c 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -441,8 +441,8 @@ handle_btrace_general_set (char *own_buf) op = own_buf + strlen ("Qbtrace:"); - if (ptid_equal (cs.general_thread, null_ptid) - || ptid_equal (cs.general_thread, minus_one_ptid)) + if (cs.general_thread == null_ptid + || cs.general_thread == minus_one_ptid) { strcpy (own_buf, "E.Must select a single thread."); return -1; @@ -491,8 +491,8 @@ handle_btrace_conf_general_set (char *own_buf) op = own_buf + strlen ("Qbtrace-conf:"); - if (ptid_equal (cs.general_thread, null_ptid) - || ptid_equal (cs.general_thread, minus_one_ptid)) + if (cs.general_thread == null_ptid + || cs.general_thread == minus_one_ptid) { strcpy (own_buf, "E.Must select a single thread."); return -1; @@ -1829,8 +1829,8 @@ handle_qxfer_btrace (const char *annex, if (writebuf != NULL) return -2; - if (ptid_equal (cs.general_thread, null_ptid) - || ptid_equal (cs.general_thread, minus_one_ptid)) + if (cs.general_thread == null_ptid + || cs.general_thread == minus_one_ptid) { strcpy (cs.own_buf, "E.Must select a single thread."); return -3; @@ -1913,8 +1913,8 @@ handle_qxfer_btrace_conf (const char *annex, if (annex[0] != '\0') return -1; - if (ptid_equal (cs.general_thread, null_ptid) - || ptid_equal (cs.general_thread, minus_one_ptid)) + if (cs.general_thread == null_ptid + || cs.general_thread == minus_one_ptid) { strcpy (cs.own_buf, "E.Must select a single thread."); return -3; @@ -2696,8 +2696,8 @@ visit_actioned_threads (thread_info *thread, { const struct thread_resume *action = &actions[i]; - if (ptid_equal (action->thread, minus_one_ptid) - || ptid_equal (action->thread, thread->id) + if (action->thread == minus_one_ptid + || action->thread == thread->id || ((action->thread.pid () == thread->id.pid ()) && action->thread.lwp () == -1)) @@ -3199,8 +3199,8 @@ myresume (char *own_buf, int step, int sig) int n = 0; int valid_cont_thread; - valid_cont_thread = (!ptid_equal (cs.cont_thread, null_ptid) - && !ptid_equal (cs.cont_thread, minus_one_ptid)); + valid_cont_thread = (cs.cont_thread != null_ptid + && cs.cont_thread != minus_one_ptid); if (step || sig || valid_cont_thread) { @@ -4095,7 +4095,7 @@ process_serial_event (void) if (cs.own_buf[1] == 'g') { - if (ptid_equal (thread_id, null_ptid)) + if (thread_id == null_ptid) { /* GDB is telling us to choose any thread. Check if the currently selected thread is still valid. If diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c index b3980e7..e9fc6e7 100644 --- a/gdb/gdbserver/spu-low.c +++ b/gdb/gdbserver/spu-low.c @@ -383,7 +383,7 @@ spu_join (int pid) static int spu_thread_alive (ptid_t ptid) { - return ptid_equal (ptid, current_ptid); + return ptid == current_ptid; } /* Resume process. */ @@ -394,8 +394,8 @@ spu_resume (struct thread_resume *resume_info, size_t n) size_t i; for (i = 0; i < n; i++) - if (ptid_equal (resume_info[i].thread, minus_one_ptid) - || ptid_equal (resume_info[i].thread, ptid_of (thr))) + if (resume_info[i].thread == minus_one_ptid + || resume_info[i].thread == ptid_of (thr)) break; if (i == n) diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index 81d7cc4..00379bf 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -314,9 +314,9 @@ target_pid_to_str (ptid_t ptid) { static char buf[80]; - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) xsnprintf (buf, sizeof (buf), "<all threads>"); - else if (ptid_equal (ptid, null_ptid)) + else if (ptid == null_ptid) xsnprintf (buf, sizeof (buf), "<null thread>"); else if (ptid.tid () != 0) xsnprintf (buf, sizeof (buf), "Thread %d.0x%lx", diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c index 53b843b..8a20972 100644 --- a/gdb/gdbserver/win32-low.c +++ b/gdb/gdbserver/win32-low.c @@ -914,7 +914,7 @@ win32_resume (struct thread_resume *resume_info, size_t n) /* This handles the very limited set of resume packets that GDB can currently produce. */ - if (n == 1 && ptid_equal (resume_info[0].thread, minus_one_ptid)) + if (n == 1 && resume_info[0].thread == minus_one_ptid) tid = -1; else if (n > 1) tid = -1; @@ -923,7 +923,7 @@ win32_resume (struct thread_resume *resume_info, size_t n) the Windows resume code do the right thing for thread switching. */ tid = current_event.dwThreadId; - if (!ptid_equal (resume_info[0].thread, minus_one_ptid)) + if (resume_info[0].thread != minus_one_ptid) { sig = gdb_signal_from_host (resume_info[0].sig); step = resume_info[0].kind == resume_step; diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h index 714fb63..2c40254 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -217,7 +217,7 @@ public: { /* If this is the current thread, or there's code out there that relies on it existing (refcount > 0) we can't delete yet. */ - return (refcount () == 0 && !ptid_equal (ptid, inferior_ptid)); + return (refcount () == 0 && ptid != inferior_ptid); } /* Mark this thread as running and notify observers. */ diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index f256a82..a886c2b 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -1100,7 +1100,7 @@ inf_validate_procs (struct inf *inf) /* Tell GDB's generic thread code. */ - if (ptid_equal (inferior_ptid, ptid_t (inf->pid))) + if (inferior_ptid == ptid_t (inf->pid)) /* This is the first time we're hearing about thread ids, after a fork-child. */ thread_change_ptid (inferior_ptid, ptid); @@ -1617,7 +1617,7 @@ rewait: thread = inf->wait.thread; if (thread) ptid = ptid_t (inf->pid, thread->tid, 0); - else if (ptid_equal (ptid, minus_one_ptid)) + else if (ptid == minus_one_ptid) thread = inf_tid_to_thread (inf, -1); else thread = inf_tid_to_thread (inf, ptid.lwp ()); @@ -1634,7 +1634,7 @@ rewait: } if (thread - && !ptid_equal (ptid, minus_one_ptid) + && ptid != minus_one_ptid && status->kind != TARGET_WAITKIND_SPURIOUS && inf->pause_sc == 0 && thread->pause_sc == 0) /* If something actually happened to THREAD, make sure we @@ -2036,7 +2036,7 @@ gnu_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig) inf_update_procs (inf); /* A specific PTID means `step only this process id'. */ - resume_all = ptid_equal (ptid, minus_one_ptid); + resume_all = ptid == minus_one_ptid; if (resume_all) /* Allow all threads to run, except perhaps single-stepping one. */ diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 849fdb5..6c0dbf7 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -989,7 +989,7 @@ go32_nat_target::pass_ctrlc () bool go32_nat_target::thread_alive (ptid_t ptid) { - return !ptid_equal (ptid, null_ptid); + return ptid != null_ptid; } const char * diff --git a/gdb/inf-loop.c b/gdb/inf-loop.c index bb6ad25..2aa6816 100644 --- a/gdb/inf-loop.c +++ b/gdb/inf-loop.c @@ -55,7 +55,7 @@ inferior_event_handler (enum inferior_event_type event_type, /* Do all continuations associated with the whole inferior (not a particular thread). */ - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) do_all_inferior_continuations (0); /* When running a command list (from a user command, say), these diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index d1c9a90..90ea679 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -341,7 +341,7 @@ inf_ptrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal) pid_t pid; int request; - if (ptid_equal (minus_one_ptid, ptid)) + if (minus_one_ptid == ptid) /* Resume all threads. Traditionally ptrace() only supports single-threaded processes, so simply resume the inferior. */ pid = inferior_ptid.pid (); diff --git a/gdb/infcall.c b/gdb/infcall.c index e1861dc..172c26a 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -1271,7 +1271,7 @@ When the function is done executing, GDB will silently stop."), name); } - if (! ptid_equal (call_thread_ptid, inferior_ptid)) + if (call_thread_ptid != inferior_ptid) { const char *name = get_function_name (funaddr, name_buf, sizeof (name_buf)); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index c9c70fb..821bcc6 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -508,7 +508,7 @@ post_create_inferior (struct target_ops *target, int from_tty) static void kill_if_already_running (int from_tty) { - if (! ptid_equal (inferior_ptid, null_ptid) && target_has_execution) + if (inferior_ptid != null_ptid && target_has_execution) { /* Bail out before killing the program if we will not be able to restart it. */ @@ -1349,7 +1349,7 @@ signal_command (const char *signum_exp, int from_tty) ALL_NON_EXITED_THREADS (tp) { - if (ptid_equal (tp->ptid, inferior_ptid)) + if (tp->ptid == inferior_ptid) continue; if (!tp->ptid.matches (resume_ptid)) continue; @@ -2592,7 +2592,7 @@ kill_command (const char *arg, int from_tty) It should be a distinct flag that indicates that a target is active, cuz some targets don't have processes! */ - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) error (_("The program is not being run.")); if (!query (_("Kill the program being debugged? "))) error (_("Not confirmed.")); @@ -2999,7 +2999,7 @@ detach_command (const char *args, int from_tty) { dont_repeat (); /* Not for the faint of heart. */ - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) error (_("The program is not being run.")); query_if_trace_running (from_tty); diff --git a/gdb/inflow.c b/gdb/inflow.c index 7bcefdc..a3b5ba8 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -718,7 +718,7 @@ child_terminal_info (struct target_ops *self, const char *args, int from_tty) return; } - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) return; inf = current_inferior (); diff --git a/gdb/infrun.c b/gdb/infrun.c index c1214ee..dd7e69e 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1128,7 +1128,7 @@ follow_exec (ptid_t ptid, char *exec_file_target) stop provides a nicer sequence of events for user and MI notifications. */ ALL_THREADS_SAFE (th, tmp) - if (th->ptid.pid () == pid && !ptid_equal (th->ptid, ptid)) + if (th->ptid.pid () == pid && th->ptid != ptid) delete_thread (th); /* We also need to clear any left over stale state for the @@ -2176,7 +2176,7 @@ infrun_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid) { struct displaced_step_inferior_state *displaced; - if (ptid_equal (inferior_ptid, old_ptid)) + if (inferior_ptid == old_ptid) inferior_ptid = new_ptid; } @@ -2883,7 +2883,7 @@ clear_proceed_status (int step) } } - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) { struct inferior *inferior; @@ -3336,7 +3336,7 @@ infrun_thread_stop_requested (ptid_t ptid) static void infrun_thread_thread_exit (struct thread_info *tp, int silent) { - if (ptid_equal (target_last_wait_ptid, tp->ptid)) + if (target_last_wait_ptid == tp->ptid) nullify_last_target_wait_ptid (); } @@ -3361,7 +3361,7 @@ typedef void (*for_each_just_stopped_thread_callback_func) static void for_each_just_stopped_thread (for_each_just_stopped_thread_callback_func func) { - if (!target_has_execution || ptid_equal (inferior_ptid, null_ptid)) + if (!target_has_execution || inferior_ptid == null_ptid) return; if (target_is_non_stop_p ()) @@ -3493,7 +3493,7 @@ do_target_wait (ptid_t ptid, struct target_waitstatus *status, int options) /* First check if there is a resumed thread with a wait status pending. */ - if (ptid_equal (ptid, minus_one_ptid) || ptid.is_pid ()) + if (ptid == minus_one_ptid || ptid.is_pid ()) { tp = random_pending_event_thread (ptid); } @@ -5735,7 +5735,7 @@ handle_signal_stop (struct execution_control_state *ecs) /* See if something interesting happened to the non-current thread. If so, then switch to that thread. */ - if (!ptid_equal (ecs->ptid, inferior_ptid)) + if (ecs->ptid != inferior_ptid) { if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: context switch\n"); @@ -7673,7 +7673,7 @@ stop_waiting (struct execution_control_state *ecs) static void keep_going_pass_signal (struct execution_control_state *ecs) { - gdb_assert (ptid_equal (ecs->event_thread->ptid, inferior_ptid)); + gdb_assert (ecs->event_thread->ptid == inferior_ptid); gdb_assert (!ecs->event_thread->resumed); /* Save the pc before execution, to compare with pc after stop. */ @@ -8125,7 +8125,7 @@ save_stop_context (void) sc->ptid = inferior_ptid; sc->inf_num = current_inferior ()->num; - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) { /* Take a strong reference so that the thread can't be deleted yet. */ @@ -8157,7 +8157,7 @@ release_stop_context_cleanup (void *arg) static int stop_context_changed (struct stop_context *prev) { - if (!ptid_equal (prev->ptid, inferior_ptid)) + if (prev->ptid != inferior_ptid) return 1; if (prev->inf_num != current_inferior ()->num) return 1; @@ -8338,7 +8338,7 @@ normal_stop (void) /* Notify observers about the stop. This is where the interpreters print the stop event. */ - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) gdb::observers::normal_stop.notify (inferior_thread ()->control.stop_bpstat, stop_print_frame); else @@ -8790,7 +8790,7 @@ siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var, void *ignore) { if (target_has_stack - && !ptid_equal (inferior_ptid, null_ptid) + && inferior_ptid != null_ptid && gdbarch_get_siginfo_type_p (gdbarch)) { struct type *type = gdbarch_get_siginfo_type (gdbarch); diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index 1cbaca5..74d5c19 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -144,7 +144,7 @@ delete_fork (ptid_t ptid) linux_target->low_forget_process (ptid.pid ()); for (fp = fork_list; fp; fpprev = fp, fp = fp->next) - if (ptid_equal (fp->ptid, ptid)) + if (fp->ptid == ptid) break; if (!fp) @@ -162,7 +162,7 @@ delete_fork (ptid_t ptid) remove it, leaving the list empty -- we're now down to the default case of debugging a single process. */ if (fork_list != NULL && fork_list->next == NULL && - ptid_equal (fork_list->ptid, inferior_ptid)) + fork_list->ptid == inferior_ptid) { /* Last fork -- delete from list and handle as solo process (should be a safe recursion). */ @@ -177,7 +177,7 @@ find_fork_ptid (ptid_t ptid) struct fork_info *fp; for (fp = fork_list; fp; fp = fp->next) - if (ptid_equal (fp->ptid, ptid)) + if (fp->ptid == ptid) return fp; return NULL; @@ -462,7 +462,7 @@ inferior_call_waitpid (ptid_t pptid, int pid) struct cleanup *old_cleanup; int ret = -1; - if (!ptid_equal (pptid, inferior_ptid)) + if (pptid != inferior_ptid) { /* Switch to pptid. */ oldfp = find_fork_ptid (inferior_ptid); @@ -515,10 +515,10 @@ delete_checkpoint_command (const char *args, int from_tty) error (_("Requires argument (checkpoint id to delete)")); ptid = fork_id_to_ptid (parse_and_eval_long (args)); - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) error (_("No such checkpoint id, %s"), args); - if (ptid_equal (ptid, inferior_ptid)) + if (ptid == inferior_ptid) error (_("\ Please switch to another checkpoint before deleting the current one")); @@ -556,10 +556,10 @@ detach_checkpoint_command (const char *args, int from_tty) error (_("Requires argument (checkpoint id to detach)")); ptid = fork_id_to_ptid (parse_and_eval_long (args)); - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) error (_("No such checkpoint id, %s"), args); - if (ptid_equal (ptid, inferior_ptid)) + if (ptid == inferior_ptid) error (_("\ Please switch to another checkpoint before detaching the current one")); @@ -593,7 +593,7 @@ info_checkpoints_command (const char *arg, int from_tty) continue; printed = fp; - if (ptid_equal (fp->ptid, inferior_ptid)) + if (fp->ptid == inferior_ptid) printf_filtered ("* "); else printf_filtered (" "); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index c79d72c..567cb06 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1690,7 +1690,7 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) target_pid_to_str (inferior_ptid)); /* A specific PTID means `step only this process id'. */ - resume_many = (ptid_equal (minus_one_ptid, ptid) + resume_many = (minus_one_ptid == ptid || ptid.is_pid ()); /* Mark the lwps we're resuming as resumed. */ @@ -3389,7 +3389,7 @@ linux_nat_wait_1 (ptid_t ptid, struct target_waitstatus *ourstatus, /* If we're not waiting for a specific LWP, choose an event LWP from among those that have had events. Giving equal priority to all LWPs that have had events helps prevent starvation. */ - if (ptid_equal (ptid, minus_one_ptid) || ptid.is_pid ()) + if (ptid == minus_one_ptid || ptid.is_pid ()) select_event_lwp (ptid, &lp, &status); gdb_assert (lp != NULL); @@ -3583,7 +3583,7 @@ linux_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, if (target_is_async_p () && ((ourstatus->kind != TARGET_WAITKIND_IGNORE && ourstatus->kind != TARGET_WAITKIND_NO_RESUMED) - || !ptid_equal (ptid, minus_one_ptid))) + || ptid != minus_one_ptid)) async_file_mark (); return event_ptid; @@ -3857,7 +3857,7 @@ linux_nat_target::xfer_partial (enum target_object object, /* The target is connected but no live inferior is selected. Pass this request down to a lower stratum (e.g., the executable file). */ - if (object == TARGET_OBJECT_MEMORY && ptid_equal (inferior_ptid, null_ptid)) + if (object == TARGET_OBJECT_MEMORY && inferior_ptid == null_ptid) return TARGET_XFER_EOF; if (object == TARGET_OBJECT_AUXV) diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index de9a48c..ad193d6 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -1792,7 +1792,7 @@ thread_db_target::resume (ptid_t ptid, int step, enum gdb_signal signo) { struct thread_db_info *info; - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) info = get_thread_db_info (inferior_ptid.pid ()); else info = get_thread_db_info (ptid.pid ()); diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 9a48ee0..e055dce 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -684,7 +684,7 @@ mi_about_to_proceed (void) { /* Suppress output while calling an inferior function. */ - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) { struct thread_info *tp = inferior_thread (); @@ -1023,7 +1023,7 @@ mi_on_resume (ptid_t ptid) { struct thread_info *tp = NULL; - if (ptid_equal (ptid, minus_one_ptid) || ptid.is_pid ()) + if (ptid == minus_one_ptid || ptid.is_pid ()) tp = inferior_thread (); else tp = find_thread_ptid (ptid); diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 6228dd1..18ce4e6 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -566,7 +566,7 @@ mi_cmd_thread_select (const char *command, char **argv, int argc) USER_SELECTED_THREAD | USER_SELECTED_FRAME); /* Notify if the thread has effectively changed. */ - if (!ptid_equal (inferior_ptid, previous_ptid)) + if (inferior_ptid != previous_ptid) { gdb::observers::user_selected_context_changed.notify (USER_SELECTED_THREAD | USER_SELECTED_FRAME); @@ -2004,11 +2004,11 @@ mi_execute_command (const char *cmd, int from_tty) if (command->thread == -1) { - report_change = (!ptid_equal (previous_ptid, null_ptid) - && !ptid_equal (inferior_ptid, previous_ptid) - && !ptid_equal (inferior_ptid, null_ptid)); + report_change = (previous_ptid != null_ptid + && inferior_ptid != previous_ptid + && inferior_ptid != null_ptid); } - else if (!ptid_equal (inferior_ptid, null_ptid)) + else if (inferior_ptid != null_ptid) { struct thread_info *ti = inferior_thread (); diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index d140068..117edb1 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -810,7 +810,7 @@ nto_procfs_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, ourstatus->kind = TARGET_WAITKIND_SPURIOUS; - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) { ourstatus->kind = TARGET_WAITKIND_STOPPED; ourstatus->value.sig = GDB_SIGNAL_0; @@ -1079,10 +1079,10 @@ nto_procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo) procfs_status status; sigset_t *run_fault = (sigset_t *) (void *) &run.fault; - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) return; - procfs_set_thread (ptid_equal (ptid, minus_one_ptid) ? inferior_ptid : + procfs_set_thread (ptid == minus_one_ptid ? inferior_ptid : ptid); run.flags = _DEBUG_RUN_FAULT | _DEBUG_RUN_TRACE; @@ -1135,7 +1135,7 @@ nto_procfs_target::resume (ptid_t ptid, int step, enum gdb_signal signo) void nto_procfs_target::mourn_inferior () { - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) { SignalKill (nto_node (), inferior_ptid.pid (), 0, SIGKILL, 0, 0); close (ctl_fd); @@ -1395,7 +1395,7 @@ nto_procfs_target::store_registers (struct regcache *regcache, int regno) char *data; ptid_t ptid = regcache->ptid (); - if (ptid_equal (ptid, null_ptid)) + if (ptid == null_ptid) return; procfs_set_thread (ptid); diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index f585e5a..33a0b5a 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1269,7 +1269,7 @@ ppc_linux_spe_context (int wordsize, enum bfd_endian byte_order, return 0; /* Look up cached address of thread-local variable. */ - if (!ptid_equal (spe_context_cache_ptid, inferior_ptid)) + if (spe_context_cache_ptid != inferior_ptid) { struct target_ops *target = current_top_target (); diff --git a/gdb/procfs.c b/gdb/procfs.c index ad6549c..e6c6066 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -1336,7 +1336,7 @@ proc_set_current_signal (procinfo *pi, int signo) /* The pointer is just a type alias. */ get_last_target_status (&wait_ptid, &wait_status); - if (ptid_equal (wait_ptid, inferior_ptid) + if (wait_ptid == inferior_ptid && wait_status.kind == TARGET_WAITKIND_STOPPED && wait_status.value.sig == gdb_signal_from_host (signo) && proc_get_status (pi) @@ -2525,7 +2525,7 @@ wait_again: /* Got this far without error: If retval isn't in the threads database, add it. */ if (retval.pid () > 0 && - !ptid_equal (retval, inferior_ptid) && + retval != inferior_ptid && !in_thread_list (retval)) { /* We have a new thread. We need to add it both to @@ -2852,7 +2852,7 @@ unconditionally_kill_inferior (procinfo *pi) void procfs_target::kill () { - if (!ptid_equal (inferior_ptid, null_ptid)) /* ? */ + if (inferior_ptid != null_ptid) /* ? */ { /* Find procinfo for main process. */ procinfo *pi = find_procinfo (inferior_ptid.pid (), 0); @@ -2870,7 +2870,7 @@ procfs_target::mourn_inferior () { procinfo *pi; - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) { /* Find procinfo for main process. */ pi = find_procinfo (inferior_ptid.pid (), 0); diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 0e6b9eb..8bd31a5 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -193,7 +193,7 @@ ravenscar_task_is_currently_active (ptid_t ptid) ptid_t active_task_ptid = ravenscar_active_task (ravenscar_get_thread_base_cpu (ptid)); - return ptid_equal (ptid, active_task_ptid); + return ptid == active_task_ptid; } /* Return the CPU thread (as a ptid_t) on which the given ravenscar @@ -235,7 +235,7 @@ ravenscar_update_inferior_ptid (void) /* Make sure we set base_ptid before calling ravenscar_active_task as the latter relies on it. */ inferior_ptid = ravenscar_active_task (base_cpu); - gdb_assert (!ptid_equal (inferior_ptid, null_ptid)); + gdb_assert (inferior_ptid != null_ptid); /* The running thread may not have been added to system.tasking.debug's list yet; so ravenscar_update_thread_list @@ -291,7 +291,7 @@ has_ravenscar_runtime (void) static int ravenscar_runtime_initialized (void) { - return (!(ptid_equal (ravenscar_active_task (1), null_ptid))); + return (!(ravenscar_active_task (1) == null_ptid)); } /* Return the ID of the thread that is currently running. diff --git a/gdb/regcache.c b/gdb/regcache.c index bc916f3..f3f845a 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -357,7 +357,7 @@ get_thread_arch_aspace_regcache (ptid_t ptid, struct gdbarch *gdbarch, struct address_space *aspace) { for (const auto ®cache : regcache::current_regcache) - if (ptid_equal (regcache->ptid (), ptid) && regcache->arch () == gdbarch) + if (regcache->ptid () == ptid && regcache->arch () == gdbarch) return regcache; regcache *new_regcache = new regcache (gdbarch, aspace); @@ -382,7 +382,7 @@ static struct gdbarch *current_thread_arch; struct regcache * get_thread_regcache (ptid_t ptid) { - if (!current_thread_arch || !ptid_equal (current_thread_ptid, ptid)) + if (!current_thread_arch || current_thread_ptid != ptid) { current_thread_ptid = ptid; current_thread_arch = target_thread_architecture (ptid); @@ -428,7 +428,7 @@ regcache::regcache_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid) { for (auto ®cache : regcache::current_regcache) { - if (ptid_equal (regcache->ptid (), old_ptid)) + if (regcache->ptid () == old_ptid) regcache->set_ptid (new_ptid); } } diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 025dfcb..f76261d 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -660,7 +660,7 @@ gdbsim_target::create_inferior (const char *exec_file, (exec_file ? exec_file : "(NULL)"), args); - if (ptid_equal (inferior_ptid, sim_data->remote_sim_ptid)) + if (inferior_ptid == sim_data->remote_sim_ptid) kill (); remove_breakpoints (); init_wait_for_inferior (); @@ -925,7 +925,7 @@ gdbsim_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal) if (sim_data) gdbsim_resume_inferior (find_inferior_ptid (ptid), &rd); - else if (ptid_equal (ptid, minus_one_ptid)) + else if (ptid == minus_one_ptid) iterate_over_inferiors (gdbsim_resume_inferior, &rd); else error (_("The program is not being run.")); @@ -1001,7 +1001,7 @@ gdbsim_target::wait (ptid_t ptid, struct target_waitstatus *status, int options) /* This target isn't able to (yet) resume more than one inferior at a time. When ptid is minus_one_ptid, just use the current inferior. If we're given an explicit pid, we'll try to find it and use that instead. */ - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) sim_data = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NEEDED); else @@ -1295,7 +1295,7 @@ gdbsim_target::thread_alive (ptid_t ptid) if (sim_data == NULL) return false; - if (ptid_equal (ptid, sim_data->remote_sim_ptid)) + if (ptid == sim_data->remote_sim_ptid) /* The simulators' task is always alive. */ return true; diff --git a/gdb/remote.c b/gdb/remote.c index c72060f..d5accc6 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2453,7 +2453,7 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, int executing) return; } - if (ptid_equal (magic_null_ptid, inferior_ptid)) + if (magic_null_ptid == inferior_ptid) { /* inferior_ptid is not set yet. This can happen with the vRun -> remote_wait,"TAAthread:" path if the stub @@ -2714,16 +2714,16 @@ remote_target::set_thread (ptid_t ptid, int gen) char *buf = rs->buf; char *endbuf = rs->buf + get_remote_packet_size (); - if (ptid_equal (state, ptid)) + if (state == ptid) return; *buf++ = 'H'; *buf++ = gen ? 'g' : 'c'; - if (ptid_equal (ptid, magic_null_ptid)) + if (ptid == magic_null_ptid) xsnprintf (buf, endbuf - buf, "0"); - else if (ptid_equal (ptid, any_thread_ptid)) + else if (ptid == any_thread_ptid) xsnprintf (buf, endbuf - buf, "0"); - else if (ptid_equal (ptid, minus_one_ptid)) + else if (ptid == minus_one_ptid) xsnprintf (buf, endbuf - buf, "-1"); else write_ptid (buf, endbuf, ptid); @@ -2778,7 +2778,7 @@ remote_target::set_general_process () static int remote_thread_always_alive (ptid_t ptid) { - if (ptid_equal (ptid, magic_null_ptid)) + if (ptid == magic_null_ptid) /* The main thread is always alive. */ return 1; @@ -2973,7 +2973,7 @@ read_ptid (const char *buf, const char **obuf) what's in inferior_ptid, unless it's null at this point. If so, then since there's no way to know the pid of the reported threads, use the magic number. */ - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) pid = magic_null_ptid.pid (); else pid = inferior_ptid.pid (); @@ -3838,7 +3838,7 @@ remote_target::extra_thread_info (thread_info *tp) internal_error (__FILE__, __LINE__, _("remote_threads_extra_info")); - if (ptid_equal (tp->ptid, magic_null_ptid) + if (tp->ptid == magic_null_ptid || (tp->ptid.pid () != 0 && tp->ptid.lwp () == 0)) /* This is the main thread which was added by GDB. The remote server doesn't know about it. */ @@ -4267,7 +4267,7 @@ remote_target::get_current_thread (char *wait_status) this point. */ if (wait_status != NULL) ptid = stop_reply_extract_thread (wait_status); - if (ptid_equal (ptid, null_ptid)) + if (ptid == null_ptid) ptid = remote_current_thread (inferior_ptid); return ptid; @@ -4686,7 +4686,7 @@ remote_target::start_remote (int from_tty, int extended_p) multi-threaded program, this will ideally be the thread that last reported an event before GDB disconnected. */ inferior_ptid = get_current_thread (wait_status); - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) { /* Odd... The target was able to list threads, but not tell us which thread was current (no "thread" @@ -6002,7 +6002,7 @@ remote_target::append_resumption (char *p, char *endp, { struct thread_info *tp; - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) { /* If we don't know about the target thread's tid, then we're resuming magic_null_ptid (see caller). */ @@ -6042,7 +6042,7 @@ remote_target::append_resumption (char *p, char *endp, p += xsnprintf (p, endp - p, ":"); p = write_ptid (p, endp, nptid); } - else if (!ptid_equal (ptid, minus_one_ptid)) + else if (ptid != minus_one_ptid) { p += xsnprintf (p, endp - p, ":"); p = write_ptid (p, endp, ptid); @@ -6076,7 +6076,7 @@ remote_target::append_pending_thread_resumptions (char *p, char *endp, ALL_NON_EXITED_THREADS (thread) if (thread->ptid.matches (ptid) - && !ptid_equal (inferior_ptid, thread->ptid) + && inferior_ptid != thread->ptid && thread->suspend.stop_signal != GDB_SIGNAL_0) { p = append_resumption (p, endp, thread->ptid, @@ -6104,7 +6104,7 @@ remote_target::remote_resume_with_hc (ptid_t ptid, int step, /* The c/s/C/S resume packets use Hc, so set the continue thread. */ - if (ptid_equal (ptid, minus_one_ptid)) + if (ptid == minus_one_ptid) set_continue_thread (any_thread_ptid); else set_continue_thread (ptid); @@ -6177,7 +6177,7 @@ remote_target::remote_resume_with_vcont (ptid_t ptid, int step, p += xsnprintf (p, endp - p, "vCont"); - if (ptid_equal (ptid, magic_null_ptid)) + if (ptid == magic_null_ptid) { /* MAGIC_NULL_PTID means that we don't have any active threads, so we don't have any TID numbers the inferior will @@ -6185,7 +6185,7 @@ remote_target::remote_resume_with_vcont (ptid_t ptid, int step, a TID. */ append_resumption (p, endp, minus_one_ptid, step, siggnal); } - else if (ptid_equal (ptid, minus_one_ptid) || ptid.is_pid ()) + else if (ptid == minus_one_ptid || ptid.is_pid ()) { /* Resume all threads (of all processes, or of a single process), with preference for INFERIOR_PTID. This assumes @@ -6244,7 +6244,7 @@ remote_target::resume (ptid_t ptid, int step, enum gdb_signal siggnal) { remote_thread_info *remote_thr; - if (ptid_equal (minus_one_ptid, ptid) || ptid.is_pid ()) + if (minus_one_ptid == ptid || ptid.is_pid ()) remote_thr = get_remote_thread_info (inferior_ptid); else remote_thr = get_remote_thread_info (ptid); @@ -6604,7 +6604,7 @@ remote_target::remote_stop_ns (ptid_t ptid) if (!rs->supports_vCont.t) error (_("Remote server does not support stopping threads")); - if (ptid_equal (ptid, minus_one_ptid) + if (ptid == minus_one_ptid || (!remote_multi_process_p (rs) && ptid.is_pid ())) p += xsnprintf (p, endp - p, "vCont;t"); else @@ -7539,7 +7539,7 @@ Packet: '%s'\n"), break; } - if (target_is_non_stop_p () && ptid_equal (event->ptid, null_ptid)) + if (target_is_non_stop_p () && event->ptid == null_ptid) error (_("No process or thread specified in stop reply: %s"), buf); } @@ -7643,7 +7643,7 @@ remote_target::process_stop_reply (struct stop_reply *stop_reply, /* If no thread/process was reported by the stub, assume the current inferior. */ - if (ptid_equal (ptid, null_ptid)) + if (ptid == null_ptid) ptid = inferior_ptid; if (status->kind != TARGET_WAITKIND_EXITED @@ -7875,7 +7875,7 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status, int options) else if (status->kind != TARGET_WAITKIND_EXITED && status->kind != TARGET_WAITKIND_SIGNALLED) { - if (!ptid_equal (event_ptid, null_ptid)) + if (event_ptid != null_ptid) record_currthread (rs, event_ptid); else event_ptid = inferior_ptid; @@ -11440,7 +11440,7 @@ remote_target::pid_to_str (ptid_t ptid) static char buf[64]; struct remote_state *rs = get_remote_state (); - if (ptid_equal (ptid, null_ptid)) + if (ptid == null_ptid) return normal_pid_to_str (ptid); else if (ptid.is_pid ()) { @@ -11465,7 +11465,7 @@ remote_target::pid_to_str (ptid_t ptid) } else { - if (ptid_equal (magic_null_ptid, ptid)) + if (magic_null_ptid == ptid) xsnprintf (buf, sizeof buf, "Thread <main>"); else if (remote_multi_process_p (rs)) if (ptid.lwp () == 0) @@ -11647,7 +11647,7 @@ remote_target::read_description () /* Do not try this during initial connection, when we do not know whether there is a running but stopped thread. */ - if (!target_has_execution || ptid_equal (inferior_ptid, null_ptid)) + if (!target_has_execution || inferior_ptid == null_ptid) return beneath ()->read_description (); if (!VEC_empty (remote_g_packet_guess_s, data->guesses)) diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 4bb9b34..a5980f1 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -461,7 +461,7 @@ sol_thread_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, /* See if we have a new thread. */ if (rtnval.tid_p () - && !ptid_equal (rtnval, save_ptid) + && rtnval != save_ptid && (!in_thread_list (rtnval) || is_exited (rtnval))) add_thread (rtnval); diff --git a/gdb/solib.c b/gdb/solib.c index 8f3a12c..e1d237e 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -735,7 +735,7 @@ update_solib_list (int from_tty) /* We can reach here due to changing solib-search-path or the sysroot, before having any inferior. */ - if (target_has_execution && !ptid_equal (inferior_ptid, null_ptid)) + if (target_has_execution && inferior_ptid != null_ptid) { struct inferior *inf = current_inferior (); diff --git a/gdb/target.c b/gdb/target.c index 1e32fc4..19d59ba 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -219,7 +219,7 @@ int default_child_has_all_memory () { /* If no inferior selected, then we can't read memory here. */ - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) return 0; return 1; @@ -229,7 +229,7 @@ int default_child_has_memory () { /* If no inferior selected, then we can't read memory here. */ - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) return 0; return 1; @@ -239,7 +239,7 @@ int default_child_has_stack () { /* If no inferior selected, there's no stack. */ - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) return 0; return 1; @@ -249,7 +249,7 @@ int default_child_has_registers () { /* Can't read registers from no inferior. */ - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) return 0; return 1; @@ -260,7 +260,7 @@ default_child_has_execution (ptid_t the_ptid) { /* If there's no thread selected, then we can't make it run through hoops. */ - if (ptid_equal (the_ptid, null_ptid)) + if (the_ptid == null_ptid) return 0; return 1; @@ -1052,7 +1052,7 @@ raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf, first, so that if it fails, we don't write to the cache contents that never made it to the target. */ if (writebuf != NULL - && !ptid_equal (inferior_ptid, null_ptid) + && inferior_ptid != null_ptid && target_dcache_init_p () && (stack_cache_enabled_p () || code_cache_enabled_p ())) { @@ -1127,7 +1127,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object, ®ion)) return TARGET_XFER_E_IO; - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) inf = current_inferior (); else inf = NULL; @@ -2229,7 +2229,7 @@ default_mourn_inferior (struct target_ops *self) void target_mourn_inferior (ptid_t ptid) { - gdb_assert (ptid_equal (ptid, inferior_ptid)); + gdb_assert (ptid == inferior_ptid); current_top_target ()->mourn_inferior (); /* We no longer need to keep handles on any of the object files. diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index 3667e40..07767bb 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -72,7 +72,7 @@ tui_make_status_line (struct tui_locator_element *loc) int pid_width; int line_width; - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) pid_name = "No process"; else pid_name = target_pid_to_str (inferior_ptid); diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 532d5fd..6986dc3 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1385,7 +1385,7 @@ windows_nat_target::resume (ptid_t ptid, int step, enum gdb_signal sig) DWORD continue_status = DBG_CONTINUE; /* A specific PTID means `step only this thread id'. */ - int resume_all = ptid_equal (ptid, minus_one_ptid); + int resume_all = ptid == minus_one_ptid; /* If we're continuing all threads, it's the current inferior that should be handled specially. */ diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 430d44b..41b9948 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -279,7 +279,7 @@ static const struct lval_funcs tlb_value_funcs = static struct value * tlb_make_value (struct gdbarch *gdbarch, struct internalvar *var, void *ignore) { - if (target_has_stack && !ptid_equal (inferior_ptid, null_ptid)) + if (target_has_stack && inferior_ptid != null_ptid) { struct type *type = windows_get_tlb_type (gdbarch); return allocate_computed_value (type, &tlb_value_funcs, NULL); @@ -367,7 +367,7 @@ display_one_tib (ptid_t ptid) static void display_tib (const char * args, int from_tty) { - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) display_one_tib (inferior_ptid); } |