proc_service.h revision 132173
1132173Sdavidxu/* 2132173Sdavidxu * Copyright (c) 2004 David Xu <davidxu@freebsd.org> 3132173Sdavidxu * All rights reserved. 4132173Sdavidxu * 5132173Sdavidxu * Redistribution and use in source and binary forms, with or without 6132173Sdavidxu * modification, are permitted provided that the following conditions 7132173Sdavidxu * are met: 8132173Sdavidxu * 1. Redistributions of source code must retain the above copyright 9132173Sdavidxu * notice, this list of conditions and the following disclaimer. 10132173Sdavidxu * 2. Redistributions in binary form must reproduce the above copyright 11132173Sdavidxu * notice, this list of conditions and the following disclaimer in the 12132173Sdavidxu * documentation and/or other materials provided with the distribution. 13132173Sdavidxu * 3. All advertising materials mentioning features or use of this software 14132173Sdavidxu * must display the following acknowledgement: 15132173Sdavidxu * This product includes software developed by the University of 16132173Sdavidxu * California, Berkeley and its contributors. 17132173Sdavidxu * 4. Neither the name of the University nor the names of its contributors 18132173Sdavidxu * may be used to endorse or promote products derived from this software 19132173Sdavidxu * without specific prior written permission. 20132173Sdavidxu * 21132173Sdavidxu * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22132173Sdavidxu * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23132173Sdavidxu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24132173Sdavidxu * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25132173Sdavidxu * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26132173Sdavidxu * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27132173Sdavidxu * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28132173Sdavidxu * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29132173Sdavidxu * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30132173Sdavidxu * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31132173Sdavidxu * SUCH DAMAGE. 32132173Sdavidxu * 33132173Sdavidxu * $FreeBSD: head/include/proc_service.h 132173 2004-07-15 03:43:18Z davidxu $ 34132173Sdavidxu */ 35132173Sdavidxu 36132173Sdavidxu#ifndef _PROC_SERVICE_H_ 37132173Sdavidxu#define _PROC_SERVICE_H_ 38132173Sdavidxu 39132173Sdavidxu#include <sys/types.h> 40132173Sdavidxu#include <sys/procfs.h> 41132173Sdavidxu 42132173Sdavidxustruct ps_prochandle; 43132173Sdavidxu 44132173Sdavidxutypedef enum 45132173Sdavidxu{ 46132173Sdavidxu PS_OK, 47132173Sdavidxu PS_ERR, 48132173Sdavidxu PS_BADPID, 49132173Sdavidxu PS_BADLID, 50132173Sdavidxu PS_BADADDR, 51132173Sdavidxu PS_NOSYM, 52132173Sdavidxu PS_NOFREGS 53132173Sdavidxu} ps_err_e; 54132173Sdavidxu 55132173Sdavidxu/* 56132173Sdavidxu * Every program that links libthread_db must provide a set of process control 57132173Sdavidxu * primitives to access memory and registers in the target process, to start 58132173Sdavidxu * and to stop the target process, and to look up symbols in the target process. 59132173Sdavidxu */ 60132173Sdavidxu 61132173Sdavidxu#if 0 62132173Sdavidxups_err_e ps_pdmodel(struct ps_prochandle *ph, int *data_model); 63132173Sdavidxu#endif 64132173Sdavidxups_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name, 65132173Sdavidxu const char *sym_name , psaddr_t *sym_addr); 66132173Sdavidxu#if 0 67132173Sdavidxups_err_e ps_pglobal_sym(struct ps_prochandle *ph, const char *object_name, 68132173Sdavidxu const char *sym_name , ps_sym_t *sym); 69132173Sdavidxups_err_e ps_pread(struct ps_prochandle *ph, psaddr_t addr, void *buf, 70132173Sdavidxu size_t size); 71132173Sdavidxups_err_e ps_pwrite(struct ps_prochandle *ph, psaddr_t addr, const void *buf, 72132173Sdavidxu size_t size); 73132173Sdavidxu#endif 74132173Sdavidxups_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t addr, void *buf, 75132173Sdavidxu size_t size); 76132173Sdavidxups_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr, const void *buf, 77132173Sdavidxu size_t size); 78132173Sdavidxups_err_e ps_ptread(struct ps_prochandle *ph, psaddr_t addr, void *buf, 79132173Sdavidxu size_t size); 80132173Sdavidxups_err_e ps_ptwrite(struct ps_prochandle *ph, psaddr_t addr, const void *buf, 81132173Sdavidxu size_t size); 82132173Sdavidxups_err_e ps_pstop(struct ps_prochandle *ph); 83132173Sdavidxups_err_e ps_pcontinue(struct ps_prochandle *ph); 84132173Sdavidxups_err_e ps_lstop(struct ps_prochandle *ph, lwpid_t lwpid); 85132173Sdavidxups_err_e ps_lcontinue(struct ps_prochandle *ph, lwpid_t lwpid); 86132173Sdavidxups_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lwpid, 87132173Sdavidxu prgregset_t gregset); 88132173Sdavidxups_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lwpid, 89132173Sdavidxu const prgregset_t gregset); 90132173Sdavidxups_err_e ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lwpid, 91132173Sdavidxu prfpregset_t *fpregset); 92132173Sdavidxups_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lwpid, 93132173Sdavidxu const prfpregset_t *fpregset); 94132173Sdavidxu#if 0 95132173Sdavidxups_err_e ps_pauxv(struct ps_prochandle *ph, const auxv_t **auxp); 96132173Sdavidxups_err_e ps_kill(struct ps_prochandle *ph, int sig); 97132173Sdavidxups_err_e ps_lrolltoaddr(struct ps_prochandle *ph, lwpid_t lwpid, 98132173Sdavidxu psaddr_t go_addr, psaddr_t stop_addr); 99132173Sdavidxu#endif 100132173Sdavidxuvoid ps_plog(const char *fmt, ...); 101132173Sdavidxupid_t ps_getpid (struct ps_prochandle *ph); 102132173Sdavidxu 103132173Sdavidxu#endif 104