diff options
author | Pedro Alves <palves@redhat.com> | 2017-12-06 17:45:09 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2017-12-06 17:49:37 -0500 |
commit | 649a140ccf129ff79ea55ac0cc23ebddec0f02ef (patch) | |
tree | 83e0dbe669695dd27fd9b8a4e7abe698dd3f287c /gdb/remote.c | |
parent | 9a93831ccc0ba3ba447552069f230e6d93dcbf3f (diff) | |
download | gdb-649a140ccf129ff79ea55ac0cc23ebddec0f02ef.zip gdb-649a140ccf129ff79ea55ac0cc23ebddec0f02ef.tar.gz gdb-649a140ccf129ff79ea55ac0cc23ebddec0f02ef.tar.bz2 |
target_set_syscall_catchpoint, use gdb::array_view and bool
I noticed that we're passing down a data/size pair to
target_ops::to_set_syscall_catchpoint. This commit makes use of
gdb::array_view instead. While at it, use bool where appropriate as
well.
gdb/ChangeLog:
* break-catch-syscall.c (insert_catch_syscall)
(remove_catch_syscall): Adjust to pass reference to
inf_data->syscalls_counts directly via gdb::array_view.
* fbsd-nat.c (fbsd_set_syscall_catchpoint): Adjust to use bool
and gdb::array_view.
* linux-nat.c (linux_child_set_syscall_catchpoint): Likewise.
* remote.c (remote_set_syscall_catchpoint): Likewise.
* target-debug.h (target_debug_print_bool): New.
(define target_debug_print_gdb_array_view_const_int): New.
* target-delegates.c: Regenerate.
* target.h (target_ops) <to_set_syscall_catchpoint>: Use
gdb::array_view and bool.
(target_set_syscall_catchpoint): Likewise.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 306cc1e..fe27713 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2024,8 +2024,8 @@ remote_pass_signals (struct target_ops *self, static int remote_set_syscall_catchpoint (struct target_ops *self, - int pid, int needed, int any_count, - int table_size, int *table) + int pid, bool needed, int any_count, + gdb::array_view<const int> syscall_counts) { const char *catch_packet; enum packet_result result; @@ -2037,14 +2037,12 @@ remote_set_syscall_catchpoint (struct target_ops *self, return 1; } - if (needed && !any_count) + if (needed && any_count == 0) { - int i; - - /* Count how many syscalls are to be caught (table[sysno] != 0). */ - for (i = 0; i < table_size; i++) + /* Count how many syscalls are to be caught. */ + for (size_t i = 0; i < syscall_counts.size (); i++) { - if (table[i] != 0) + if (syscall_counts[i] != 0) n_sysno++; } } @@ -2066,13 +2064,13 @@ remote_set_syscall_catchpoint (struct target_ops *self, const int maxpktsz = strlen ("QCatchSyscalls:1") + n_sysno * 9 + 1; built_packet.reserve (maxpktsz); built_packet = "QCatchSyscalls:1"; - if (!any_count) + if (any_count == 0) { - /* Add in catch_packet each syscall to be caught (table[i] != 0). */ - for (int i = 0; i < table_size; i++) + /* Add in each syscall to be caught. */ + for (size_t i = 0; i < syscall_counts.size (); i++) { - if (table[i] != 0) - string_appendf (built_packet, ";%x", i); + if (syscall_counts[i] != 0) + string_appendf (built_packet, ";%zx", i); } } if (built_packet.size () > get_remote_packet_size ()) |