1/* Callback interface for libthread_db, functions users must define.
2 Copyright (C) 1999-2016 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19/* The definitions in this file must correspond to those in the debugger. */
20#include <sys/procfs.h>
21
22/* Functions in this interface return one of these status codes. */
23typedef enum
24{
25 PS_OK, /* Generic "call succeeded". */
26 PS_ERR, /* Generic error. */
27 PS_BADPID, /* Bad process handle. */
28 PS_BADLID, /* Bad LWP identifier. */
29 PS_BADADDR, /* Bad address. */
30 PS_NOSYM, /* Could not find given symbol. */
31 PS_NOFREGS /* FPU register set not available for given LWP. */
32} ps_err_e;
33
34
35/* This type is opaque in this interface.
36 It's defined by the user of libthread_db. */
37struct ps_prochandle;
38
39
40/* Read or write process memory at the given address. */
41extern ps_err_e ps_pdread (struct ps_prochandle *,
42 psaddr_t, void *, size_t);
43extern ps_err_e ps_pdwrite (struct ps_prochandle *,
44 psaddr_t, const void *, size_t);
45extern ps_err_e ps_ptread (struct ps_prochandle *,
46 psaddr_t, void *, size_t);
47extern ps_err_e ps_ptwrite (struct ps_prochandle *,
48 psaddr_t, const void *, size_t);
49
50
51/* Get and set the given LWP's general or FPU register set. */
52extern ps_err_e ps_lgetregs (struct ps_prochandle *,
53 lwpid_t, prgregset_t);
54extern ps_err_e ps_lsetregs (struct ps_prochandle *,
55 lwpid_t, const prgregset_t);
56extern ps_err_e ps_lgetfpregs (struct ps_prochandle *,
57 lwpid_t, prfpregset_t *);
58extern ps_err_e ps_lsetfpregs (struct ps_prochandle *,
59 lwpid_t, const prfpregset_t *);
60
61/* Return the PID of the process. */
62extern pid_t ps_getpid (struct ps_prochandle *);
63
64/* Fetch the special per-thread address associated with the given LWP.
65 This call is only used on a few platforms (most use a normal register).
66 The meaning of the `int' parameter is machine-dependent. */
67extern ps_err_e ps_get_thread_area (const struct ps_prochandle *,
68 lwpid_t, int, psaddr_t *);
69
70
71/* Look up the named symbol in the named DSO in the symbol tables
72 associated with the process being debugged, filling in *SYM_ADDR
73 with the corresponding run-time address. */
74extern ps_err_e ps_pglobal_lookup (struct ps_prochandle *,
75 const char *object_name,
76 const char *sym_name,
77 psaddr_t *sym_addr);
78
79
80/* Stop or continue the entire process. */
81extern ps_err_e ps_pstop (const struct ps_prochandle *);
82extern ps_err_e ps_pcontinue (const struct ps_prochandle *);
83
84/* Stop or continue the given LWP alone. */
85extern ps_err_e ps_lstop (const struct ps_prochandle *, lwpid_t);
86extern ps_err_e ps_lcontinue (const struct ps_prochandle *, lwpid_t);
87