duke@435: /* trims@1907: * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. duke@435: * duke@435: */ duke@435: duke@435: #ifndef _PROC_SERVICE_H_ duke@435: #define _PROC_SERVICE_H_ duke@435: duke@435: #include duke@435: #include duke@435: duke@435: // Linux does not have the proc service library, though it does provide the duke@435: // thread_db library which can be used to manipulate threads without having duke@435: // to know the details of LinuxThreads or NPTL duke@435: duke@435: // copied from Solaris "proc_service.h" duke@435: typedef enum { duke@435: PS_OK, /* generic "call succeeded" */ duke@435: PS_ERR, /* generic error */ duke@435: PS_BADPID, /* bad process handle */ duke@435: PS_BADLID, /* bad lwp identifier */ duke@435: PS_BADADDR, /* bad address */ duke@435: PS_NOSYM, /* p_lookup() could not find given symbol */ duke@435: PS_NOFREGS /* FPU register set not available for given lwp */ duke@435: } ps_err_e; duke@435: duke@435: // ps_getpid() is only defined on Linux to return a thread's process ID duke@435: pid_t ps_getpid(struct ps_prochandle *ph); duke@435: duke@435: // ps_pglobal_lookup() looks up the symbol sym_name in the symbol table duke@435: // of the load object object_name in the target process identified by ph. duke@435: // It returns the symbol's value as an address in the target process in duke@435: // *sym_addr. duke@435: duke@435: ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name, duke@435: const char *sym_name, psaddr_t *sym_addr); duke@435: duke@435: // read "size" bytes of data from debuggee at address "addr" duke@435: ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t addr, duke@435: void *buf, size_t size); duke@435: duke@435: // write "size" bytes of data to debuggee at address "addr" duke@435: ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr, duke@435: const void *buf, size_t size); duke@435: duke@435: ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs); duke@435: duke@435: ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset); duke@435: duke@435: ps_err_e ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lid, prfpregset_t *fpregs); duke@435: duke@435: ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset); duke@435: duke@435: // new libthread_db of NPTL seem to require this symbol duke@435: ps_err_e ps_get_thread_area(); duke@435: duke@435: #endif /* _PROC_SERVICE_H_ */