From adc6a863a9c6c828425d63b12d553f0e8f21e350 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 24 Jan 2019 18:25:06 +0000 Subject: target_pass_signals/target_program_signals: Use gdb::array_view This replaces the pointer and length parameters of target_pass_signals and target_program_signals with a gdb::array_view parameter, and fixes the fallout. In infrun.c, the signal_stop, signal_print, signal_program, signal_catch, signal_pass globals are currently pointers to heap-allocated memory. I see no point in that, so I converted them to arrays. This allows simplifying the calls to target_pass_signals/target_program_signals, since we can pass the array directly, which can implicitly convert to gdb::array_view. gdb/ChangeLog: 2019-01-24 Pedro Alves * infrun.c (signal_stop, signal_print, signal_program) (signal_catch, signal_pass): Now arrays instead of pointers. (update_signals_program_target, do_target_resume) (signal_catch_update, handle_command, _initialize_infrun): Adjust. * linux-nat.c (linux_nat_target::pass_signals) (linux_nat_target::create_inferior, linux_nat_target::attach): Adjust. * linux-nat.h (linux_nat_target::pass_signals): Adjust. * nto-procfs.c (nto_procfs_target::pass_signals): Adjust. * procfs.c (procfs_target::pass_signals): Adjust. * record-full.c (record_full_target::resume): Adjust. * remote.c (remote_target::pass_signals) (remote_target::program_signals): Adjust. * target-debug.h (target_debug_print_signals): Now takes a gdb::array_view as parameter. Adjust. * target.h (target_ops) : Replace pointer and length parameters with gdb::array_view. (target_pass_signals, target_program_signals): Likewise. * target-delegates.c: Regenerate. --- gdb/target-debug.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'gdb/target-debug.h') diff --git a/gdb/target-debug.h b/gdb/target-debug.h index d51754a..d9f7d46 100644 --- a/gdb/target-debug.h +++ b/gdb/target-debug.h @@ -209,20 +209,16 @@ target_debug_print_options (int options) } static void -target_debug_print_signals (const unsigned char *sigs) +target_debug_print_signals (gdb::array_view sigs) { fputs_unfiltered ("{", gdb_stdlog); - if (sigs != NULL) - { - int i; - - for (i = 0; i < GDB_SIGNAL_LAST; i++) - if (sigs[i]) - { - fprintf_unfiltered (gdb_stdlog, " %s", - gdb_signal_to_name ((enum gdb_signal) i)); - } - } + + for (size_t i = 0; i < sigs.size (); i++) + if (sigs[i] != 0) + { + fprintf_unfiltered (gdb_stdlog, " %s", + gdb_signal_to_name ((enum gdb_signal) i)); + } fputs_unfiltered (" }", gdb_stdlog); } -- cgit v1.1