--- a/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c Tue Feb 13 11:54:44 2018 +0100
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/libproc_impl.c Tue Feb 13 12:39:56 2018 +0100
@@ -1,5 +1,5 @@
/*
- * 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
@@ -27,6 +27,7 @@
#include <string.h>
#include <fcntl.h>
#include <thread_db.h>
+#include "jni.h"
#include "libproc_impl.h"
#define SA_ALTROOT "SA_ALTROOT"
@@ -112,7 +113,8 @@
}
// initialize libproc
-bool init_libproc(bool debug) {
+JNIEXPORT bool
+init_libproc(bool debug) {
// init debug mode
_libsaproc_debug = debug;
@@ -149,7 +151,8 @@
// ps_prochandle cleanup
// ps_prochandle cleanup
-void Prelease(struct ps_prochandle* ph) {
+JNIEXPORT void
+Prelease(struct ps_prochandle* ph) {
// do the "derived class" clean-up first
ph->ops->release(ph);
destroy_lib_info(ph);
@@ -398,7 +401,8 @@
// proc service functions
// get process id
-pid_t ps_getpid(struct ps_prochandle *ph) {
+JNIEXPORT pid_t
+ps_getpid(struct ps_prochandle *ph) {
return ph->pid;
}
@@ -407,20 +411,23 @@
// 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
+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
+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
+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;
}
@@ -429,28 +436,33 @@
// 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
+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
+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
+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
+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
+ps_get_thread_area() {
print_debug("ps_get_thread_area not implemented\n");
return PS_OK;
}