On 8/23/23 17:43, Pedro Alves wrote: > On 22/08/23 18:34, Tom de Vries wrote: > >> I've given the gdb::array_view a try, and that works fine, and greatly simplifies the patch, so thanks for that suggestion. > > Great! > >> The first patch is no longer necessary, but we could consider committing it nevertheless, since the work is done and may be needed in the future. > > I agree. > >> >> -gdb::byte_vector >> +gdb::array_view >> remote_target::thread_info_to_thread_handle (struct thread_info *tp) >> { >> remote_thread_info *priv = get_remote_thread_info (tp); >> diff --git a/gdb/target-debug.h b/gdb/target-debug.h >> index acb01d47e7c..31c25e9aefd 100644 >> --- a/gdb/target-debug.h >> +++ b/gdb/target-debug.h >> @@ -236,4 +236,18 @@ target_debug_print_gdb_byte_vector_r (gdb::byte_vector &vector) >> { >> target_debug_print_const_gdb_byte_vector_r (vector); >> } >> + >> +static void >> +target_debug_print_gdb_array_view_const_gdb_byte (gdb::array_view &vector) > > array_views should be passed by value normally (because they're small). Did you run into something > that forced this to be a reference? Or was it just copied from the vector case? If it > works, we should just drop the &. > Done. > Also, one of the points of array_view is that you can pass a vector as array_view > argument, like you can pass std::string as string_view argument -- would it work to make > target_debug_print_const_gdb_byte_vector_r call this new > target_debug_print_gdb_array_view_const_gdb_byte instead of duplicating that code? > Done, updated version attached. Thanks, - Tom