< prev index next >
src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -110,11 +110,12 @@
bool is_debug() {
return _libsaproc_debug;
}
// initialize libproc
-bool init_libproc(bool debug) {
+JNIEXPORT bool JNICALL
+init_libproc(bool debug) {
// init debug mode
_libsaproc_debug = debug;
// initialize the thread_db library
if (td_init() != TD_OK) {
@@ -147,11 +148,12 @@
}
// ps_prochandle cleanup
// ps_prochandle cleanup
-void Prelease(struct ps_prochandle* ph) {
+JNIEXPORT void JNICALL
+Prelease(struct ps_prochandle* ph) {
// do the "derived class" clean-up first
ph->ops->release(ph);
destroy_lib_info(ph);
destroy_thread_info(ph);
free(ph);
@@ -396,61 +398,70 @@
//--------------------------------------------------------------------------
// proc service functions
// get process id
-pid_t ps_getpid(struct ps_prochandle *ph) {
+JNIEXPORT pid_t JNICALL
+ps_getpid(struct ps_prochandle *ph) {
return ph->pid;
}
// ps_pglobal_lookup() looks up the symbol sym_name in the symbol table
// of the load object object_name in the target process identified by ph.
// It returns the symbol's value as an address in the target process in
// *sym_addr.
-ps_err_e ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,
+JNIEXPORT ps_err_e JNICALL
+ps_pglobal_lookup(struct ps_prochandle *ph, const char *object_name,
const char *sym_name, psaddr_t *sym_addr) {
*sym_addr = (psaddr_t) lookup_symbol(ph, object_name, sym_name);
return (*sym_addr ? PS_OK : PS_NOSYM);
}
// read "size" bytes info "buf" from address "addr"
-ps_err_e ps_pdread(struct ps_prochandle *ph, psaddr_t addr,
+JNIEXPORT ps_err_e JNICALL
+ps_pdread(struct ps_prochandle *ph, psaddr_t addr,
void *buf, size_t size) {
return ph->ops->p_pread(ph, (uintptr_t) addr, buf, size)? PS_OK: PS_ERR;
}
// write "size" bytes of data to debuggee at address "addr"
-ps_err_e ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,
+JNIEXPORT ps_err_e JNICALL
+ps_pdwrite(struct ps_prochandle *ph, psaddr_t addr,
const void *buf, size_t size) {
return ph->ops->p_pwrite(ph, (uintptr_t)addr, buf, size)? PS_OK: PS_ERR;
}
// ------------------------------------------------------------------------
// Functions below this point are not yet implemented. They are here only
// to make the linker happy.
-ps_err_e ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs) {
+JNIEXPORT ps_err_e JNICALL
+ps_lsetfpregs(struct ps_prochandle *ph, lwpid_t lid, const prfpregset_t *fpregs) {
print_debug("ps_lsetfpregs not implemented\n");
return PS_OK;
}
-ps_err_e ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset) {
+JNIEXPORT ps_err_e JNICALL
+ps_lsetregs(struct ps_prochandle *ph, lwpid_t lid, const prgregset_t gregset) {
print_debug("ps_lsetregs not implemented\n");
return PS_OK;
}
-ps_err_e ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lid, prfpregset_t *fpregs) {
+JNIEXPORT ps_err_e JNICALL
+ps_lgetfpregs(struct ps_prochandle *ph, lwpid_t lid, prfpregset_t *fpregs) {
print_debug("ps_lgetfpregs not implemented\n");
return PS_OK;
}
-ps_err_e ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset) {
+JNIEXPORT ps_err_e JNICALL
+ps_lgetregs(struct ps_prochandle *ph, lwpid_t lid, prgregset_t gregset) {
print_debug("ps_lgetfpregs not implemented\n");
return PS_OK;
}
// new libthread_db of NPTL seem to require this symbol
-ps_err_e ps_get_thread_area() {
+JNIEXPORT ps_err_e JNICALL
+ps_get_thread_area() {
print_debug("ps_get_thread_area not implemented\n");
return PS_OK;
}
< prev index next >