Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/agent/src/os/linux/proc_service.h
38833 views
/*1* Copyright (c) 2003, 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#ifndef __ANDROID__29#include <thread_db.h>30#else31#include "thread_db.h"32// #include "glibc_procfs.h"33#endif3435// Linux does not have the proc service library, though it does provide the36// thread_db library which can be used to manipulate threads without having37// to know the details of LinuxThreads or NPTL3839// copied from Solaris "proc_service.h"40typedef enum {41PS_OK, /* generic "call succeeded" */42PS_ERR, /* generic error */43PS_BADPID, /* bad process handle */44PS_BADLID, /* bad lwp identifier */45PS_BADADDR, /* bad address */46PS_NOSYM, /* p_lookup() could not find given symbol */47PS_NOFREGS /* FPU register set not available for given lwp */48} ps_err_e;4950// ps_getpid() is only defined on Linux to return a thread's process ID51pid_t ps_getpid(struct ps_prochandle *ph);5253// ps_pglobal_lookup() looks up the symbol sym_name in the symbol table54// of the load object object_name in the target process identified by ph.55// It returns the symbol's value as an address in the target process in56// *sym_addr.5758ps_err_e ps_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"62ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t addr,63void *buf, size_t size);6465// write "size" bytes of data to debuggee at address "addr"66ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,67const void *buf, size_t size);6869ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs);7071ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset);7273ps_err_e ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lid, prfpregset_t *fpregs);7475ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset);7677// new libthread_db of NPTL seem to require this symbol78ps_err_e ps_get_thread_area();7980#endif /* _PROC_SERVICE_H_ */818283