Merge from vendor branch GDB:
[dragonfly.git] / contrib / gdb-6.2.1 / gdb / auxv.h
1 /* Auxiliary vector support for GDB, the GNU debugger.
2
3    Copyright 2004 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 2 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, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.  */
21
22 #ifndef AUXV_H
23 #define AUXV_H
24
25 /* See "include/elf/common.h" for the definition of valid AT_* values.  */
26
27
28 /* Avoid miscellaneous includes in this file, so that it can be
29    included by nm-*.h for the procfs_xfer_auxv decl if that is
30    used in NATIVE_XFER_AUXV.  */
31 struct target_ops;              /* Forward declaration.  */
32
33
34 /* Read all the auxv data into a contiguous xmalloc'd buffer,
35    stored in *DATA.  Return the size in bytes of this data.
36    If zero, there is no data and *DATA is null.
37    if < 0, there was an error and *DATA is null.  */
38 extern LONGEST target_auxv_read (struct target_ops *ops, char **data);
39
40 /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
41    Return 0 if *READPTR is already at the end of the buffer.
42    Return -1 if there is insufficient buffer for a whole entry.
43    Return 1 if an entry was read into *TYPEP and *VALP.  */
44 extern int target_auxv_parse (struct target_ops *ops,
45                               char **readptr, char *endptr,
46                               CORE_ADDR *typep, CORE_ADDR *valp);
47
48 /* Extract the auxiliary vector entry with a_type matching MATCH.
49    Return zero if no such entry was found, or -1 if there was
50    an error getting the information.  On success, return 1 after
51    storing the entry's value field in *VALP.  */
52 extern int target_auxv_search (struct target_ops *ops,
53                                CORE_ADDR match, CORE_ADDR *valp);
54
55 /* Print the contents of the target's AUXV on the specified file. */
56 extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops);
57
58
59 /* This function is called like a to_xfer_partial hook,
60    but must be called with TARGET_OBJECT_AUXV.
61    It handles access via /proc/PID/auxv, which is the common method.
62    This function is appropriate for doing:
63            #define NATIVE_XFER_AUXV     procfs_xfer_auxv
64    for a native target that uses inftarg.c's child_xfer_partial hook.  */
65
66 extern LONGEST procfs_xfer_auxv (struct target_ops *ops,
67                                  int /* enum target_object */ object,
68                                  const char *annex,
69                                  void *readbuf,
70                                  const void *writebuf,
71                                  ULONGEST offset,
72                                  LONGEST len);
73
74
75 #endif