aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/inferiors.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2017-11-17 13:02:25 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2017-11-17 13:03:34 -0500
commitf27866ba9c348a72a899f5a84dadf1f943c89720 (patch)
tree3a04df530e654e382be4d2533db6969b8428d2b4 /gdb/gdbserver/inferiors.c
parent37269bc92ca6a79f9e56fe83718f3c86a1db845d (diff)
downloadgdb-f27866ba9c348a72a899f5a84dadf1f943c89720.zip
gdb-f27866ba9c348a72a899f5a84dadf1f943c89720.tar.gz
gdb-f27866ba9c348a72a899f5a84dadf1f943c89720.tar.bz2
Make process_info::syscalls_to_catch an std::vector
This patch makes the syscalls_to_catch field of process_info an std::vector<int>. The process_info structure must now be newed/deleted. In handle_extended_wait, the code that handles exec events destroys the existing process_info and creates a new one. It moves the content of syscalls_to_catch from the old to the new vector. I used std::move for that (through an intermediary variable), which should have the same behavior as the old code. gdb/gdbserver/ChangeLog: * inferiors.h (struct process_info): Add constructor, initialize fields.. <syscalls_to_catch>: Change type to std::vector<int>. * inferiors.c (add_process): Allocate process_info with new. (remove_process): Free process_info with delete. * linux-low.c (handle_extended_wait): Adjust. (gdb_catching_syscalls_p, gdb_catch_this_syscall_p): Adjust. * server.c (handle_general_set): Adjust.
Diffstat (limited to 'gdb/gdbserver/inferiors.c')
-rw-r--r--gdb/gdbserver/inferiors.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
index a0ece4d..f4101c7 100644
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -194,10 +194,7 @@ clear_inferiors (void)
struct process_info *
add_process (int pid, int attached)
{
- struct process_info *process = XCNEW (struct process_info);
-
- process->pid = pid;
- process->attached = attached;
+ process_info *process = new process_info (pid, attached);
all_processes.push_back (process);
@@ -215,8 +212,7 @@ remove_process (struct process_info *process)
free_all_breakpoints (process);
gdb_assert (find_thread_process (process) == NULL);
all_processes.remove (process);
- VEC_free (int, process->syscalls_to_catch);
- free (process);
+ delete process;
}
process_info *