From patchwork Wed Jun 13 21:50:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 27821 Received: (qmail 43677 invoked by alias); 13 Jun 2018 21:51:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 43551 invoked by uid 89); 13 Jun 2018 21:51:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.0 required=5.0 tests=GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, TIME_LIMIT_EXCEEDED, UNSUBSCRIBE_BODY autolearn=unavailable version=3.3.2 spammy=star, quietly X-HELO: gateway31.websitewelcome.com Received: from gateway31.websitewelcome.com (HELO gateway31.websitewelcome.com) (192.185.143.33) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Jun 2018 21:51:19 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 033993022 for ; Wed, 13 Jun 2018 16:51:17 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id TDfLfaBBzBcCXTDfSfP5h1; Wed, 13 Jun 2018 16:51:17 -0500 X-Authority-Reason: nr=8 Received: from [12.176.89.6] (port=50304 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fTDfK-001rOd-KG; Wed, 13 Jun 2018 16:50:54 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 10/10] Remove ptid_equal Date: Wed, 13 Jun 2018 14:50:49 -0700 Message-Id: <20180613215049.9691-11-tom@tromey.com> In-Reply-To: <20180613215049.9691-1-tom@tromey.com> References: <20180613215049.9691-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fTDfK-001rOd-KG X-Source-Sender: (localhost.localdomain) [12.176.89.6]:50304 X-Source-Auth: tom+tromey.com X-Email-Count: 11 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes Remove ptid_equal in favor of using "==". ChangeLog 2018-06-13 Tom Tromey * 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. gdbserver/ChangeLog 2018-06-13 Tom Tromey * 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. --- gdb/ChangeLog | 48 +++++++++++++++++++++++++++++ gdb/ada-tasks.c | 7 ++--- gdb/breakpoint.c | 18 +++++------ gdb/common/agent.c | 2 +- gdb/common/ptid.c | 8 ----- gdb/common/ptid.h | 8 ----- gdb/corelow.c | 2 +- gdb/darwin-nat-info.c | 10 +++--- gdb/darwin-nat.c | 8 ++--- gdb/dcache.c | 4 +-- gdb/dtrace-probe.c | 4 +-- gdb/dummy-frame.c | 4 +-- gdb/fbsd-nat.c | 6 ++-- gdb/frame.c | 2 +- gdb/gdbserver/ChangeLog | 12 ++++++++ gdb/gdbserver/linux-low.c | 20 ++++++------ gdb/gdbserver/lynx-low.c | 6 ++-- gdb/gdbserver/mem-break.c | 12 +++----- gdb/gdbserver/nto-low.c | 4 +-- gdb/gdbserver/remote-utils.c | 2 +- gdb/gdbserver/server.c | 26 ++++++++-------- gdb/gdbserver/spu-low.c | 6 ++-- gdb/gdbserver/target.c | 4 +-- gdb/gdbserver/win32-low.c | 4 +-- gdb/gdbthread.h | 2 +- gdb/gnu-nat.c | 8 ++--- gdb/go32-nat.c | 2 +- gdb/inf-loop.c | 2 +- gdb/inf-ptrace.c | 2 +- gdb/infcall.c | 4 +-- gdb/infcmd.c | 12 ++++---- gdb/inflow.c | 2 +- gdb/infrun.c | 72 +++++++++++++++++++++---------------------- gdb/linux-fork.c | 18 +++++------ gdb/linux-nat.c | 8 ++--- gdb/linux-thread-db.c | 2 +- gdb/mi/mi-cmd-var.c | 2 +- gdb/mi/mi-interp.c | 4 +-- gdb/mi/mi-main.c | 10 +++--- gdb/nto-procfs.c | 10 +++--- gdb/ppc-linux-tdep.c | 2 +- gdb/procfs.c | 8 ++--- gdb/python/py-inferior.c | 2 +- gdb/python/py-record-btrace.c | 6 ++-- gdb/python/py-record.c | 4 +-- gdb/ravenscar-thread.c | 6 ++-- gdb/regcache.c | 6 ++-- gdb/remote-sim.c | 8 ++--- gdb/remote.c | 48 ++++++++++++++--------------- gdb/sol-thread.c | 2 +- gdb/solib.c | 2 +- gdb/target.c | 18 +++++------ gdb/tui/tui-stack.c | 2 +- gdb/varobj.c | 2 +- gdb/windows-nat.c | 2 +- gdb/windows-tdep.c | 4 +-- 56 files changed, 274 insertions(+), 235 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5cbd26d247..901d32e812 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,51 @@ +2018-06-13 Tom Tromey + + * 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-06-13 Tom Tromey * common/ptid.c (ptid_match): Remove. diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index a75aa0f9f1..c927a48197 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -302,8 +302,7 @@ ada_get_task_number (ptid_t ptid) 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, - ptid)) + if (VEC_index (ada_task_info_s, data->task_list, i)->ptid == 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 85da620b40..78dbe61d8a 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 && !is_executing (inferior_ptid)))); } @@ -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, @@ -4332,7 +4332,7 @@ bpstat_clear_actions (void) struct thread_info *tp; bpstat bs; - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) return; tp = find_thread_ptid (inferior_ptid); @@ -4351,7 +4351,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 (); @@ -4472,7 +4472,7 @@ bpstat_do_actions (void) struct cleanup *cleanup_if_error = make_bpstat_clear_actions_cleanup (); /* Do any commands attached to breakpoint we are stopped at. */ - while (!ptid_equal (inferior_ptid, null_ptid) + while (inferior_ptid != null_ptid && target_has_execution && !is_exited (inferior_ptid) && !is_executing (inferior_ptid)) @@ -7779,7 +7779,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 ()); @@ -7894,7 +7894,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 65d5f1938b..8f80aee533 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 b9a331ad5e..22d79e2e41 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 2fc84b9c85..03f532185a 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 51330bb7ff..b9a65a40cb 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -446,7 +446,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 e68637fc0d..f3c8de286a 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 7f6441d273..709731f10f 100644 --- a/gdb/darwin-nat.c +++ b/gdb/darwin-nat.c @@ -940,7 +940,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; @@ -1242,7 +1242,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. */ @@ -1515,7 +1515,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); @@ -2206,7 +2206,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 20b781fa01..f72b348cf1 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 71530aa909..fa4e06e794 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/dummy-frame.c b/gdb/dummy-frame.c index 82e7251cce..a5558812b0 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -46,7 +46,7 @@ static int dummy_frame_id_eq (struct dummy_frame_id *id1, struct dummy_frame_id *id2) { - return frame_id_eq (id1->id, id2->id) && ptid_equal (id1->ptid, id2->ptid); + return frame_id_eq (id1->id, id2->id) && id1->ptid == id2->ptid; } /* List of dummy_frame destructors. */ @@ -154,7 +154,7 @@ pop_dummy_frame (struct dummy_frame **dummy_ptr) { struct dummy_frame *dummy = *dummy_ptr; - gdb_assert (ptid_equal (dummy->id.ptid, inferior_ptid)); + gdb_assert (dummy->id.ptid == inferior_ptid); while (dummy->dtor_list != NULL) { diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 2f7560b067..38b472a0e3 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; @@ -1344,7 +1344,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/frame.c b/gdb/frame.c index d8309e7407..3c1ee92903 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1624,7 +1624,7 @@ has_stack_frames (void) if (get_traceframe_number () < 0) { /* No current inferior, no frame. */ - if (ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid == null_ptid) return 0; /* Don't try to read from a dead thread. */ diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 137e1cc4de..42b34f5a98 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,15 @@ +2018-06-13 Tom Tromey + + * 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-06-13 Tom Tromey * server.c: Update. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index cef528bbb2..6e026f1aab 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 8d79ab17ed..b68bbeaf20 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 7ad8c48d62..447afc7c10 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 21f6da61c1..236e555714 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 ac57ce53fd..45d5c8d451 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 3c58c6eb10..e5d226c1a4 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 b3980e72bc..e9fc6e7beb 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 81d7cc471a..00379bfdc0 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), ""); - else if (ptid_equal (ptid, null_ptid)) + else if (ptid == null_ptid) xsnprintf (buf, sizeof (buf), ""); 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 53b843b3ba..8a20972bd4 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 09ea5baf23..73941c3150 100644 --- a/gdb/gdbthread.h +++ b/gdb/gdbthread.h @@ -208,7 +208,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); } struct thread_info *next = NULL; diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index f256a823b1..a886c2b80c 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 0120cbf7d2..732551630b 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -990,7 +990,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 bb6ad25bb7..2aa6816994 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 d1c9a90e37..90ea679689 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 c20ab6f877..edfee72514 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -657,7 +657,7 @@ run_inferior_call (struct call_thread_fsm *sm, evaluates true and thus we'll present a user-visible stop is decided elsewhere. */ if (!was_running - && ptid_equal (call_thread_ptid, inferior_ptid) + && call_thread_ptid == inferior_ptid && stop_stack_dummy == STOP_STACK_DUMMY) finish_thread_state (user_visible_resume_ptid (0)); @@ -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 32c968c6d9..862994738f 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -510,7 +510,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. */ @@ -735,7 +735,7 @@ proceed_thread_callback (struct thread_info *thread, void *arg) static void ensure_valid_thread (void) { - if (ptid_equal (inferior_ptid, null_ptid) + if (inferior_ptid == null_ptid || is_exited (inferior_ptid)) error (_("Cannot execute this command without a live selected thread.")); } @@ -1351,7 +1351,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; @@ -2094,7 +2094,7 @@ info_program_command (const char *args, int from_tty) get_last_target_status (&ptid, &ws); } - if (ptid_equal (ptid, null_ptid) || is_exited (ptid)) + if (ptid == null_ptid || is_exited (ptid)) error (_("Invalid selected thread.")); else if (is_running (ptid)) error (_("Selected thread is running.")); @@ -2591,7 +2591,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.")); @@ -2998,7 +2998,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 7bcefdcdc6..a3b5ba8abe 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 6e47fbd07e..0211df1412 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -689,8 +689,8 @@ follow_fork (void) /* Check if we switched over from WAIT_PTID, since the event was reported. */ - if (!ptid_equal (wait_ptid, minus_one_ptid) - && !ptid_equal (inferior_ptid, wait_ptid)) + if (wait_ptid != minus_one_ptid + && inferior_ptid != wait_ptid) { /* We did. Switch back to WAIT_PTID thread, to tell the target to follow it (in either direction). We'll @@ -1129,7 +1129,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->ptid); /* We also need to clear any left over stale state for the @@ -1542,7 +1542,7 @@ displaced_step_in_progress_any_inferior (void) for (state = displaced_step_inferior_states; state != NULL; state = state->next) - if (!ptid_equal (state->step_ptid, null_ptid)) + if (state->step_ptid != null_ptid) return 1; return 0; @@ -1556,11 +1556,11 @@ displaced_step_in_progress_thread (ptid_t ptid) { struct displaced_step_inferior_state *displaced; - gdb_assert (!ptid_equal (ptid, null_ptid)); + gdb_assert (ptid != null_ptid); displaced = get_displaced_stepping_state (ptid.pid ()); - return (displaced != NULL && ptid_equal (displaced->step_ptid, ptid)); + return (displaced != NULL && displaced->step_ptid == ptid); } /* Return true if process PID has a thread doing a displaced step. */ @@ -1571,7 +1571,7 @@ displaced_step_in_progress (int pid) struct displaced_step_inferior_state *displaced; displaced = get_displaced_stepping_state (pid); - if (displaced != NULL && !ptid_equal (displaced->step_ptid, null_ptid)) + if (displaced != NULL && displaced->step_ptid != null_ptid) return 1; return 0; @@ -1611,7 +1611,7 @@ get_displaced_step_closure_by_addr (CORE_ADDR addr) = get_displaced_stepping_state (inferior_ptid.pid ()); /* If checking the mode of displaced instruction in copy area. */ - if (displaced && !ptid_equal (displaced->step_ptid, null_ptid) + if (displaced && displaced->step_ptid != null_ptid && (displaced->step_copy == addr)) return displaced->step_closure; @@ -1777,7 +1777,7 @@ displaced_step_prepare_throw (ptid_t ptid) displaced = add_displaced_stepping_state (ptid.pid ()); - if (!ptid_equal (displaced->step_ptid, null_ptid)) + if (displaced->step_ptid != null_ptid) { /* Already waiting for a displaced step to finish. Defer this request and place in queue. */ @@ -1972,8 +1972,8 @@ displaced_step_fixup (ptid_t event_ptid, enum gdb_signal signal) return 0; /* Was this event for the pid we displaced? */ - if (ptid_equal (displaced->step_ptid, null_ptid) - || ! ptid_equal (displaced->step_ptid, event_ptid)) + if (displaced->step_ptid == null_ptid + || displaced->step_ptid != event_ptid) return 0; old_cleanups = make_cleanup (displaced_step_clear_cleanup, displaced); @@ -2177,14 +2177,14 @@ 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; for (displaced = displaced_step_inferior_states; displaced; displaced = displaced->next) { - if (ptid_equal (displaced->step_ptid, old_ptid)) + if (displaced->step_ptid == old_ptid) displaced->step_ptid = new_ptid; } } @@ -2892,7 +2892,7 @@ clear_proceed_status (int step) } } - if (!ptid_equal (inferior_ptid, null_ptid)) + if (inferior_ptid != null_ptid) { struct inferior *inferior; @@ -3345,7 +3345,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 (); } @@ -3370,7 +3370,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 ()) @@ -3502,7 +3502,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); } @@ -3637,7 +3637,7 @@ prepare_for_detach (void) /* Is any thread of this process displaced stepping? If not, there's nothing else to do. */ - if (displaced == NULL || ptid_equal (displaced->step_ptid, null_ptid)) + if (displaced == NULL || displaced->step_ptid == null_ptid) return; if (debug_infrun) @@ -3646,7 +3646,7 @@ prepare_for_detach (void) scoped_restore restore_detaching = make_scoped_restore (&inf->detaching, true); - while (!ptid_equal (displaced->step_ptid, null_ptid)) + while (displaced->step_ptid != null_ptid) { struct execution_control_state ecss; struct execution_control_state *ecs; @@ -3990,7 +3990,7 @@ fetch_inferior_event (void *client_data) if (cmd_done && exec_done_display_p - && (ptid_equal (inferior_ptid, null_ptid) + && (inferior_ptid == null_ptid || !is_running (inferior_ptid))) printf_unfiltered (_("completed.\n")); } @@ -4051,7 +4051,7 @@ nullify_last_target_wait_ptid (void) static void context_switch (ptid_t ptid) { - if (debug_infrun && !ptid_equal (ptid, inferior_ptid)) + if (debug_infrun && ptid != inferior_ptid) { fprintf_unfiltered (gdb_stdlog, "infrun: Switching context from %s ", target_pid_to_str (inferior_ptid)); @@ -4253,7 +4253,7 @@ handle_syscall_event (struct execution_control_state *ecs) struct regcache *regcache; int syscall_number; - if (!ptid_equal (ecs->ptid, inferior_ptid)) + if (ecs->ptid != inferior_ptid) context_switch (ecs->ptid); regcache = get_thread_regcache (ecs->ptid); @@ -4940,7 +4940,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs) case TARGET_WAITKIND_LOADED: if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_LOADED\n"); - if (!ptid_equal (ecs->ptid, inferior_ptid)) + if (ecs->ptid != inferior_ptid) context_switch (ecs->ptid); /* Ignore gracefully during startup of the inferior, as it might be the shell which has just loaded some objects, otherwise @@ -5021,7 +5021,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs) fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SPURIOUS\n"); if (handle_stop_requested (ecs)) return; - if (!ptid_equal (ecs->ptid, inferior_ptid)) + if (ecs->ptid != inferior_ptid) context_switch (ecs->ptid); resume (GDB_SIGNAL_0); prepare_to_wait (ecs); @@ -5032,7 +5032,7 @@ handle_inferior_event_1 (struct execution_control_state *ecs) fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_THREAD_CREATED\n"); if (handle_stop_requested (ecs)) return; - if (!ptid_equal (ecs->ptid, inferior_ptid)) + if (ecs->ptid != inferior_ptid) context_switch (ecs->ptid); if (!switch_back_to_stepped_thread (ecs)) keep_going (ecs); @@ -5181,7 +5181,7 @@ Cannot fill $_exitsignal with the correct signal number.\n")); } } - if (!ptid_equal (ecs->ptid, inferior_ptid)) + if (ecs->ptid != inferior_ptid) context_switch (ecs->ptid); /* Immediately detach breakpoints from the child before there's @@ -5288,7 +5288,7 @@ Cannot fill $_exitsignal with the correct signal number.\n")); fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_VFORK_DONE\n"); - if (!ptid_equal (ecs->ptid, inferior_ptid)) + if (ecs->ptid != inferior_ptid) context_switch (ecs->ptid); current_inferior ()->waiting_for_vfork_done = 0; @@ -5309,7 +5309,7 @@ Cannot fill $_exitsignal with the correct signal number.\n")); /* Note we can't read registers yet (the stop_pc), because we don't yet know the inferior's post-exec architecture. 'stop_pc' is explicitly read below instead. */ - if (!ptid_equal (ecs->ptid, inferior_ptid)) + if (ecs->ptid != inferior_ptid) switch_to_thread_no_regs (ecs->event_thread); /* Do whatever is necessary to the parent branch of the vfork. */ @@ -5385,7 +5385,7 @@ Cannot fill $_exitsignal with the correct signal number.\n")); /* Reverse execution: target ran out of history info. */ /* Switch to the stopped thread. */ - if (!ptid_equal (ecs->ptid, inferior_ptid)) + if (ecs->ptid != inferior_ptid) context_switch (ecs->ptid); if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: stopped\n"); @@ -5716,7 +5716,7 @@ handle_signal_stop (struct execution_control_state *ecs) stop_soon = get_inferior_stop_soon (ecs->ptid); if (stop_soon == STOP_QUIETLY || stop_soon == STOP_QUIETLY_REMOTE) { - if (!ptid_equal (ecs->ptid, inferior_ptid)) + if (ecs->ptid != inferior_ptid) context_switch (ecs->ptid); if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: quietly stopped\n"); @@ -5758,7 +5758,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"); @@ -7680,7 +7680,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. */ @@ -8131,7 +8131,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. */ @@ -8163,7 +8163,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; @@ -8344,7 +8344,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 @@ -8796,7 +8796,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 4049021d26..25c716bb53 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; @@ -461,7 +461,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); @@ -514,10 +514,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")); @@ -554,10 +554,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")); @@ -591,7 +591,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 29a8612f12..57611bd7e0 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1691,7 +1691,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. */ @@ -3383,7 +3383,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); @@ -3577,7 +3577,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; @@ -3851,7 +3851,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 20fe6c95a0..593ff1f322 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -1788,7 +1788,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-cmd-var.c b/gdb/mi/mi-cmd-var.c index 38c59c7e66..670b5e59aa 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -605,7 +605,7 @@ mi_cmd_var_update_iter (struct varobj *var, void *data_pointer) thread_id = varobj_get_thread_id (var); if (thread_id == -1 - && (ptid_equal (inferior_ptid, null_ptid) + && (inferior_ptid == null_ptid || is_stopped (inferior_ptid))) thread_stopped = 1; else diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index dcfee30907..d58d1a4527 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -688,7 +688,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 (); @@ -1031,7 +1031,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 10d886ced9..da26e65df6 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -571,7 +571,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); @@ -2006,11 +2006,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 d140068c05..117edb161c 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 f26882fe3c..82fed3f0eb 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 aa4498af90..d799f5c2a1 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/python/py-inferior.c b/gdb/python/py-inferior.c index c3aa62d350..95c8c13461 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -319,7 +319,7 @@ find_thread_object (ptid_t ptid) for (thread = ((inferior_object *)(inf_obj.get ()))->threads; thread; thread = thread->next) - if (ptid_equal (thread->thread_obj->thread->ptid, ptid)) + if (thread->thread_obj->thread->ptid == ptid) return thread->thread_obj; return NULL; diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c index d78df7f790..b5dc78ba6b 100644 --- a/gdb/python/py-record-btrace.c +++ b/gdb/python/py-record-btrace.c @@ -524,7 +524,7 @@ btpy_list_position (PyObject *self, PyObject *value) if (list_obj->element_type != Py_TYPE (value)) return -1; - if (!ptid_equal (list_obj->ptid, obj->ptid)) + if (list_obj->ptid != obj->ptid) return -1; if (index < list_obj->first || index > list_obj->last) @@ -590,7 +590,7 @@ btpy_list_richcompare (PyObject *self, PyObject *other, int op) switch (op) { case Py_EQ: - if (ptid_equal (obj1->ptid, obj2->ptid) + if (obj1->ptid == obj2->ptid && obj1->element_type == obj2->element_type && obj1->first == obj2->first && obj1->last == obj2->last @@ -600,7 +600,7 @@ btpy_list_richcompare (PyObject *self, PyObject *other, int op) Py_RETURN_FALSE; case Py_NE: - if (!ptid_equal (obj1->ptid, obj2->ptid) + if (obj1->ptid != obj2->ptid || obj1->element_type != obj2->element_type || obj1->first != obj2->first || obj1->last != obj2->last diff --git a/gdb/python/py-record.c b/gdb/python/py-record.c index 9437cfb12c..6815d72f43 100644 --- a/gdb/python/py-record.c +++ b/gdb/python/py-record.c @@ -405,7 +405,7 @@ recpy_element_richcompare (PyObject *self, PyObject *other, int op) switch (op) { case Py_EQ: - if (ptid_equal (obj1->ptid, obj2->ptid) + if (obj1->ptid == obj2->ptid && obj1->method == obj2->method && obj1->number == obj2->number) Py_RETURN_TRUE; @@ -413,7 +413,7 @@ recpy_element_richcompare (PyObject *self, PyObject *other, int op) Py_RETURN_FALSE; case Py_NE: - if (!ptid_equal (obj1->ptid, obj2->ptid) + if (obj1->ptid != obj2->ptid || obj1->method != obj2->method || obj1->number != obj2->number) Py_RETURN_TRUE; diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 0e6b9eb88c..8bd31a5a72 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 f1f2e9e176..03e7ae48d2 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -361,7 +361,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); @@ -386,7 +386,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); @@ -424,7 +424,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 def1bd5830..6923024e68 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 @@ -1296,7 +1296,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 2d748c7268..625bcf84ab 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2449,7 +2449,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 @@ -2712,16 +2712,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); @@ -2776,7 +2776,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; @@ -2971,7 +2971,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. */ @@ -4269,7 +4269,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; @@ -4689,7 +4689,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" @@ -6004,7 +6004,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). */ @@ -6044,7 +6044,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); @@ -6078,7 +6078,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, @@ -6106,7 +6106,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); @@ -6179,7 +6179,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 @@ -6187,7 +6187,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 @@ -6246,7 +6246,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); @@ -6606,7 +6606,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 @@ -7541,7 +7541,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); } @@ -7645,7 +7645,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 @@ -7877,7 +7877,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; @@ -11442,7 +11442,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 ()) { @@ -11467,7 +11467,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
"); else if (remote_multi_process_p (rs)) if (ptid.lwp () == 0) @@ -11649,7 +11649,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 4bb9b34ae5..a5980f199e 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 8f3a12cddb..e1d237e5a4 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 278e9aa4b6..45cf6316f3 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 = find_inferior_ptid (inferior_ptid); else inf = NULL; @@ -2230,7 +2230,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. @@ -3262,7 +3262,7 @@ generic_mourn_inferior (void) fail, since the inferior is long gone). */ mark_breakpoints_out (); - if (!ptid_equal (ptid, null_ptid)) + if (ptid != null_ptid) { int pid = ptid.pid (); exit_inferior (pid); diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index 3667e40208..07767bbb82 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/varobj.c b/gdb/varobj.c index a0df485ae9..1ee11051ef 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -2124,7 +2124,7 @@ value_of_root_1 (struct varobj **var_handle) { ptid_t ptid = global_thread_id_to_ptid (var->root->thread_id); - if (!ptid_equal (minus_one_ptid, ptid)) + if (minus_one_ptid != ptid) { switch_to_thread (ptid); within_scope = check_scope (var); diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 08652a6754..9f594d806c 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1364,7 +1364,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 430d44b2ed..41b9948f6d 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); }