aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/server.cc
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2021-11-22 11:27:31 -0500
committerSimon Marchi <simon.marchi@polymtl.ca>2021-11-22 13:57:54 -0500
commitc272a98cbf596ddf1a70a41801c6e86d9564d152 (patch)
tree366b8b105f8450dd1894aebbbae82b8e1946d249 /gdbserver/server.cc
parent06de25b7af21eb1173d7b86c5c0f37aae5ec2674 (diff)
downloadbinutils-c272a98cbf596ddf1a70a41801c6e86d9564d152.zip
binutils-c272a98cbf596ddf1a70a41801c6e86d9564d152.tar.gz
binutils-c272a98cbf596ddf1a70a41801c6e86d9564d152.tar.bz2
gdb: pass more const target_waitstatus by reference
While working on target_waitstatus changes, I noticed a few places where const target_waitstatus objects could be passed by reference instead of by pointers. And in some cases, places where a target_waitstatus could be passed as const, but was not. Convert them as much as possible. Change-Id: Ied552d464be5d5b87489913b95f9720a5ad50c5a
Diffstat (limited to 'gdbserver/server.cc')
-rw-r--r--gdbserver/server.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index 2807525..b1d4c92 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -173,12 +173,12 @@ get_client_state ()
/* Put a stop reply to the stop reply queue. */
static void
-queue_stop_reply (ptid_t ptid, struct target_waitstatus *status)
+queue_stop_reply (ptid_t ptid, const target_waitstatus &status)
{
struct vstop_notif *new_notif = new struct vstop_notif;
new_notif->ptid = ptid;
- new_notif->status = *status;
+ new_notif->status = status;
notif_event_enque (&notif_stop, new_notif);
}
@@ -225,7 +225,7 @@ vstop_notif_reply (struct notif_event *event, char *own_buf)
{
struct vstop_notif *vstop = (struct vstop_notif *) event;
- prepare_resume_reply (own_buf, vstop->ptid, &vstop->status);
+ prepare_resume_reply (own_buf, vstop->ptid, vstop->status);
}
/* Helper for in_queued_stop_replies. */
@@ -2795,7 +2795,7 @@ handle_pending_status (const struct thread_resume *resumption,
cs.last_status = thread->last_status;
cs.last_ptid = thread->id;
- prepare_resume_reply (cs.own_buf, cs.last_ptid, &cs.last_status);
+ prepare_resume_reply (cs.own_buf, cs.last_ptid, cs.last_status);
return 1;
}
return 0;
@@ -2963,7 +2963,7 @@ resume (struct thread_resume *actions, size_t num_actions)
so by now). Tag all threads as "want-stopped", so we don't
resume them implicitly without the client telling us to. */
gdb_wants_all_threads_stopped ();
- prepare_resume_reply (cs.own_buf, cs.last_ptid, &cs.last_status);
+ prepare_resume_reply (cs.own_buf, cs.last_ptid, cs.last_status);
disable_async_io ();
if (cs.last_status.kind () == TARGET_WAITKIND_EXITED
@@ -2996,7 +2996,7 @@ handle_v_attach (char *own_buf)
write_ok (own_buf);
}
else
- prepare_resume_reply (own_buf, cs.last_ptid, &cs.last_status);
+ prepare_resume_reply (own_buf, cs.last_ptid, cs.last_status);
}
else
write_enn (own_buf);
@@ -3114,7 +3114,7 @@ handle_v_run (char *own_buf)
if (cs.last_status.kind () == TARGET_WAITKIND_STOPPED)
{
- prepare_resume_reply (own_buf, cs.last_ptid, &cs.last_status);
+ prepare_resume_reply (own_buf, cs.last_ptid, cs.last_status);
/* In non-stop, sending a resume reply doesn't set the general
thread, but GDB assumes a vRun sets it (this is so GDB can
@@ -3313,7 +3313,7 @@ queue_stop_reply_callback (thread_info *thread)
/* Pass the last stop reply back to GDB, but don't notify
yet. */
- queue_stop_reply (thread->id, &thread->last_status);
+ queue_stop_reply (thread->id, thread->last_status);
}
}
}
@@ -3436,7 +3436,7 @@ handle_status (char *own_buf)
set_desired_thread ();
gdb_assert (tp->last_status.kind () != TARGET_WAITKIND_IGNORE);
- prepare_resume_reply (own_buf, tp->id, &tp->last_status);
+ prepare_resume_reply (own_buf, tp->id, tp->last_status);
}
else
strcpy (own_buf, "W00");
@@ -4562,11 +4562,11 @@ handle_serial_event (int err, gdb_client_data client_data)
/* Push a stop notification on the notification queue. */
static void
-push_stop_notification (ptid_t ptid, struct target_waitstatus *status)
+push_stop_notification (ptid_t ptid, const target_waitstatus &status)
{
struct vstop_notif *vstop_notif = new struct vstop_notif;
- vstop_notif->status = *status;
+ vstop_notif->status = status;
vstop_notif->ptid = ptid;
/* Push Stop notification. */
notif_push (&notif_stop, vstop_notif);
@@ -4587,7 +4587,7 @@ handle_target_event (int err, gdb_client_data client_data)
if (cs.last_status.kind () == TARGET_WAITKIND_NO_RESUMED)
{
if (gdb_connected () && report_no_resumed)
- push_stop_notification (null_ptid, &cs.last_status);
+ push_stop_notification (null_ptid, cs.last_status);
}
else if (cs.last_status.kind () != TARGET_WAITKIND_IGNORE)
{
@@ -4645,7 +4645,7 @@ handle_target_event (int err, gdb_client_data client_data)
}
}
else
- push_stop_notification (cs.last_ptid, &cs.last_status);
+ push_stop_notification (cs.last_ptid, cs.last_status);
}
/* Be sure to not change the selected thread behind GDB's back.