1 /* Auxiliary vector support for GDB, the GNU debugger. 2 3 Copyright (C) 2004-2020 Free Software Foundation, Inc. 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 9 the Free Software Foundation; either version 3 of the License, or 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 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 20 #ifndef AUXV_H 21 #define AUXV_H 22 23 #include "target.h" 24 25 /* See "include/elf/common.h" for the definition of valid AT_* values. */ 26 27 /* The default implementation of to_auxv_parse, used by the target 28 stack. 29 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, gdb_byte **readptr, 35 gdb_byte *endptr, CORE_ADDR *typep, 36 CORE_ADDR *valp); 37 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. */ 45 extern int svr4_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr, 46 gdb_byte *endptr, CORE_ADDR *typep, 47 CORE_ADDR *valp); 48 49 /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR. 50 Return 0 if *READPTR is already at the end of the buffer. 51 Return -1 if there is insufficient buffer for a whole entry. 52 Return 1 if an entry was read into *TYPEP and *VALP. */ 53 extern int target_auxv_parse (gdb_byte **readptr, gdb_byte *endptr, 54 CORE_ADDR *typep, CORE_ADDR *valp); 55 56 /* Extract the auxiliary vector entry with a_type matching MATCH. 57 Return zero if no such entry was found, or -1 if there was 58 an error getting the information. On success, return 1 after 59 storing the entry's value field in *VALP. */ 60 extern int target_auxv_search (struct target_ops *ops, 61 CORE_ADDR match, CORE_ADDR *valp); 62 63 /* Print a description of a single AUXV entry on the specified file. */ 64 enum auxv_format { AUXV_FORMAT_DEC, AUXV_FORMAT_HEX, AUXV_FORMAT_STR }; 65 66 extern void fprint_auxv_entry (struct ui_file *file, const char *name, 67 const char *description, 68 enum auxv_format format, CORE_ADDR type, 69 CORE_ADDR val); 70 71 /* The default implementation of gdbarch_print_auxv_entry. */ 72 73 extern void default_print_auxv_entry (struct gdbarch *gdbarch, 74 struct ui_file *file, CORE_ADDR type, 75 CORE_ADDR val); 76 77 /* Print the contents of the target's AUXV on the specified file. */ 78 extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops); 79 80 extern target_xfer_partial_ftype memory_xfer_auxv; 81 82 83 #endif 84