mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
Merge
This commit is contained in:
commit
dd9a6fc8eb
17 changed files with 311 additions and 88 deletions
|
@ -38,6 +38,8 @@
|
||||||
#import <dlfcn.h>
|
#import <dlfcn.h>
|
||||||
#import <limits.h>
|
#import <limits.h>
|
||||||
#import <errno.h>
|
#import <errno.h>
|
||||||
|
#import <sys/types.h>
|
||||||
|
#import <sys/ptrace.h>
|
||||||
|
|
||||||
jboolean debug = JNI_FALSE;
|
jboolean debug = JNI_FALSE;
|
||||||
|
|
||||||
|
@ -430,6 +432,73 @@ Java_sun_jvm_hotspot_debugger_macosx_MacOSXDebuggerLocal_translateTID0(
|
||||||
return (jint) usable_tid;
|
return (jint) usable_tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool ptrace_continue(pid_t pid, int signal) {
|
||||||
|
// pass the signal to the process so we don't swallow it
|
||||||
|
int res;
|
||||||
|
if ((res = ptrace(PT_CONTINUE, pid, (caddr_t)1, signal)) < 0) {
|
||||||
|
fprintf(stderr, "attach: ptrace(PT_CONTINUE, %d) failed with %d\n", pid, res);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// waits until the ATTACH has stopped the process
|
||||||
|
// by signal SIGSTOP
|
||||||
|
static bool ptrace_waitpid(pid_t pid) {
|
||||||
|
int ret;
|
||||||
|
int status;
|
||||||
|
while (true) {
|
||||||
|
// Wait for debuggee to stop.
|
||||||
|
ret = waitpid(pid, &status, 0);
|
||||||
|
if (ret >= 0) {
|
||||||
|
if (WIFSTOPPED(status)) {
|
||||||
|
// Any signal will stop the thread, make sure it is SIGSTOP. Otherwise SIGSTOP
|
||||||
|
// will still be pending and delivered when the process is DETACHED and the process
|
||||||
|
// will go to sleep.
|
||||||
|
if (WSTOPSIG(status) == SIGSTOP) {
|
||||||
|
// Debuggee stopped by SIGSTOP.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!ptrace_continue(pid, WSTOPSIG(status))) {
|
||||||
|
fprintf(stderr, "attach: Failed to correctly attach to VM. VM might HANG! [PTRACE_CONT failed, stopped by %d]\n", WSTOPSIG(status));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "attach: waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (errno) {
|
||||||
|
case EINTR:
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
case ECHILD:
|
||||||
|
fprintf(stderr, "attach: waitpid() failed. Child process pid (%d) does not exist \n", pid);
|
||||||
|
break;
|
||||||
|
case EINVAL:
|
||||||
|
fprintf(stderr, "attach: waitpid() failed. Invalid options argument.\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "attach: waitpid() failed. Unexpected error %d\n",errno);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// attach to a process/thread specified by "pid"
|
||||||
|
static bool ptrace_attach(pid_t pid) {
|
||||||
|
int res;
|
||||||
|
if ((res = ptrace(PT_ATTACH, pid, 0, 0)) < 0) {
|
||||||
|
fprintf(stderr, "ptrace(PT_ATTACH, %d) failed with %d\n", pid, res);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return ptrace_waitpid(pid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
|
* Class: sun_jvm_hotspot_debugger_bsd_BsdDebuggerLocal
|
||||||
* Method: attach0
|
* Method: attach0
|
||||||
|
@ -445,7 +514,8 @@ JNF_COCOA_ENTER(env);
|
||||||
else
|
else
|
||||||
debug = JNI_FALSE;
|
debug = JNI_FALSE;
|
||||||
if (debug) printf("attach0 called for jpid=%d\n", (int)jpid);
|
if (debug) printf("attach0 called for jpid=%d\n", (int)jpid);
|
||||||
|
|
||||||
|
// get the task from the pid
|
||||||
kern_return_t result;
|
kern_return_t result;
|
||||||
task_t gTask = 0;
|
task_t gTask = 0;
|
||||||
result = task_for_pid(mach_task_self(), jpid, &gTask);
|
result = task_for_pid(mach_task_self(), jpid, &gTask);
|
||||||
|
@ -455,6 +525,13 @@ JNF_COCOA_ENTER(env);
|
||||||
}
|
}
|
||||||
putTask(env, this_obj, gTask);
|
putTask(env, this_obj, gTask);
|
||||||
|
|
||||||
|
// use ptrace to stop the process
|
||||||
|
// on os x, ptrace only needs to be called on the process, not the individual threads
|
||||||
|
if (ptrace_attach(jpid) != true) {
|
||||||
|
mach_port_deallocate(mach_task_self(), gTask);
|
||||||
|
THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process");
|
||||||
|
}
|
||||||
|
|
||||||
id symbolicator = nil;
|
id symbolicator = nil;
|
||||||
id jrsSymbolicator = objc_lookUpClass("JRSSymbolicator");
|
id jrsSymbolicator = objc_lookUpClass("JRSSymbolicator");
|
||||||
if (jrsSymbolicator != nil) {
|
if (jrsSymbolicator != nil) {
|
||||||
|
@ -486,6 +563,21 @@ JNF_COCOA_ENTER(env);
|
||||||
if (debug) printf("detach0 called\n");
|
if (debug) printf("detach0 called\n");
|
||||||
|
|
||||||
task_t gTask = getTask(env, this_obj);
|
task_t gTask = getTask(env, this_obj);
|
||||||
|
|
||||||
|
// detach from the ptraced process causing it to resume execution
|
||||||
|
int pid;
|
||||||
|
kern_return_t k_res;
|
||||||
|
k_res = pid_for_task(gTask, &pid);
|
||||||
|
if (k_res != KERN_SUCCESS) {
|
||||||
|
fprintf(stderr, "detach: pid_for_task(%d) failed (%d)\n", pid, k_res);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int res = ptrace(PT_DETACH, pid, 0, 0);
|
||||||
|
if (res < 0) {
|
||||||
|
fprintf(stderr, "detach: ptrace(PT_DETACH, %d) failed (%d)\n", pid, res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mach_port_deallocate(mach_task_self(), gTask);
|
mach_port_deallocate(mach_task_self(), gTask);
|
||||||
id symbolicator = getSymbolicator(env, this_obj);
|
id symbolicator = getSymbolicator(env, this_obj);
|
||||||
if (symbolicator != nil) {
|
if (symbolicator != nil) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -91,6 +91,14 @@ void print_debug(const char* format,...) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_error(const char* format,...) {
|
||||||
|
va_list alist;
|
||||||
|
va_start(alist, format);
|
||||||
|
fputs("ERROR: ", stderr);
|
||||||
|
vfprintf(stderr, format, alist);
|
||||||
|
va_end(alist);
|
||||||
|
}
|
||||||
|
|
||||||
bool is_debug() {
|
bool is_debug() {
|
||||||
return _libsaproc_debug;
|
return _libsaproc_debug;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -107,6 +107,7 @@ struct ps_prochandle {
|
||||||
int pathmap_open(const char* name);
|
int pathmap_open(const char* name);
|
||||||
|
|
||||||
void print_debug(const char* format,...);
|
void print_debug(const char* format,...);
|
||||||
|
void print_error(const char* format,...);
|
||||||
bool is_debug();
|
bool is_debug();
|
||||||
|
|
||||||
typedef bool (*thread_info_callback)(struct ps_prochandle* ph, pthread_t pid, lwpid_t lwpid);
|
typedef bool (*thread_info_callback)(struct ps_prochandle* ph, pthread_t pid, lwpid_t lwpid);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -129,42 +129,66 @@ static bool process_get_lwp_info(struct ps_prochandle *ph, lwpid_t lwp_id, void
|
||||||
return (errno == 0)? true: false;
|
return (errno == 0)? true: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool ptrace_continue(pid_t pid, int signal) {
|
||||||
|
// pass the signal to the process so we don't swallow it
|
||||||
|
if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) {
|
||||||
|
print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// waits until the ATTACH has stopped the process
|
||||||
|
// by signal SIGSTOP
|
||||||
|
static bool ptrace_waitpid(pid_t pid) {
|
||||||
|
int ret;
|
||||||
|
int status;
|
||||||
|
do {
|
||||||
|
// Wait for debuggee to stop.
|
||||||
|
ret = waitpid(pid, &status, 0);
|
||||||
|
if (ret >= 0) {
|
||||||
|
if (WIFSTOPPED(status)) {
|
||||||
|
// Any signal will stop the thread, make sure it is SIGSTOP. Otherwise SIGSTOP
|
||||||
|
// will still be pending and delivered when the process is DETACHED and the process
|
||||||
|
// will go to sleep.
|
||||||
|
if (WSTOPSIG(status) == SIGSTOP) {
|
||||||
|
// Debuggee stopped by SIGSTOP.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!ptrace_continue(pid, WSTOPSIG(status))) {
|
||||||
|
print_error("Failed to correctly attach to VM. VM might HANG! [PTRACE_CONT failed, stopped by %d]\n", WSTOPSIG(status));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (errno) {
|
||||||
|
case EINTR:
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
case ECHILD:
|
||||||
|
print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
|
||||||
|
break;
|
||||||
|
case EINVAL:
|
||||||
|
print_debug("waitpid() failed. Invalid options argument.\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
print_debug("waitpid() failed. Unexpected error %d\n",errno);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} while(true);
|
||||||
|
}
|
||||||
|
|
||||||
// attach to a process/thread specified by "pid"
|
// attach to a process/thread specified by "pid"
|
||||||
static bool ptrace_attach(pid_t pid) {
|
static bool ptrace_attach(pid_t pid) {
|
||||||
if (ptrace(PT_ATTACH, pid, NULL, 0) < 0) {
|
if (ptrace(PT_ATTACH, pid, NULL, 0) < 0) {
|
||||||
print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid);
|
print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
int ret;
|
return ptrace_waitpid(pid);
|
||||||
int status;
|
|
||||||
do {
|
|
||||||
// Wait for debuggee to stop.
|
|
||||||
ret = waitpid(pid, &status, 0);
|
|
||||||
if (ret >= 0) {
|
|
||||||
if (WIFSTOPPED(status)) {
|
|
||||||
// Debuggee stopped.
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (errno) {
|
|
||||||
case EINTR:
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case ECHILD:
|
|
||||||
print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
|
|
||||||
break;
|
|
||||||
case EINVAL:
|
|
||||||
print_debug("waitpid() failed. Invalid options argument.\n");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
print_debug("waitpid() failed. Unexpected error %d\n",errno);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} while(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -92,6 +92,14 @@ void print_debug(const char* format,...) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_error(const char* format,...) {
|
||||||
|
va_list alist;
|
||||||
|
va_start(alist, format);
|
||||||
|
fputs("ERROR: ", stderr);
|
||||||
|
vfprintf(stderr, format, alist);
|
||||||
|
va_end(alist);
|
||||||
|
}
|
||||||
|
|
||||||
bool is_debug() {
|
bool is_debug() {
|
||||||
return _libsaproc_debug;
|
return _libsaproc_debug;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -105,6 +105,7 @@ struct ps_prochandle {
|
||||||
int pathmap_open(const char* name);
|
int pathmap_open(const char* name);
|
||||||
|
|
||||||
void print_debug(const char* format,...);
|
void print_debug(const char* format,...);
|
||||||
|
void print_error(const char* format,...);
|
||||||
bool is_debug();
|
bool is_debug();
|
||||||
|
|
||||||
typedef bool (*thread_info_callback)(struct ps_prochandle* ph, pthread_t pid, lwpid_t lwpid);
|
typedef bool (*thread_info_callback)(struct ps_prochandle* ph, pthread_t pid, lwpid_t lwpid);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/ptrace.h>
|
#include <sys/ptrace.h>
|
||||||
#include "libproc_impl.h"
|
#include "libproc_impl.h"
|
||||||
|
@ -142,46 +143,71 @@ static bool process_get_lwp_regs(struct ps_prochandle* ph, pid_t pid, struct use
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool ptrace_continue(pid_t pid, int signal) {
|
||||||
|
// pass the signal to the process so we don't swallow it
|
||||||
|
if (ptrace(PTRACE_CONT, pid, NULL, signal) < 0) {
|
||||||
|
print_debug("ptrace(PTRACE_CONT, ..) failed for %d\n", pid);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// waits until the ATTACH has stopped the process
|
||||||
|
// by signal SIGSTOP
|
||||||
|
static bool ptrace_waitpid(pid_t pid) {
|
||||||
|
int ret;
|
||||||
|
int status;
|
||||||
|
while (true) {
|
||||||
|
// Wait for debuggee to stop.
|
||||||
|
ret = waitpid(pid, &status, 0);
|
||||||
|
if (ret == -1 && errno == ECHILD) {
|
||||||
|
// try cloned process.
|
||||||
|
ret = waitpid(pid, &status, __WALL);
|
||||||
|
}
|
||||||
|
if (ret >= 0) {
|
||||||
|
if (WIFSTOPPED(status)) {
|
||||||
|
// Any signal will stop the thread, make sure it is SIGSTOP. Otherwise SIGSTOP
|
||||||
|
// will still be pending and delivered when the process is DETACHED and the process
|
||||||
|
// will go to sleep.
|
||||||
|
if (WSTOPSIG(status) == SIGSTOP) {
|
||||||
|
// Debuggee stopped by SIGSTOP.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!ptrace_continue(pid, WSTOPSIG(status))) {
|
||||||
|
print_error("Failed to correctly attach to VM. VM might HANG! [PTRACE_CONT failed, stopped by %d]\n", WSTOPSIG(status));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (errno) {
|
||||||
|
case EINTR:
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
case ECHILD:
|
||||||
|
print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
|
||||||
|
break;
|
||||||
|
case EINVAL:
|
||||||
|
print_debug("waitpid() failed. Invalid options argument.\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
print_debug("waitpid() failed. Unexpected error %d\n",errno);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// attach to a process/thread specified by "pid"
|
// attach to a process/thread specified by "pid"
|
||||||
static bool ptrace_attach(pid_t pid) {
|
static bool ptrace_attach(pid_t pid) {
|
||||||
if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) < 0) {
|
if (ptrace(PTRACE_ATTACH, pid, NULL, NULL) < 0) {
|
||||||
print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid);
|
print_debug("ptrace(PTRACE_ATTACH, ..) failed for %d\n", pid);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
int ret;
|
return ptrace_waitpid(pid);
|
||||||
int status;
|
|
||||||
do {
|
|
||||||
// Wait for debuggee to stop.
|
|
||||||
ret = waitpid(pid, &status, 0);
|
|
||||||
if (ret == -1 && errno == ECHILD) {
|
|
||||||
// try cloned process.
|
|
||||||
ret = waitpid(pid, &status, __WALL);
|
|
||||||
}
|
|
||||||
if (ret >= 0) {
|
|
||||||
if (WIFSTOPPED(status)) {
|
|
||||||
// Debuggee stopped.
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
print_debug("waitpid(): Child process exited/terminated (status = 0x%x)\n", status);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (errno) {
|
|
||||||
case EINTR:
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case ECHILD:
|
|
||||||
print_debug("waitpid() failed. Child process pid (%d) does not exist \n", pid);
|
|
||||||
break;
|
|
||||||
case EINVAL:
|
|
||||||
print_debug("waitpid() failed. Invalid options argument.\n");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
print_debug("waitpid() failed. Unexpected error %d\n",errno);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} while(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,15 +61,13 @@ public class CMSCollector extends VMObject {
|
||||||
CMSBitMap markBitMap = markBitMap();
|
CMSBitMap markBitMap = markBitMap();
|
||||||
long addressSize = VM.getVM().getAddressSize();
|
long addressSize = VM.getVM().getAddressSize();
|
||||||
if ( markBitMap.isMarked(addr) && markBitMap.isMarked(addr.addOffsetTo(1*addressSize)) ) {
|
if ( markBitMap.isMarked(addr) && markBitMap.isMarked(addr.addOffsetTo(1*addressSize)) ) {
|
||||||
System.err.println("Printezis bits are set...");
|
|
||||||
Address nextOneAddr = markBitMap.getNextMarkedWordAddress(addr.addOffsetTo(2*addressSize));
|
Address nextOneAddr = markBitMap.getNextMarkedWordAddress(addr.addOffsetTo(2*addressSize));
|
||||||
//return size in bytes
|
//return size in bytes
|
||||||
long size = (nextOneAddr.addOffsetTo(1*addressSize)).minus(addr);
|
long size = (nextOneAddr.addOffsetTo(1*addressSize)).minus(addr);
|
||||||
return size;
|
return size;
|
||||||
} else {
|
} else {
|
||||||
//missing Printezis marks
|
//missing Printezis marks
|
||||||
System.err.println("Missing Printszis marks...");
|
return -1;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,6 @@ public class CompactibleFreeListSpace extends CompactibleSpace {
|
||||||
//Find the object size using Printezis bits and skip over
|
//Find the object size using Printezis bits and skip over
|
||||||
long size = collector().blockSizeUsingPrintezisBits(cur);
|
long size = collector().blockSizeUsingPrintezisBits(cur);
|
||||||
if (size == -1) {
|
if (size == -1) {
|
||||||
System.err.println("Printezis bits not set...");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cur = cur.addOffsetTo(adjustObjectSizeInBytes(size));
|
cur = cur.addOffsetTo(adjustObjectSizeInBytes(size));
|
||||||
|
|
|
@ -184,7 +184,6 @@ public class MethodData extends Metadata {
|
||||||
if (trapReasonName[index] == null) {
|
if (trapReasonName[index] == null) {
|
||||||
throw new InternalError("missing reason for " + index);
|
throw new InternalError("missing reason for " + index);
|
||||||
}
|
}
|
||||||
System.out.println(trapReasonName[index]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -335,7 +335,6 @@ public class ObjectHeap {
|
||||||
}
|
}
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
//Find the object size using Printezis bits and skip over
|
//Find the object size using Printezis bits and skip over
|
||||||
System.err.println("Finding object size using Printezis bits and skipping over...");
|
|
||||||
long size = 0;
|
long size = 0;
|
||||||
|
|
||||||
if ( (cmsSpaceOld != null) && cmsSpaceOld.contains(handle) ){
|
if ( (cmsSpaceOld != null) && cmsSpaceOld.contains(handle) ){
|
||||||
|
|
|
@ -94,7 +94,12 @@ CXXFLAGS = \
|
||||||
# This is VERY important! The version define must only be supplied to vm_version.o
|
# This is VERY important! The version define must only be supplied to vm_version.o
|
||||||
# If not, ccache will not re-use the cache at all, since the version string might contain
|
# If not, ccache will not re-use the cache at all, since the version string might contain
|
||||||
# a time and date.
|
# a time and date.
|
||||||
vm_version.o: CXXFLAGS += ${JRE_VERSION}
|
CXXFLAGS/vm_version.o += ${JRE_VERSION}
|
||||||
|
|
||||||
|
CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
|
||||||
|
|
||||||
|
# File specific flags
|
||||||
|
CXXFLAGS += $(CXXFLAGS/BYFILE)
|
||||||
|
|
||||||
ifdef DEFAULT_LIBPATH
|
ifdef DEFAULT_LIBPATH
|
||||||
CXXFLAGS += -DDEFAULT_LIBPATH="\"$(DEFAULT_LIBPATH)\""
|
CXXFLAGS += -DDEFAULT_LIBPATH="\"$(DEFAULT_LIBPATH)\""
|
||||||
|
|
|
@ -100,7 +100,13 @@ CXXFLAGS = \
|
||||||
# This is VERY important! The version define must only be supplied to vm_version.o
|
# This is VERY important! The version define must only be supplied to vm_version.o
|
||||||
# If not, ccache will not re-use the cache at all, since the version string might contain
|
# If not, ccache will not re-use the cache at all, since the version string might contain
|
||||||
# a time and date.
|
# a time and date.
|
||||||
vm_version.o: CXXFLAGS += ${JRE_VERSION}
|
CXXFLAGS/vm_version.o += ${JRE_VERSION}
|
||||||
|
|
||||||
|
CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
|
||||||
|
|
||||||
|
# File specific flags
|
||||||
|
CXXFLAGS += $(CXXFLAGS/BYFILE)
|
||||||
|
|
||||||
|
|
||||||
ifndef JAVASE_EMBEDDED
|
ifndef JAVASE_EMBEDDED
|
||||||
ifneq (${ARCH},arm)
|
ifneq (${ARCH},arm)
|
||||||
|
|
|
@ -88,7 +88,13 @@ CXXFLAGS = \
|
||||||
# This is VERY important! The version define must only be supplied to vm_version.o
|
# This is VERY important! The version define must only be supplied to vm_version.o
|
||||||
# If not, ccache will not re-use the cache at all, since the version string might contain
|
# If not, ccache will not re-use the cache at all, since the version string might contain
|
||||||
# a time and date.
|
# a time and date.
|
||||||
vm_version.o: CXXFLAGS += ${JRE_VERSION}
|
CXXFLAGS/vm_version.o += ${JRE_VERSION}
|
||||||
|
|
||||||
|
CXXFLAGS/BYFILE = $(CXXFLAGS/$@)
|
||||||
|
|
||||||
|
# File specific flags
|
||||||
|
CXXFLAGS += $(CXXFLAGS/BYFILE)
|
||||||
|
|
||||||
|
|
||||||
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
|
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
|
||||||
CFLAGS += $(CFLAGS_WARN)
|
CFLAGS += $(CFLAGS_WARN)
|
||||||
|
|
|
@ -1940,7 +1940,7 @@ int os::sigexitnum_pd(){
|
||||||
|
|
||||||
// a counter for each possible signal value, including signal_thread exit signal
|
// a counter for each possible signal value, including signal_thread exit signal
|
||||||
static volatile jint pending_signals[NSIG+1] = { 0 };
|
static volatile jint pending_signals[NSIG+1] = { 0 };
|
||||||
static HANDLE sig_sem;
|
static HANDLE sig_sem = NULL;
|
||||||
|
|
||||||
void os::signal_init_pd() {
|
void os::signal_init_pd() {
|
||||||
// Initialize signal structures
|
// Initialize signal structures
|
||||||
|
@ -1970,10 +1970,11 @@ void os::signal_init_pd() {
|
||||||
|
|
||||||
void os::signal_notify(int signal_number) {
|
void os::signal_notify(int signal_number) {
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
if (sig_sem != NULL) {
|
||||||
Atomic::inc(&pending_signals[signal_number]);
|
Atomic::inc(&pending_signals[signal_number]);
|
||||||
ret = ::ReleaseSemaphore(sig_sem, 1, NULL);
|
ret = ::ReleaseSemaphore(sig_sem, 1, NULL);
|
||||||
assert(ret != 0, "ReleaseSemaphore() failed");
|
assert(ret != 0, "ReleaseSemaphore() failed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_pending_signals(bool wait_for_signal) {
|
static int check_pending_signals(bool wait_for_signal) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -61,7 +61,8 @@
|
||||||
# include "bytes_ppc.hpp"
|
# include "bytes_ppc.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NOFAILOVER_MAJOR_VERSION 51
|
#define NOFAILOVER_MAJOR_VERSION 51
|
||||||
|
#define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION 52
|
||||||
|
|
||||||
// Access to external entry for VerifyClassCodes - old byte code verifier
|
// Access to external entry for VerifyClassCodes - old byte code verifier
|
||||||
|
|
||||||
|
@ -2317,6 +2318,11 @@ void ClassVerifier::verify_invoke_instructions(
|
||||||
types = (1 << JVM_CONSTANT_InterfaceMethodref) |
|
types = (1 << JVM_CONSTANT_InterfaceMethodref) |
|
||||||
(1 << JVM_CONSTANT_Methodref);
|
(1 << JVM_CONSTANT_Methodref);
|
||||||
break;
|
break;
|
||||||
|
case Bytecodes::_invokestatic:
|
||||||
|
types = (_klass->major_version() < STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION) ?
|
||||||
|
(1 << JVM_CONSTANT_Methodref) :
|
||||||
|
((1 << JVM_CONSTANT_InterfaceMethodref) | (1 << JVM_CONSTANT_Methodref));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
types = 1 << JVM_CONSTANT_Methodref;
|
types = 1 << JVM_CONSTANT_Methodref;
|
||||||
}
|
}
|
||||||
|
|
44
hotspot/test/runtime/8007736/TestStaticIF.java
Normal file
44
hotspot/test/runtime/8007736/TestStaticIF.java
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013, 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.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8007736
|
||||||
|
* @summary Test static interface method.
|
||||||
|
* @run main/othervm -Xverify:all TestStaticIF
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TestStaticIF implements StaticMethodInInterface {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.printf("main: %s%n", StaticMethodInInterface.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface StaticMethodInInterface {
|
||||||
|
|
||||||
|
public static String get() {
|
||||||
|
return "Hello from StaticMethodInInterface.get()";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue