gdb: constify auxv parse functions

Constify the input parameters of the various auxv parse functions, they
don't need to modify the raw auxv data.

Change-Id: I13eacd5ab8e925ec2b5c1f7722cbab39c41516ec
This commit is contained in:
Simon Marchi
2022-09-29 15:13:09 -04:00
parent 31282a8491
commit 3fe639b81b
10 changed files with 43 additions and 43 deletions

View File

@@ -250,14 +250,14 @@ memory_xfer_auxv (struct target_ops *ops,
the auxv type field as a parameter. */
static int
generic_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp,
generic_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr,
const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp,
int sizeof_auxv_type)
{
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
const int sizeof_auxv_val = ptr_type->length ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte *ptr = *readptr;
const gdb_byte *ptr = *readptr;
if (endptr == ptr)
return 0;
@@ -281,8 +281,8 @@ generic_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr,
/* See auxv.h. */
int
default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
default_auxv_parse (struct target_ops *ops, const gdb_byte **readptr,
const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
struct gdbarch *gdbarch = target_gdbarch ();
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
@@ -295,8 +295,8 @@ default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
/* See auxv.h. */
int
svr4_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
svr4_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr,
const gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{
struct type *int_type = builtin_type (gdbarch)->builtin_int;
const int sizeof_auxv_type = int_type->length ();
@@ -310,8 +310,8 @@ svr4_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr,
Return -1 if there is insufficient buffer for a whole entry.
Return 1 if an entry was read into *TYPEP and *VALP. */
int
target_auxv_parse (gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
target_auxv_parse (const gdb_byte **readptr, const gdb_byte *endptr,
CORE_ADDR *typep, CORE_ADDR *valp)
{
struct gdbarch *gdbarch = target_gdbarch();
@@ -383,8 +383,8 @@ target_auxv_search (struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp)
if (!info->data)
return -1;
gdb_byte *data = info->data->data ();
gdb_byte *ptr = data;
const gdb_byte *data = info->data->data ();
const gdb_byte *ptr = data;
size_t len = info->data->size ();
while (1)
@@ -557,8 +557,8 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
if (!info->data)
return -1;
gdb_byte *data = info->data->data ();
gdb_byte *ptr = data;
const gdb_byte *data = info->data->data ();
const gdb_byte *ptr = data;
size_t len = info->data->size ();
while (target_auxv_parse (&ptr, data + len, &type, &val) > 0)