Path: blob/jdk8u272-b10-aarch32-20201026/hotspot/agent/src/os/linux/proc_service.h
48792 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#include <thread_db.h>2930// Linux does not have the proc service library, though it does provide the31// thread_db library which can be used to manipulate threads without having32// to know the details of LinuxThreads or NPTL3334// copied from Solaris "proc_service.h"35typedef enum {36PS_OK, /* generic "call succeeded" */37PS_ERR, /* generic error */38PS_BADPID, /* bad process handle */39PS_BADLID, /* bad lwp identifier */40PS_BADADDR, /* bad address */41PS_NOSYM, /* p_lookup() could not find given symbol */42PS_NOFREGS /* FPU register set not available for given lwp */43} ps_err_e;4445// ps_getpid() is only defined on Linux to return a thread's process ID46pid_t ps_getpid(struct ps_prochandle *ph);4748// ps_pglobal_lookup() looks up the symbol sym_name in the symbol table49// of the load object object_name in the target process identified by ph.50// It returns the symbol's value as an address in the target process in51// *sym_addr.5253ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,54const char *sym_name, psaddr_t *sym_addr);5556// read "size" bytes of data from debuggee at address "addr"57ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t addr,58void *buf, size_t size);5960// write "size" bytes of data to debuggee at address "addr"61ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,62const void *buf, size_t size);6364ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs);6566ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset);6768ps_err_e ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lid, prfpregset_t *fpregs);6970ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset);7172// new libthread_db of NPTL seem to require this symbol73ps_err_e ps_get_thread_area();7475#endif /* _PROC_SERVICE_H_ */767778