[PATCHv3 2/3] gdb: move displaced_step_dump_bytes into gdbsupport (and rename)

Simon Marchi simark@simark.ca
Tue Mar 28 13:10:46 GMT 2023


> diff --git a/gdbsupport/array-view.h b/gdbsupport/array-view.h
> index 3d8248b08b7..d07c8bc53fc 100644
> --- a/gdbsupport/array-view.h
> +++ b/gdbsupport/array-view.h
> @@ -21,6 +21,7 @@
>  #include "traits.h"
>  #include <algorithm>
>  #include <type_traits>
> +#include "gdbsupport/gdb_assert.h"
I suppose this is needed because array-view.h uses gdb_assert, and you
noticed it because some files didn't compile, because they didn't
happen to include gdb_assert.h before array-view.h.

> @@ -194,6 +195,20 @@ extern int hex2bin (const char *hex, gdb_byte *bin, int count);
>  /* Like the above, but return a gdb::byte_vector.  */
>  gdb::byte_vector hex2bin (const char *hex);
>  
> +/* Build a string containing the contents of BYTES.  Each byte is
> +   represented as a 2 character hex string, with spaces separating each
> +   individual byte.  */
> +
> +extern std::string bytes_to_string (gdb::array_view<gdb_byte> bytes);

I think it could be const:

gdb::array_view<const gdb_byte>

And the other overload of bytes_to_string too.

Otherwise:

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon



More information about the Gdb-patches mailing list