]>
Commit | Line | Data |
---|---|---|
14ed0a8b RM |
1 | /* Auxiliary vector support for GDB, the GNU debugger. |
2 | ||
1d506c26 | 3 | Copyright (C) 2004-2024 Free Software Foundation, Inc. |
14ed0a8b RM |
4 | |
5 | This file is part of GDB. | |
6 | ||
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 | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
14ed0a8b RM |
10 | (at your option) any later version. |
11 | ||
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. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
14ed0a8b RM |
19 | |
20 | #ifndef AUXV_H | |
21 | #define AUXV_H | |
22 | ||
81b92222 | 23 | #include "target.h" |
14ed0a8b | 24 | |
81b92222 | 25 | /* See "include/elf/common.h" for the definition of valid AT_* values. */ |
14ed0a8b | 26 | |
8de71aab | 27 | /* The default implementation of to_auxv_parse, used by the target |
206c98a6 | 28 | stack. |
8de71aab | 29 | |
206c98a6 KR |
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. */ | |
3fe639b8 SM |
34 | extern int default_auxv_parse (struct target_ops *ops, const gdb_byte **readptr, |
35 | const gdb_byte *endptr, CORE_ADDR *typep, | |
8de71aab TT |
36 | CORE_ADDR *valp); |
37 | ||
206c98a6 KR |
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. | |
40 | ||
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. */ | |
3fe639b8 SM |
45 | extern int svr4_auxv_parse (struct gdbarch *gdbarch, const gdb_byte **readptr, |
46 | const gdb_byte *endptr, CORE_ADDR *typep, | |
206c98a6 KR |
47 | CORE_ADDR *valp); |
48 | ||
82d23ca8 SM |
49 | /* Read auxv data from the current inferior's target stack. */ |
50 | ||
6b09f134 | 51 | extern const std::optional<gdb::byte_vector> &target_read_auxv (); |
82d23ca8 SM |
52 | |
53 | /* Read auxv data from OPS. */ | |
54 | ||
6b09f134 | 55 | extern std::optional<gdb::byte_vector> target_read_auxv_raw (target_ops *ops); |
82d23ca8 SM |
56 | |
57 | /* Search AUXV for an entry with a_type matching MATCH. | |
58 | ||
59 | OPS and GDBARCH are the target and architecture to use to parse auxv entries. | |
60 | ||
14ed0a8b RM |
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. */ | |
82d23ca8 SM |
64 | |
65 | extern int target_auxv_search (const gdb::byte_vector &auxv, | |
66 | target_ops *ops, gdbarch *gdbarch, | |
14ed0a8b RM |
67 | CORE_ADDR match, CORE_ADDR *valp); |
68 | ||
82d23ca8 SM |
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. */ | |
71 | ||
72 | extern int target_auxv_search (CORE_ADDR match, CORE_ADDR *valp); | |
73 | ||
2faa3447 JB |
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 }; | |
76 | ||
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, | |
80 | CORE_ADDR val); | |
81 | ||
82 | /* The default implementation of gdbarch_print_auxv_entry. */ | |
83 | ||
84 | extern void default_print_auxv_entry (struct gdbarch *gdbarch, | |
85 | struct ui_file *file, CORE_ADDR type, | |
86 | CORE_ADDR val); | |
87 | ||
4ac248ca | 88 | extern target_xfer_partial_ftype memory_xfer_auxv; |
14ed0a8b RM |
89 | |
90 | ||
91 | #endif |