1 /* Auxiliary vector support for GDB, the GNU debugger.
3 Copyright (C) 2004-2024 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
25 /* See "include/elf/common.h" for the definition of valid AT_* values. */
27 /* The default implementation of to_auxv_parse, used by the target
30 Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
31 Return 0 if *READPTR is already at the end of the buffer.
32 Return -1 if there is insufficient buffer for a whole entry.
33 Return 1 if an entry was read into *TYPEP and *VALP. */
34 extern int default_auxv_parse (struct target_ops
*ops
, const gdb_byte
**readptr
,
35 const gdb_byte
*endptr
, CORE_ADDR
*typep
,
38 /* The SVR4 psABI implementation of to_auxv_parse, that uses an int to
39 store the type rather than long as assumed by the default parser.
41 Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
42 Return 0 if *READPTR is already at the end of the buffer.
43 Return -1 if there is insufficient buffer for a whole entry.
44 Return 1 if an entry was read into *TYPEP and *VALP. */
45 extern int svr4_auxv_parse (struct gdbarch
*gdbarch
, const gdb_byte
**readptr
,
46 const gdb_byte
*endptr
, CORE_ADDR
*typep
,
49 /* Read auxv data from the current inferior's target stack. */
51 extern const std::optional
<gdb::byte_vector
> &target_read_auxv ();
53 /* Read auxv data from OPS. */
55 extern std::optional
<gdb::byte_vector
> target_read_auxv_raw (target_ops
*ops
);
57 /* Search AUXV for an entry with a_type matching MATCH.
59 OPS and GDBARCH are the target and architecture to use to parse auxv entries.
61 Return zero if no such entry was found, or -1 if there was
62 an error getting the information. On success, return 1 after
63 storing the entry's value field in *VALP. */
65 extern int target_auxv_search (const gdb::byte_vector
&auxv
,
66 target_ops
*ops
, gdbarch
*gdbarch
,
67 CORE_ADDR match
, CORE_ADDR
*valp
);
69 /* Same as the above, but read the auxv data from the current inferior. Use
70 the current inferior's top target and arch to parse auxv entries. */
72 extern int target_auxv_search (CORE_ADDR match
, CORE_ADDR
*valp
);
74 /* Print a description of a single AUXV entry on the specified file. */
75 enum auxv_format
{ AUXV_FORMAT_DEC
, AUXV_FORMAT_HEX
, AUXV_FORMAT_STR
};
77 extern void fprint_auxv_entry (struct ui_file
*file
, const char *name
,
78 const char *description
,
79 enum auxv_format format
, CORE_ADDR type
,
82 /* The default implementation of gdbarch_print_auxv_entry. */
84 extern void default_print_auxv_entry (struct gdbarch
*gdbarch
,
85 struct ui_file
*file
, CORE_ADDR type
,
88 extern target_xfer_partial_ftype memory_xfer_auxv
;