< prev index next >

src/jdk.hotspot.agent/linux/native/libsaproc/LinuxDebuggerLocal.c

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2002, 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. --- 1,7 ---- /* ! * Copyright (c) 2002, 2019, 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.
*** 22,31 **** --- 22,32 ---- * */ #include <jni.h> #include "libproc.h" + #include "proc_service.h" #include <elf.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h>
*** 239,262 **** } /* * Class: sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal * Method: attach0 ! * Signature: (IZ)V */ ! JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_attach0__IZ ! (JNIEnv *env, jobject this_obj, jint jpid, jboolean is_in_container) { // For bitness checking, locate binary at /proc/jpid/exe char buf[PATH_MAX]; snprintf((char *) &buf, PATH_MAX, "/proc/%d/exe", jpid); verifyBitness(env, (char *) &buf); CHECK_EXCEPTION; char err_buf[200]; struct ps_prochandle* ph; ! if ((ph = Pgrab(jpid, err_buf, sizeof(err_buf), is_in_container)) == NULL) { char msg[230]; snprintf(msg, sizeof(msg), "Can't attach to the process: %s", err_buf); THROW_NEW_DEBUGGER_EXCEPTION(msg); } (*env)->SetLongField(env, this_obj, p_ps_prochandle_ID, (jlong)(intptr_t)ph); --- 240,263 ---- } /* * Class: sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal * Method: attach0 ! * Signature: (I)V */ ! JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_attach0__I ! (JNIEnv *env, jobject this_obj, jint jpid) { // For bitness checking, locate binary at /proc/jpid/exe char buf[PATH_MAX]; snprintf((char *) &buf, PATH_MAX, "/proc/%d/exe", jpid); verifyBitness(env, (char *) &buf); CHECK_EXCEPTION; char err_buf[200]; struct ps_prochandle* ph; ! if ((ph = Pgrab(jpid, err_buf, sizeof(err_buf))) == NULL) { char msg[230]; snprintf(msg, sizeof(msg), "Can't attach to the process: %s", err_buf); THROW_NEW_DEBUGGER_EXCEPTION(msg); } (*env)->SetLongField(env, this_obj, p_ps_prochandle_ID, (jlong)(intptr_t)ph);
< prev index next >