aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/target.cc
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2020-02-17 16:12:03 +0100
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>2020-02-20 17:35:20 +0100
commit478f9adff55f3b03d935d1384f6ee3597969c448 (patch)
treeea1a888e644ba4cc1c903712bcdf996d62feca15 /gdbserver/target.cc
parentd633e8314093fd3ae9a5aec4fc25d86ebaea6ae8 (diff)
downloadgdb-478f9adff55f3b03d935d1384f6ee3597969c448.zip
gdb-478f9adff55f3b03d935d1384f6ee3597969c448.tar.gz
gdb-478f9adff55f3b03d935d1384f6ee3597969c448.tar.bz2
gdbserver: simply copy the pointer in 'set_target_ops'
The 'set_target_ops' function takes a target op vector and creates a clone of it via XNEW and memcpy. This is not necessary. 'the_target' is a singleton, and the argument that is passed to 'set_target_ops' is always the address of a global, static object. Therefore, update the implementation to simply copy the pointer. gdbserver/ChangeLog: 2020-02-20 Pedro Alves <palves@redhat.com> * target.cc (set_target_ops): Simply copy the given target pointer instead of creating a copy of the pointed object.
Diffstat (limited to 'gdbserver/target.cc')
-rw-r--r--gdbserver/target.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/gdbserver/target.cc b/gdbserver/target.cc
index 4df1f9d..d0a7d36 100644
--- a/gdbserver/target.cc
+++ b/gdbserver/target.cc
@@ -270,8 +270,7 @@ target_supports_multi_process (void)
void
set_target_ops (process_stratum_target *target)
{
- the_target = XNEW (process_stratum_target);
- memcpy (the_target, target, sizeof (*the_target));
+ the_target = target;
}
/* Convert pid to printable format. */