xref: /freebsd/include/proc_service.h (revision 6fd05b64b5b65dd4ba9b86482a0634a5f0b96c29)
1 /*
2  * Copyright (c) 2004 David Xu <davidxu@freebsd.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *	This product includes software developed by the University of
16  *	California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  * $FreeBSD$
34  */
35 
36 #ifndef _PROC_SERVICE_H_
37 #define _PROC_SERVICE_H_
38 
39 #include <sys/types.h>
40 #include <sys/procfs.h>
41 
42 struct ps_prochandle;
43 
44 typedef enum
45 {
46     PS_OK,
47     PS_ERR,
48     PS_BADPID,
49     PS_BADLID,
50     PS_BADADDR,
51     PS_NOSYM,
52     PS_NOFREGS
53 } ps_err_e;
54 
55 /*
56  * Every program that links libthread_db must provide a set of process control
57  * primitives to access memory and registers in the target process, to start
58  * and to stop the target process, and to look up symbols in the target process.
59  */
60 
61 #if 0
62 ps_err_e ps_pdmodel(struct ps_prochandle *ph, int *data_model);
63 #endif
64 ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,
65 		const char *sym_name , psaddr_t *sym_addr);
66 #if 0
67 ps_err_e ps_pglobal_sym(struct ps_prochandle *ph, const char *object_name,
68 		const char *sym_name , ps_sym_t *sym);
69 ps_err_e ps_pread(struct ps_prochandle *ph, psaddr_t addr, void *buf,
70 		size_t size);
71 ps_err_e ps_pwrite(struct ps_prochandle *ph, psaddr_t addr, const void *buf,
72 		size_t size);
73 #endif
74 ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t addr, void *buf,
75 		size_t size);
76 ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr, const void *buf,
77 		size_t size);
78 ps_err_e ps_ptread(struct ps_prochandle *ph, psaddr_t addr, void *buf,
79 		size_t size);
80 ps_err_e ps_ptwrite(struct ps_prochandle *ph, psaddr_t addr, const void *buf,
81 		size_t size);
82 ps_err_e ps_pstop(struct ps_prochandle *ph);
83 ps_err_e ps_pcontinue(struct ps_prochandle *ph);
84 ps_err_e ps_lstop(struct ps_prochandle *ph, lwpid_t lwpid);
85 ps_err_e ps_lcontinue(struct ps_prochandle *ph, lwpid_t lwpid);
86 ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lwpid,
87 		prgregset_t gregset);
88 ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lwpid,
89 		const prgregset_t gregset);
90 ps_err_e ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lwpid,
91 		prfpregset_t *fpregset);
92 ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lwpid,
93 		const prfpregset_t *fpregset);
94 #if 0
95 ps_err_e ps_pauxv(struct ps_prochandle *ph, const auxv_t **auxp);
96 ps_err_e ps_kill(struct ps_prochandle *ph, int sig);
97 ps_err_e ps_lrolltoaddr(struct ps_prochandle *ph, lwpid_t lwpid,
98 		psaddr_t go_addr, psaddr_t stop_addr);
99 #endif
100 void ps_plog(const char *fmt, ...);
101 pid_t ps_getpid (struct ps_prochandle *ph);
102 
103 #endif
104