mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8144953: runtime/CommandLine/TraceExceptionsTest.java fails when exception is thrown in compiled code
Added long-form logging message to three places in code, allowing TraceExceptionsTest.java to pass with compiled code. Reviewed-by: dholmes, coleenp, lfoltan
This commit is contained in:
parent
baa19166d1
commit
f4555ca41f
6 changed files with 48 additions and 40 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2016, 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
|
||||||
|
@ -551,12 +551,11 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t
|
||||||
// tracing
|
// tracing
|
||||||
if (log_is_enabled(Info, exceptions)) {
|
if (log_is_enabled(Info, exceptions)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(exceptions)("Exception <%s> (" INTPTR_FORMAT
|
stringStream tempst;
|
||||||
") thrown in compiled method <%s> at PC " INTPTR_FORMAT
|
tempst.print("compiled method <%s>\n"
|
||||||
" for thread " INTPTR_FORMAT,
|
" at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT,
|
||||||
exception->print_value_string(),
|
nm->method()->print_value_string(), p2i(pc), p2i(thread));
|
||||||
p2i((address)exception()),
|
Exceptions::log_exception(exception, tempst);
|
||||||
nm->method()->print_value_string(), p2i(pc), p2i(thread));
|
|
||||||
}
|
}
|
||||||
// for AbortVMOnException flag
|
// for AbortVMOnException flag
|
||||||
Exceptions::debug_check_abort(exception);
|
Exceptions::debug_check_abort(exception);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2016, 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
|
||||||
|
@ -2780,14 +2780,14 @@ run:
|
||||||
MORE_STACK(1);
|
MORE_STACK(1);
|
||||||
pc = METHOD->code_base() + continuation_bci;
|
pc = METHOD->code_base() + continuation_bci;
|
||||||
if (log_is_enabled(Info, exceptions)) {
|
if (log_is_enabled(Info, exceptions)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm(thread);
|
||||||
log_info(exceptions)("Exception <%s> (" INTPTR_FORMAT ")\n"
|
stringStream tempst;
|
||||||
" thrown in interpreter method <%s>\n"
|
tempst.print("interpreter method <%s>\n"
|
||||||
" at bci %d, continuing at %d for thread " INTPTR_FORMAT,
|
" at bci %d, continuing at %d for thread " INTPTR_FORMAT,
|
||||||
except_oop->print_value_string(), p2i(except_oop()),
|
METHOD->print_value_string(),
|
||||||
METHOD->print_value_string(),
|
(int)(istate->bcp() - METHOD->code_base()),
|
||||||
(int)(istate->bcp() - METHOD->code_base()),
|
(int)continuation_bci, p2i(THREAD));
|
||||||
(int)continuation_bci, p2i(THREAD));
|
Exceptions::log_exception(except_oop, tempst);
|
||||||
}
|
}
|
||||||
// for AbortVMOnException flag
|
// for AbortVMOnException flag
|
||||||
Exceptions::debug_check_abort(except_oop);
|
Exceptions::debug_check_abort(except_oop);
|
||||||
|
@ -2798,13 +2798,13 @@ run:
|
||||||
}
|
}
|
||||||
if (log_is_enabled(Info, exceptions)) {
|
if (log_is_enabled(Info, exceptions)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(exceptions)("Exception <%s> (" INTPTR_FORMAT ")\n"
|
stringStream tempst;
|
||||||
" thrown in interpreter method <%s>\n"
|
tempst.print("interpreter method <%s>\n"
|
||||||
" at bci %d, unwinding for thread " INTPTR_FORMAT,
|
" at bci %d, unwinding for thread " INTPTR_FORMAT,
|
||||||
except_oop->print_value_string(), p2i(except_oop()),
|
METHOD->print_value_string(),
|
||||||
METHOD->print_value_string(),
|
(int)(istate->bcp() - METHOD->code_base()),
|
||||||
(int)(istate->bcp() - METHOD->code_base()),
|
p2i(THREAD));
|
||||||
p2i(THREAD));
|
Exceptions::log_exception(except_oop, tempst);
|
||||||
}
|
}
|
||||||
// for AbortVMOnException flag
|
// for AbortVMOnException flag
|
||||||
Exceptions::debug_check_abort(except_oop);
|
Exceptions::debug_check_abort(except_oop);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2016, 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
|
||||||
|
@ -459,21 +459,11 @@ IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThrea
|
||||||
// tracing
|
// tracing
|
||||||
if (log_is_enabled(Info, exceptions)) {
|
if (log_is_enabled(Info, exceptions)) {
|
||||||
ResourceMark rm(thread);
|
ResourceMark rm(thread);
|
||||||
Symbol* message = java_lang_Throwable::detail_message(h_exception());
|
|
||||||
stringStream tempst;
|
stringStream tempst;
|
||||||
if (message != NULL) {
|
tempst.print("interpreter method <%s>\n"
|
||||||
tempst.print("Exception <%s: %s> (" INTPTR_FORMAT ")\n",
|
|
||||||
h_exception->print_value_string(), message->as_C_string(),
|
|
||||||
p2i(h_exception()));
|
|
||||||
} else {
|
|
||||||
tempst.print("Exception <%s> (" INTPTR_FORMAT ")\n",
|
|
||||||
h_exception->print_value_string(),
|
|
||||||
p2i(h_exception()));
|
|
||||||
}
|
|
||||||
tempst.print(" thrown in interpreter method <%s>\n"
|
|
||||||
" at bci %d for thread " INTPTR_FORMAT,
|
" at bci %d for thread " INTPTR_FORMAT,
|
||||||
h_method->print_value_string(), current_bci, p2i(thread));
|
h_method->print_value_string(), current_bci, p2i(thread));
|
||||||
LogHandle(exceptions)::info_stream()->print_raw_cr(tempst.as_string());
|
Exceptions::log_exception(h_exception, tempst);
|
||||||
}
|
}
|
||||||
// Don't go paging in something which won't be used.
|
// Don't go paging in something which won't be used.
|
||||||
// else if (extable->length() == 0) {
|
// else if (extable->length() == 0) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2016, 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
|
||||||
|
@ -502,3 +502,18 @@ void Exceptions::debug_check_abort_helper(Handle exception, const char* message)
|
||||||
}
|
}
|
||||||
debug_check_abort(exception()->klass()->external_name(), message);
|
debug_check_abort(exception()->klass()->external_name(), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for logging exceptions
|
||||||
|
void Exceptions::log_exception(Handle exception, stringStream tempst) {
|
||||||
|
ResourceMark rm;
|
||||||
|
Symbol* message = java_lang_Throwable::detail_message(exception());
|
||||||
|
if (message != NULL) {
|
||||||
|
log_info(exceptions)("Exception <%s: %s> (" INTPTR_FORMAT ")\n thrown in %s",
|
||||||
|
exception->print_value_string(),
|
||||||
|
message->as_C_string(), p2i(exception()), tempst.as_string());
|
||||||
|
} else {
|
||||||
|
log_info(exceptions)("Exception <%s> (" INTPTR_FORMAT ")\n thrown in %s",
|
||||||
|
exception->print_value_string(),
|
||||||
|
p2i(exception()), tempst.as_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2016, 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
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "memory/allocation.hpp"
|
#include "memory/allocation.hpp"
|
||||||
#include "oops/oopsHierarchy.hpp"
|
#include "oops/oopsHierarchy.hpp"
|
||||||
|
#include "utilities/ostream.hpp"
|
||||||
#include "utilities/sizes.hpp"
|
#include "utilities/sizes.hpp"
|
||||||
|
|
||||||
// This file provides the basic support for exception handling in the VM.
|
// This file provides the basic support for exception handling in the VM.
|
||||||
|
@ -177,6 +178,9 @@ class Exceptions {
|
||||||
static void debug_check_abort(Handle exception, const char* message = NULL);
|
static void debug_check_abort(Handle exception, const char* message = NULL);
|
||||||
static void debug_check_abort_helper(Handle exception, const char* message = NULL);
|
static void debug_check_abort_helper(Handle exception, const char* message = NULL);
|
||||||
static void debug_check_abort(const char *value_string, const char* message = NULL);
|
static void debug_check_abort(const char *value_string, const char* message = NULL);
|
||||||
|
|
||||||
|
// for logging exceptions
|
||||||
|
static void log_exception(Handle exception, stringStream tempst);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2016, 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
|
||||||
|
@ -40,7 +40,7 @@ public class ExceptionsTest {
|
||||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||||
output.shouldContain("<a 'java/lang/RuntimeException': Test exception 1 for logging>");
|
output.shouldContain("<a 'java/lang/RuntimeException': Test exception 1 for logging>");
|
||||||
output.shouldContain(" thrown in interpreter method ");
|
output.shouldContain(" thrown in interpreter method ");
|
||||||
output.shouldContain(") thrown in compiled method ");
|
output.shouldContain(" thrown in compiled method ");
|
||||||
output.shouldContain("Exception 2 caught.");
|
output.shouldContain("Exception 2 caught.");
|
||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue