agent/src/os/linux/proc_service.h

Tue, 08 Aug 2017 15:57:29 +0800

author
aoqi
date
Tue, 08 Aug 2017 15:57:29 +0800
changeset 6876
710a3c8b516e
parent 1907
c18cbe5936b8
parent 0
f90c822e73f8
permissions
-rw-r--r--

merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef _PROC_SERVICE_H_
aoqi@0 26 #define _PROC_SERVICE_H_
aoqi@0 27
aoqi@0 28 #include <stdio.h>
aoqi@0 29 #include <thread_db.h>
aoqi@0 30
aoqi@0 31 // Linux does not have the proc service library, though it does provide the
aoqi@0 32 // thread_db library which can be used to manipulate threads without having
aoqi@0 33 // to know the details of LinuxThreads or NPTL
aoqi@0 34
aoqi@0 35 // copied from Solaris "proc_service.h"
aoqi@0 36 typedef enum {
aoqi@0 37 PS_OK, /* generic "call succeeded" */
aoqi@0 38 PS_ERR, /* generic error */
aoqi@0 39 PS_BADPID, /* bad process handle */
aoqi@0 40 PS_BADLID, /* bad lwp identifier */
aoqi@0 41 PS_BADADDR, /* bad address */
aoqi@0 42 PS_NOSYM, /* p_lookup() could not find given symbol */
aoqi@0 43 PS_NOFREGS /* FPU register set not available for given lwp */
aoqi@0 44 } ps_err_e;
aoqi@0 45
aoqi@0 46 // ps_getpid() is only defined on Linux to return a thread's process ID
aoqi@0 47 pid_t ps_getpid(struct ps_prochandle *ph);
aoqi@0 48
aoqi@0 49 // ps_pglobal_lookup() looks up the symbol sym_name in the symbol table
aoqi@0 50 // of the load object object_name in the target process identified by ph.
aoqi@0 51 // It returns the symbol's value as an address in the target process in
aoqi@0 52 // *sym_addr.
aoqi@0 53
aoqi@0 54 ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,
aoqi@0 55 const char *sym_name, psaddr_t *sym_addr);
aoqi@0 56
aoqi@0 57 // read "size" bytes of data from debuggee at address "addr"
aoqi@0 58 ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t addr,
aoqi@0 59 void *buf, size_t size);
aoqi@0 60
aoqi@0 61 // write "size" bytes of data to debuggee at address "addr"
aoqi@0 62 ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,
aoqi@0 63 const void *buf, size_t size);
aoqi@0 64
aoqi@0 65 ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs);
aoqi@0 66
aoqi@0 67 ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset);
aoqi@0 68
aoqi@0 69 ps_err_e ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lid, prfpregset_t *fpregs);
aoqi@0 70
aoqi@0 71 ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset);
aoqi@0 72
aoqi@0 73 // new libthread_db of NPTL seem to require this symbol
aoqi@0 74 ps_err_e ps_get_thread_area();
aoqi@0 75
aoqi@0 76 #endif /* _PROC_SERVICE_H_ */

mercurial