forked from Imagelibrary/binutils-gdb
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
This commit is contained in:
committed by
Simon Marchi
parent
06de25b7af
commit
c272a98cbf
@@ -1081,15 +1081,14 @@ outreg (struct regcache *regcache, int regno, char *buf)
|
||||
}
|
||||
|
||||
void
|
||||
prepare_resume_reply (char *buf, ptid_t ptid,
|
||||
struct target_waitstatus *status)
|
||||
prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
|
||||
{
|
||||
client_state &cs = get_client_state ();
|
||||
if (debug_threads)
|
||||
debug_printf ("Writing resume reply for %s:%d\n",
|
||||
target_pid_to_str (ptid).c_str (), status->kind ());
|
||||
target_pid_to_str (ptid).c_str (), status.kind ());
|
||||
|
||||
switch (status->kind ())
|
||||
switch (status.kind ())
|
||||
{
|
||||
case TARGET_WAITKIND_STOPPED:
|
||||
case TARGET_WAITKIND_FORKED:
|
||||
@@ -1104,27 +1103,27 @@ prepare_resume_reply (char *buf, ptid_t ptid,
|
||||
const char **regp;
|
||||
struct regcache *regcache;
|
||||
|
||||
if ((status->kind () == TARGET_WAITKIND_FORKED && cs.report_fork_events)
|
||||
|| (status->kind () == TARGET_WAITKIND_VFORKED
|
||||
if ((status.kind () == TARGET_WAITKIND_FORKED && cs.report_fork_events)
|
||||
|| (status.kind () == TARGET_WAITKIND_VFORKED
|
||||
&& cs.report_vfork_events))
|
||||
{
|
||||
enum gdb_signal signal = GDB_SIGNAL_TRAP;
|
||||
const char *event = (status->kind () == TARGET_WAITKIND_FORKED
|
||||
const char *event = (status.kind () == TARGET_WAITKIND_FORKED
|
||||
? "fork" : "vfork");
|
||||
|
||||
sprintf (buf, "T%02x%s:", signal, event);
|
||||
buf += strlen (buf);
|
||||
buf = write_ptid (buf, status->child_ptid ());
|
||||
buf = write_ptid (buf, status.child_ptid ());
|
||||
strcat (buf, ";");
|
||||
}
|
||||
else if (status->kind () == TARGET_WAITKIND_VFORK_DONE
|
||||
else if (status.kind () == TARGET_WAITKIND_VFORK_DONE
|
||||
&& cs.report_vfork_events)
|
||||
{
|
||||
enum gdb_signal signal = GDB_SIGNAL_TRAP;
|
||||
|
||||
sprintf (buf, "T%02xvforkdone:;", signal);
|
||||
}
|
||||
else if (status->kind () == TARGET_WAITKIND_EXECD && cs.report_exec_events)
|
||||
else if (status.kind () == TARGET_WAITKIND_EXECD && cs.report_exec_events)
|
||||
{
|
||||
enum gdb_signal signal = GDB_SIGNAL_TRAP;
|
||||
const char *event = "exec";
|
||||
@@ -1134,32 +1133,32 @@ prepare_resume_reply (char *buf, ptid_t ptid,
|
||||
buf += strlen (buf);
|
||||
|
||||
/* Encode pathname to hexified format. */
|
||||
bin2hex ((const gdb_byte *) status->execd_pathname (),
|
||||
bin2hex ((const gdb_byte *) status.execd_pathname (),
|
||||
hexified_pathname,
|
||||
strlen (status->execd_pathname ()));
|
||||
strlen (status.execd_pathname ()));
|
||||
|
||||
sprintf (buf, "%s;", hexified_pathname);
|
||||
buf += strlen (buf);
|
||||
}
|
||||
else if (status->kind () == TARGET_WAITKIND_THREAD_CREATED
|
||||
else if (status.kind () == TARGET_WAITKIND_THREAD_CREATED
|
||||
&& cs.report_thread_events)
|
||||
{
|
||||
enum gdb_signal signal = GDB_SIGNAL_TRAP;
|
||||
|
||||
sprintf (buf, "T%02xcreate:;", signal);
|
||||
}
|
||||
else if (status->kind () == TARGET_WAITKIND_SYSCALL_ENTRY
|
||||
|| status->kind () == TARGET_WAITKIND_SYSCALL_RETURN)
|
||||
else if (status.kind () == TARGET_WAITKIND_SYSCALL_ENTRY
|
||||
|| status.kind () == TARGET_WAITKIND_SYSCALL_RETURN)
|
||||
{
|
||||
enum gdb_signal signal = GDB_SIGNAL_TRAP;
|
||||
const char *event = (status->kind () == TARGET_WAITKIND_SYSCALL_ENTRY
|
||||
const char *event = (status.kind () == TARGET_WAITKIND_SYSCALL_ENTRY
|
||||
? "syscall_entry" : "syscall_return");
|
||||
|
||||
sprintf (buf, "T%02x%s:%x;", signal, event,
|
||||
status->syscall_number ());
|
||||
status.syscall_number ());
|
||||
}
|
||||
else
|
||||
sprintf (buf, "T%02x", status->sig ());
|
||||
sprintf (buf, "T%02x", status.sig ());
|
||||
|
||||
if (disable_packet_T)
|
||||
{
|
||||
@@ -1281,19 +1280,19 @@ prepare_resume_reply (char *buf, ptid_t ptid,
|
||||
case TARGET_WAITKIND_EXITED:
|
||||
if (cs.multi_process)
|
||||
sprintf (buf, "W%x;process:%x",
|
||||
status->exit_status (), ptid.pid ());
|
||||
status.exit_status (), ptid.pid ());
|
||||
else
|
||||
sprintf (buf, "W%02x", status->exit_status ());
|
||||
sprintf (buf, "W%02x", status.exit_status ());
|
||||
break;
|
||||
case TARGET_WAITKIND_SIGNALLED:
|
||||
if (cs.multi_process)
|
||||
sprintf (buf, "X%x;process:%x",
|
||||
status->sig (), ptid.pid ());
|
||||
status.sig (), ptid.pid ());
|
||||
else
|
||||
sprintf (buf, "X%02x", status->sig ());
|
||||
sprintf (buf, "X%02x", status.sig ());
|
||||
break;
|
||||
case TARGET_WAITKIND_THREAD_EXITED:
|
||||
sprintf (buf, "w%x;", status->exit_status ());
|
||||
sprintf (buf, "w%x;", status.exit_status ());
|
||||
buf += strlen (buf);
|
||||
buf = write_ptid (buf, ptid);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user