auxv.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* Auxiliary vector support for GDB, the GNU debugger.
  2. Copyright (C) 2004-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef AUXV_H
  15. #define AUXV_H
  16. #include "target.h"
  17. /* See "include/elf/common.h" for the definition of valid AT_* values. */
  18. /* The default implementation of to_auxv_parse, used by the target
  19. stack.
  20. Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
  21. Return 0 if *READPTR is already at the end of the buffer.
  22. Return -1 if there is insufficient buffer for a whole entry.
  23. Return 1 if an entry was read into *TYPEP and *VALP. */
  24. extern int default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
  25. gdb_byte *endptr, CORE_ADDR *typep,
  26. CORE_ADDR *valp);
  27. /* The SVR4 psABI implementation of to_auxv_parse, that uses an int to
  28. store the type rather than long as assumed by the default parser.
  29. Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
  30. Return 0 if *READPTR is already at the end of the buffer.
  31. Return -1 if there is insufficient buffer for a whole entry.
  32. Return 1 if an entry was read into *TYPEP and *VALP. */
  33. extern int svr4_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr,
  34. gdb_byte *endptr, CORE_ADDR *typep,
  35. CORE_ADDR *valp);
  36. /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
  37. Return 0 if *READPTR is already at the end of the buffer.
  38. Return -1 if there is insufficient buffer for a whole entry.
  39. Return 1 if an entry was read into *TYPEP and *VALP. */
  40. extern int target_auxv_parse (gdb_byte **readptr, gdb_byte *endptr,
  41. CORE_ADDR *typep, CORE_ADDR *valp);
  42. /* Extract the auxiliary vector entry with a_type matching MATCH.
  43. Return zero if no such entry was found, or -1 if there was
  44. an error getting the information. On success, return 1 after
  45. storing the entry's value field in *VALP. */
  46. extern int target_auxv_search (struct target_ops *ops,
  47. CORE_ADDR match, CORE_ADDR *valp);
  48. /* Print a description of a single AUXV entry on the specified file. */
  49. enum auxv_format { AUXV_FORMAT_DEC, AUXV_FORMAT_HEX, AUXV_FORMAT_STR };
  50. extern void fprint_auxv_entry (struct ui_file *file, const char *name,
  51. const char *description,
  52. enum auxv_format format, CORE_ADDR type,
  53. CORE_ADDR val);
  54. /* The default implementation of gdbarch_print_auxv_entry. */
  55. extern void default_print_auxv_entry (struct gdbarch *gdbarch,
  56. struct ui_file *file, CORE_ADDR type,
  57. CORE_ADDR val);
  58. /* Print the contents of the target's AUXV on the specified file. */
  59. extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops);
  60. extern target_xfer_partial_ftype memory_xfer_auxv;
  61. #endif