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.
|
||||
*
|
||||
* 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
|
||||
if (log_is_enabled(Info, exceptions)) {
|
||||
ResourceMark rm;
|
||||
log_info(exceptions)("Exception <%s> (" INTPTR_FORMAT
|
||||
") thrown in compiled method <%s> at PC " INTPTR_FORMAT
|
||||
" for thread " INTPTR_FORMAT,
|
||||
exception->print_value_string(),
|
||||
p2i((address)exception()),
|
||||
stringStream tempst;
|
||||
tempst.print("compiled method <%s>\n"
|
||||
" at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT,
|
||||
nm->method()->print_value_string(), p2i(pc), p2i(thread));
|
||||
Exceptions::log_exception(exception, tempst);
|
||||
}
|
||||
// for AbortVMOnException flag
|
||||
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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -2780,14 +2780,14 @@ run:
|
|||
MORE_STACK(1);
|
||||
pc = METHOD->code_base() + continuation_bci;
|
||||
if (log_is_enabled(Info, exceptions)) {
|
||||
ResourceMark rm;
|
||||
log_info(exceptions)("Exception <%s> (" INTPTR_FORMAT ")\n"
|
||||
" thrown in interpreter method <%s>\n"
|
||||
ResourceMark rm(thread);
|
||||
stringStream tempst;
|
||||
tempst.print("interpreter method <%s>\n"
|
||||
" at bci %d, continuing at %d for thread " INTPTR_FORMAT,
|
||||
except_oop->print_value_string(), p2i(except_oop()),
|
||||
METHOD->print_value_string(),
|
||||
(int)(istate->bcp() - METHOD->code_base()),
|
||||
(int)continuation_bci, p2i(THREAD));
|
||||
Exceptions::log_exception(except_oop, tempst);
|
||||
}
|
||||
// for AbortVMOnException flag
|
||||
Exceptions::debug_check_abort(except_oop);
|
||||
|
@ -2798,13 +2798,13 @@ run:
|
|||
}
|
||||
if (log_is_enabled(Info, exceptions)) {
|
||||
ResourceMark rm;
|
||||
log_info(exceptions)("Exception <%s> (" INTPTR_FORMAT ")\n"
|
||||
" thrown in interpreter method <%s>\n"
|
||||
stringStream tempst;
|
||||
tempst.print("interpreter method <%s>\n"
|
||||
" at bci %d, unwinding for thread " INTPTR_FORMAT,
|
||||
except_oop->print_value_string(), p2i(except_oop()),
|
||||
METHOD->print_value_string(),
|
||||
(int)(istate->bcp() - METHOD->code_base()),
|
||||
p2i(THREAD));
|
||||
Exceptions::log_exception(except_oop, tempst);
|
||||
}
|
||||
// for AbortVMOnException flag
|
||||
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.
|
||||
*
|
||||
* 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
|
||||
if (log_is_enabled(Info, exceptions)) {
|
||||
ResourceMark rm(thread);
|
||||
Symbol* message = java_lang_Throwable::detail_message(h_exception());
|
||||
stringStream tempst;
|
||||
if (message != NULL) {
|
||||
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"
|
||||
tempst.print("interpreter method <%s>\n"
|
||||
" at bci %d for thread " INTPTR_FORMAT,
|
||||
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.
|
||||
// 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.
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
|
||||
// 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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "memory/allocation.hpp"
|
||||
#include "oops/oopsHierarchy.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
#include "utilities/sizes.hpp"
|
||||
|
||||
// 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_helper(Handle exception, 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.
|
||||
*
|
||||
* 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());
|
||||
output.shouldContain("<a 'java/lang/RuntimeException': Test exception 1 for logging>");
|
||||
output.shouldContain(" thrown in interpreter method ");
|
||||
output.shouldContain(") thrown in compiled method ");
|
||||
output.shouldContain(" thrown in compiled method ");
|
||||
output.shouldContain("Exception 2 caught.");
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue