aboutsummaryrefslogtreecommitdiff
path: root/gdb/auxv.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-09-29 15:13:09 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2022-09-29 16:42:34 -0400
commit3fe639b81b452b79460a8527aa57011f1c42ec8b (patch)
tree21ac377df7dfa287c46d00b11045fdb1b0fa8388 /gdb/auxv.c
parent31282a849107d95d3cfe115ba160f976dd99844c (diff)
downloadgdb-3fe639b81b452b79460a8527aa57011f1c42ec8b.zip
gdb-3fe639b81b452b79460a8527aa57011f1c42ec8b.tar.gz
gdb-3fe639b81b452b79460a8527aa57011f1c42ec8b.tar.bz2
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
Diffstat (limited to 'gdb/auxv.c')
-rw-r--r--gdb/auxv.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/gdb/auxv.c b/gdb/auxv.c
index b248f99..63ee01c 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -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)