Path: blob/master/src/jdk.hotspot.agent/linux/native/libsaproc/proc_service.h
41152 views
/*1* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef _PROC_SERVICE_H_25#define _PROC_SERVICE_H_2627#include <stdio.h>28#include <sys/procfs.h>29#include "jni.h"30#include "libproc.h"313233// copied from Solaris "proc_service.h"34typedef enum {35PS_OK, /* generic "call succeeded" */36PS_ERR, /* generic error */37PS_BADPID, /* bad process handle */38PS_BADLID, /* bad lwp identifier */39PS_BADADDR, /* bad address */40PS_NOSYM, /* p_lookup() could not find given symbol */41PS_NOFREGS /* FPU register set not available for given lwp */42} ps_err_e;4344#ifdef __cplusplus45extern "C" {46#endif4748// ps_getpid() is only defined on Linux to return a thread's process ID49JNIEXPORT pid_t JNICALL50ps_getpid(struct ps_prochandle *ph);5152// ps_pglobal_lookup() looks up the symbol sym_name in the symbol table53// of the load object object_name in the target process identified by ph.54// It returns the symbol's value as an address in the target process in55// *sym_addr.5657JNIEXPORT ps_err_e JNICALL58ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,59const char *sym_name, psaddr_t *sym_addr);6061// read "size" bytes of data from debuggee at address "addr"62JNIEXPORT ps_err_e JNICALL63ps_pdread(struct ps_prochandle *ph, psaddr_t addr,64void *buf, size_t size);6566// write "size" bytes of data to debuggee at address "addr"67JNIEXPORT ps_err_e JNICALL68ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,69const void *buf, size_t size);7071JNIEXPORT ps_err_e JNICALL72ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs);7374JNIEXPORT ps_err_e JNICALL75ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset);7677JNIEXPORT ps_err_e JNICALL78ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lid, prfpregset_t *fpregs);7980JNIEXPORT ps_err_e JNICALL81ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset);8283#ifdef __cplusplus84}85#endif8687#endif /* _PROC_SERVICE_H_ */888990