From f27866ba9c348a72a899f5a84dadf1f943c89720 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 17 Nov 2017 13:02:25 -0500 Subject: Make process_info::syscalls_to_catch an std::vector This patch makes the syscalls_to_catch field of process_info an std::vector. 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.. : Change type to std::vector. * 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. --- gdb/gdbserver/server.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gdb/gdbserver/server.c') diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index e827b9c..f0dac95 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -623,7 +623,7 @@ handle_general_set (char *own_buf) } process = current_process (); - VEC_truncate (int, process->syscalls_to_catch, 0); + process->syscalls_to_catch.clear (); if (enabled) { @@ -634,11 +634,11 @@ handle_general_set (char *own_buf) while (*p != '\0') { p = decode_address_to_semicolon (&sysno, p); - VEC_safe_push (int, process->syscalls_to_catch, (int) sysno); + process->syscalls_to_catch.push_back (sysno); } } else - VEC_safe_push (int, process->syscalls_to_catch, ANY_SYSCALL); + process->syscalls_to_catch.push_back (ANY_SYSCALL); } write_ok (own_buf); -- cgit v1.1