1 /*
  2  * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "classfile/javaClasses.hpp"
 27 #include "classfile/systemDictionary.hpp"
 28 #include "classfile/vmClasses.hpp"
 29 #include "classfile/vmSymbols.hpp"
 30 #include "compiler/compileBroker.hpp"
 31 #include "logging/log.hpp"
 32 #include "logging/logStream.hpp"
 33 #include "memory/resourceArea.hpp"
 34 #include "memory/universe.hpp"
 35 #include "oops/oop.inline.hpp"
 36 #include "runtime/handles.inline.hpp"
 37 #include "runtime/init.hpp"
 38 #include "runtime/java.hpp"
 39 #include "runtime/javaCalls.hpp"
 40 #include "runtime/javaThread.hpp"
 41 #include "runtime/os.hpp"
 42 #include "runtime/threadCritical.hpp"
 43 #include "runtime/atomic.hpp"
 44 #include "utilities/events.hpp"
 45 #include "utilities/exceptions.hpp"
 46 
 47 // Implementation of ThreadShadow
 48 void check_ThreadShadow() {
 49   const ByteSize offset1 = byte_offset_of(ThreadShadow, _pending_exception);
 50   const ByteSize offset2 = Thread::pending_exception_offset();
 51   if (offset1 != offset2) fatal("ThreadShadow::_pending_exception is not positioned correctly");
 52 }
 53 
 54 
 55 void ThreadShadow::set_pending_exception(oop exception, const char* file, int line) {
 56   assert(exception != NULL && oopDesc::is_oop(exception), "invalid exception oop");
 57   _pending_exception = exception;
 58   _exception_file    = file;
 59   _exception_line    = line;
 60 }
 61 
 62 void ThreadShadow::clear_pending_exception() {
 63   LogTarget(Debug, exceptions) lt;
 64   if (_pending_exception != NULL && lt.is_enabled()) {
 65     ResourceMark rm;
 66     LogStream ls(lt);
 67     ls.print("Thread::clear_pending_exception: cleared exception:");
 68     _pending_exception->print_on(&ls);
 69   }
 70   _pending_exception = NULL;
 71   _exception_file    = NULL;
 72   _exception_line    = 0;
 73 }
 74 
 75 void ThreadShadow::clear_pending_nonasync_exception() {
 76   // Do not clear probable async exceptions.
 77   if ((_pending_exception->klass() != vmClasses::InternalError_klass() ||
 78        java_lang_InternalError::during_unsafe_access(_pending_exception) != JNI_TRUE)) {
 79     clear_pending_exception();
 80   }
 81 }
 82 
 83 // Implementation of Exceptions
 84 
 85 bool Exceptions::special_exception(JavaThread* thread, const char* file, int line, Handle h_exception) {
 86   // bootstrapping check
 87   if (!Universe::is_fully_initialized()) {
 88    vm_exit_during_initialization(h_exception);
 89    ShouldNotReachHere();
 90   }
 91 
 92 #ifdef ASSERT
 93   // Check for trying to throw stack overflow before initialization is complete
 94   // to prevent infinite recursion trying to initialize stack overflow without
 95   // adequate stack space.
 96   // This can happen with stress testing a large value of StackShadowPages
 97   if (h_exception()->klass() == vmClasses::StackOverflowError_klass()) {
 98     InstanceKlass* ik = InstanceKlass::cast(h_exception->klass());
 99     assert(ik->is_initialized(),
100            "need to increase java_thread_min_stack_allowed calculation");
101   }
102 #endif // ASSERT
103 
104   if (!thread->can_call_java()) {
105     // We do not care what kind of exception we get for a thread which
106     // is compiling.  We just install a dummy exception object
107     thread->set_pending_exception(Universe::vm_exception(), file, line);
108     return true;
109   }
110 
111   return false;
112 }
113 
114 bool Exceptions::special_exception(JavaThread* thread, const char* file, int line, Symbol* h_name, const char* message) {
115   // bootstrapping check
116   if (!Universe::is_fully_initialized()) {
117     if (h_name == NULL) {
118       // at least an informative message.
119       vm_exit_during_initialization("Exception", message);
120     } else {
121       vm_exit_during_initialization(h_name, message);
122     }
123     ShouldNotReachHere();
124   }
125 
126   if (!thread->can_call_java()) {
127     // We do not care what kind of exception we get for a thread which
128     // is compiling.  We just install a dummy exception object
129     thread->set_pending_exception(Universe::vm_exception(), file, line);
130     return true;
131   }
132   return false;
133 }
134 
135 // This method should only be called from generated code,
136 // therefore the exception oop should be in the oopmap.
137 void Exceptions::_throw_oop(JavaThread* thread, const char* file, int line, oop exception) {
138   assert(exception != NULL, "exception should not be NULL");
139   Handle h_exception(thread, exception);
140   _throw(thread, file, line, h_exception);
141 }
142 
143 void Exceptions::_throw(JavaThread* thread, const char* file, int line, Handle h_exception, const char* message) {
144   ResourceMark rm(thread);
145   assert(h_exception() != NULL, "exception should not be NULL");
146 
147   // tracing (do this up front - so it works during boot strapping)
148   // Note, the print_value_string() argument is not called unless logging is enabled!
149   log_info(exceptions)("Exception <%s%s%s> (" PTR_FORMAT ") \n"
150                        "thrown [%s, line %d]\nfor thread " PTR_FORMAT,
151                        h_exception->print_value_string(),
152                        message ? ": " : "", message ? message : "",
153                        p2i(h_exception()), file, line, p2i(thread));
154 
155   // for AbortVMOnException flag
156   Exceptions::debug_check_abort(h_exception, message);
157 
158   // Check for special boot-strapping/compiler-thread handling
159   if (special_exception(thread, file, line, h_exception)) {
160     return;
161   }
162 
163   if (h_exception->is_a(vmClasses::VirtualMachineError_klass())) {
164     // Remove the ScopedValue bindings in case we got a virtual machine
165     // Error while we were trying to manipulate ScopedValue bindings.
166     thread->clear_scopedValueBindings();
167 
168     if (h_exception->is_a(vmClasses::OutOfMemoryError_klass())) {
169       count_out_of_memory_exceptions(h_exception);
170     }
171   }
172 
173   if (h_exception->is_a(vmClasses::LinkageError_klass())) {
174     Atomic::inc(&_linkage_errors, memory_order_relaxed);
175   }
176 
177   assert(h_exception->is_a(vmClasses::Throwable_klass()), "exception is not a subclass of java/lang/Throwable");
178 
179   // set the pending exception
180   thread->set_pending_exception(h_exception(), file, line);
181 
182   // vm log
183   Events::log_exception(thread, h_exception, message, file, line);
184 }
185 
186 
187 void Exceptions::_throw_msg(JavaThread* thread, const char* file, int line, Symbol* name, const char* message,
188                             Handle h_loader, Handle h_protection_domain) {
189   // Check for special boot-strapping/compiler-thread handling
190   if (special_exception(thread, file, line, name, message)) return;
191   // Create and throw exception
192   Handle h_cause(thread, NULL);
193   Handle h_exception = new_exception(thread, name, message, h_cause, h_loader, h_protection_domain);
194   _throw(thread, file, line, h_exception, message);
195 }
196 
197 void Exceptions::_throw_msg_cause(JavaThread* thread, const char* file, int line, Symbol* name, const char* message, Handle h_cause,
198                                   Handle h_loader, Handle h_protection_domain) {
199   // Check for special boot-strapping/compiler-thread handling
200   if (special_exception(thread, file, line, name, message)) return;
201   // Create and throw exception and init cause
202   Handle h_exception = new_exception(thread, name, message, h_cause, h_loader, h_protection_domain);
203   _throw(thread, file, line, h_exception, message);
204 }
205 
206 void Exceptions::_throw_cause(JavaThread* thread, const char* file, int line, Symbol* name, Handle h_cause,
207                               Handle h_loader, Handle h_protection_domain) {
208   // Check for special boot-strapping/compiler-thread handling
209   if (special_exception(thread, file, line, h_cause)) return;
210   // Create and throw exception
211   Handle h_exception = new_exception(thread, name, h_cause, h_loader, h_protection_domain);
212   _throw(thread, file, line, h_exception, NULL);
213 }
214 
215 void Exceptions::_throw_args(JavaThread* thread, const char* file, int line, Symbol* name, Symbol* signature, JavaCallArguments *args) {
216   // Check for special boot-strapping/compiler-thread handling
217   if (special_exception(thread, file, line, name, NULL)) return;
218   // Create and throw exception
219   Handle h_loader(thread, NULL);
220   Handle h_prot(thread, NULL);
221   Handle exception = new_exception(thread, name, signature, args, h_loader, h_prot);
222   _throw(thread, file, line, exception);
223 }
224 
225 
226 // Methods for default parameters.
227 // NOTE: These must be here (and not in the header file) because of include circularities.
228 void Exceptions::_throw_msg_cause(JavaThread* thread, const char* file, int line, Symbol* name, const char* message, Handle h_cause) {
229   _throw_msg_cause(thread, file, line, name, message, h_cause, Handle(thread, NULL), Handle(thread, NULL));
230 }
231 void Exceptions::_throw_msg(JavaThread* thread, const char* file, int line, Symbol* name, const char* message) {
232   _throw_msg(thread, file, line, name, message, Handle(thread, NULL), Handle(thread, NULL));
233 }
234 void Exceptions::_throw_cause(JavaThread* thread, const char* file, int line, Symbol* name, Handle h_cause) {
235   _throw_cause(thread, file, line, name, h_cause, Handle(thread, NULL), Handle(thread, NULL));
236 }
237 
238 
239 void Exceptions::throw_stack_overflow_exception(JavaThread* THREAD, const char* file, int line, const methodHandle& method) {
240   Handle exception;
241   if (!THREAD->has_pending_exception()) {
242     InstanceKlass* k = vmClasses::StackOverflowError_klass();
243     oop e = k->allocate_instance(CHECK);
244     exception = Handle(THREAD, e);  // fill_in_stack trace does gc
245     assert(k->is_initialized(), "need to increase java_thread_min_stack_allowed calculation");
246     if (StackTraceInThrowable) {
247       java_lang_Throwable::fill_in_stack_trace(exception, method);
248     }
249     // Increment counter for hs_err file reporting
250     Atomic::inc(&Exceptions::_stack_overflow_errors, memory_order_relaxed);
251   } else {
252     // if prior exception, throw that one instead
253     exception = Handle(THREAD, THREAD->pending_exception());
254   }
255   _throw(THREAD, file, line, exception);
256 }
257 
258 void Exceptions::fthrow(JavaThread* thread, const char* file, int line, Symbol* h_name, const char* format, ...) {
259   const int max_msg_size = 1024;
260   va_list ap;
261   va_start(ap, format);
262   char msg[max_msg_size];
263   os::vsnprintf(msg, max_msg_size, format, ap);
264   va_end(ap);
265   _throw_msg(thread, file, line, h_name, msg);
266 }
267 
268 
269 // Creates an exception oop, calls the <init> method with the given signature.
270 // and returns a Handle
271 Handle Exceptions::new_exception(JavaThread* thread, Symbol* name,
272                                  Symbol* signature, JavaCallArguments *args,
273                                  Handle h_loader, Handle h_protection_domain) {
274   assert(Universe::is_fully_initialized(),
275     "cannot be called during initialization");
276   assert(!thread->has_pending_exception(), "already has exception");
277 
278   Handle h_exception;
279 
280   // Resolve exception klass, and check for pending exception below.
281   Klass* klass = SystemDictionary::resolve_or_fail(name, h_loader, h_protection_domain, true, thread);
282 
283   if (!thread->has_pending_exception()) {
284     assert(klass != NULL, "klass must exist");
285     h_exception = JavaCalls::construct_new_instance(InstanceKlass::cast(klass),
286                                 signature,
287                                 args,
288                                 thread);
289   }
290 
291   // Check if another exception was thrown in the process, if so rethrow that one
292   if (thread->has_pending_exception()) {
293     h_exception = Handle(thread, thread->pending_exception());
294     thread->clear_pending_exception();
295   }
296   return h_exception;
297 }
298 
299 // Creates an exception oop, calls the <init> method with the given signature.
300 // and returns a Handle
301 // Initializes the cause if cause non-null
302 Handle Exceptions::new_exception(JavaThread* thread, Symbol* name,
303                                  Symbol* signature, JavaCallArguments *args,
304                                  Handle h_cause,
305                                  Handle h_loader, Handle h_protection_domain) {
306   Handle h_exception = new_exception(thread, name, signature, args, h_loader, h_protection_domain);
307 
308   // Future: object initializer should take a cause argument
309   if (h_cause.not_null()) {
310     assert(h_cause->is_a(vmClasses::Throwable_klass()),
311         "exception cause is not a subclass of java/lang/Throwable");
312     JavaValue result1(T_OBJECT);
313     JavaCallArguments args1;
314     args1.set_receiver(h_exception);
315     args1.push_oop(h_cause);
316     JavaCalls::call_virtual(&result1, h_exception->klass(),
317                                       vmSymbols::initCause_name(),
318                                       vmSymbols::throwable_throwable_signature(),
319                                       &args1,
320                                       thread);
321   }
322 
323   // Check if another exception was thrown in the process, if so rethrow that one
324   if (thread->has_pending_exception()) {
325     h_exception = Handle(thread, thread->pending_exception());
326     thread->clear_pending_exception();
327   }
328   return h_exception;
329 }
330 
331 // Convenience method. Calls either the <init>() or <init>(Throwable) method when
332 // creating a new exception
333 Handle Exceptions::new_exception(JavaThread* thread, Symbol* name,
334                                  Handle h_cause,
335                                  Handle h_loader, Handle h_protection_domain,
336                                  ExceptionMsgToUtf8Mode to_utf8_safe) {
337   JavaCallArguments args;
338   Symbol* signature = NULL;
339   if (h_cause.is_null()) {
340     signature = vmSymbols::void_method_signature();
341   } else {
342     signature = vmSymbols::throwable_void_signature();
343     args.push_oop(h_cause);
344   }
345   return new_exception(thread, name, signature, &args, h_loader, h_protection_domain);
346 }
347 
348 // Convenience method. Calls either the <init>() or <init>(String) method when
349 // creating a new exception
350 Handle Exceptions::new_exception(JavaThread* thread, Symbol* name,
351                                  const char* message, Handle h_cause,
352                                  Handle h_loader, Handle h_protection_domain,
353                                  ExceptionMsgToUtf8Mode to_utf8_safe) {
354   JavaCallArguments args;
355   Symbol* signature = NULL;
356   if (message == NULL) {
357     signature = vmSymbols::void_method_signature();
358   } else {
359     // There should be no pending exception. The caller is responsible for not calling
360     // this with a pending exception.
361     Handle incoming_exception;
362     if (thread->has_pending_exception()) {
363       incoming_exception = Handle(thread, thread->pending_exception());
364       thread->clear_pending_exception();
365       ResourceMark rm(thread);
366       assert(incoming_exception.is_null(), "Pending exception while throwing %s %s", name->as_C_string(), message);
367     }
368     Handle msg;
369     if (to_utf8_safe == safe_to_utf8) {
370       // Make a java UTF8 string.
371       msg = java_lang_String::create_from_str(message, thread);
372     } else {
373       // Make a java string keeping the encoding scheme of the original string.
374       msg = java_lang_String::create_from_platform_dependent_str(message, thread);
375     }
376     // If we get an exception from the allocation, prefer that to
377     // the exception we are trying to build, or the pending exception (in product mode)
378     if (thread->has_pending_exception()) {
379       Handle exception(thread, thread->pending_exception());
380       thread->clear_pending_exception();
381       return exception;
382     }
383     if (incoming_exception.not_null()) {
384       return incoming_exception;
385     }
386     args.push_oop(msg);
387     signature = vmSymbols::string_void_signature();
388   }
389   return new_exception(thread, name, signature, &args, h_cause, h_loader, h_protection_domain);
390 }
391 
392 // Another convenience method that creates handles for null class loaders and
393 // protection domains and null causes.
394 // If the last parameter 'to_utf8_mode' is safe_to_utf8,
395 // it means we can safely ignore the encoding scheme of the message string and
396 // convert it directly to a java UTF8 string. Otherwise, we need to take the
397 // encoding scheme of the string into account. One thing we should do at some
398 // point is to push this flag down to class java_lang_String since other
399 // classes may need similar functionalities.
400 Handle Exceptions::new_exception(JavaThread* thread, Symbol* name,
401                                  const char* message,
402                                  ExceptionMsgToUtf8Mode to_utf8_safe) {
403 
404   Handle       h_loader(thread, NULL);
405   Handle       h_prot(thread, NULL);
406   Handle       h_cause(thread, NULL);
407   return Exceptions::new_exception(thread, name, message, h_cause, h_loader,
408                                    h_prot, to_utf8_safe);
409 }
410 
411 // invokedynamic uses wrap_dynamic_exception for:
412 //    - bootstrap method resolution
413 //    - post call to MethodHandleNatives::linkCallSite
414 // dynamically computed constant uses wrap_dynamic_exception for:
415 //    - bootstrap method resolution
416 //    - post call to MethodHandleNatives::linkDynamicConstant
417 void Exceptions::wrap_dynamic_exception(bool is_indy, JavaThread* THREAD) {
418   if (THREAD->has_pending_exception()) {
419     bool log_indy = log_is_enabled(Debug, methodhandles, indy) && is_indy;
420     bool log_condy = log_is_enabled(Debug, methodhandles, condy) && !is_indy;
421     LogStreamHandle(Debug, methodhandles, indy) lsh_indy;
422     LogStreamHandle(Debug, methodhandles, condy) lsh_condy;
423     LogStream* ls = NULL;
424     if (log_indy) {
425       ls = &lsh_indy;
426     } else if (log_condy) {
427       ls = &lsh_condy;
428     }
429     oop exception = THREAD->pending_exception();
430 
431     // See the "Linking Exceptions" section for the invokedynamic instruction
432     // in JVMS 6.5.
433     if (exception->is_a(vmClasses::Error_klass())) {
434       // Pass through an Error, including BootstrapMethodError, any other form
435       // of linkage error, or say OutOfMemoryError
436       if (ls != NULL) {
437         ls->print_cr("bootstrap method invocation wraps BSME around " PTR_FORMAT, p2i(exception));
438         exception->print_on(ls);
439       }
440       return;
441     }
442 
443     // Otherwise wrap the exception in a BootstrapMethodError
444     if (ls != NULL) {
445       ls->print_cr("%s throws BSME for " PTR_FORMAT, is_indy ? "invokedynamic" : "dynamic constant", p2i(exception));
446       exception->print_on(ls);
447     }
448     Handle nested_exception(THREAD, exception);
449     THREAD->clear_pending_exception();
450     THROW_CAUSE(vmSymbols::java_lang_BootstrapMethodError(), nested_exception)
451   }
452 }
453 
454 // Exception counting for hs_err file
455 volatile int Exceptions::_stack_overflow_errors = 0;
456 volatile int Exceptions::_linkage_errors = 0;
457 volatile int Exceptions::_out_of_memory_error_java_heap_errors = 0;
458 volatile int Exceptions::_out_of_memory_error_metaspace_errors = 0;
459 volatile int Exceptions::_out_of_memory_error_class_metaspace_errors = 0;
460 
461 void Exceptions::count_out_of_memory_exceptions(Handle exception) {
462   if (Universe::is_out_of_memory_error_metaspace(exception())) {
463      Atomic::inc(&_out_of_memory_error_metaspace_errors, memory_order_relaxed);
464   } else if (Universe::is_out_of_memory_error_class_metaspace(exception())) {
465      Atomic::inc(&_out_of_memory_error_class_metaspace_errors, memory_order_relaxed);
466   } else {
467      // everything else reported as java heap OOM
468      Atomic::inc(&_out_of_memory_error_java_heap_errors, memory_order_relaxed);
469   }
470 }
471 
472 void print_oom_count(outputStream* st, const char *err, int count) {
473   if (count > 0) {
474     st->print_cr("OutOfMemoryError %s=%d", err, count);
475   }
476 }
477 
478 bool Exceptions::has_exception_counts() {
479   return (_stack_overflow_errors + _out_of_memory_error_java_heap_errors +
480          _out_of_memory_error_metaspace_errors + _out_of_memory_error_class_metaspace_errors) > 0;
481 }
482 
483 void Exceptions::print_exception_counts_on_error(outputStream* st) {
484   print_oom_count(st, "java_heap_errors", _out_of_memory_error_java_heap_errors);
485   print_oom_count(st, "metaspace_errors", _out_of_memory_error_metaspace_errors);
486   print_oom_count(st, "class_metaspace_errors", _out_of_memory_error_class_metaspace_errors);
487   if (_stack_overflow_errors > 0) {
488     st->print_cr("StackOverflowErrors=%d", _stack_overflow_errors);
489   }
490   if (_linkage_errors > 0) {
491     st->print_cr("LinkageErrors=%d", _linkage_errors);
492   }
493 }
494 
495 // Implementation of ExceptionMark
496 
497 ExceptionMark::ExceptionMark(JavaThread* thread) {
498   assert(thread == JavaThread::current(), "must be");
499   _thread  = thread;
500   check_no_pending_exception();
501 }
502 
503 ExceptionMark::ExceptionMark() {
504   _thread = JavaThread::current();
505   check_no_pending_exception();
506 }
507 
508 inline void ExceptionMark::check_no_pending_exception() {
509   if (_thread->has_pending_exception()) {
510     oop exception = _thread->pending_exception();
511     _thread->clear_pending_exception(); // Needed to avoid infinite recursion
512     exception->print();
513     fatal("ExceptionMark constructor expects no pending exceptions");
514   }
515 }
516 
517 
518 ExceptionMark::~ExceptionMark() {
519   if (_thread->has_pending_exception()) {
520     Handle exception(_thread, _thread->pending_exception());
521     _thread->clear_pending_exception(); // Needed to avoid infinite recursion
522     if (is_init_completed()) {
523       exception->print();
524       fatal("ExceptionMark destructor expects no pending exceptions");
525     } else {
526       vm_exit_during_initialization(exception);
527     }
528   }
529 }
530 
531 // ----------------------------------------------------------------------------------------
532 
533 // caller frees value_string if necessary
534 void Exceptions::debug_check_abort(const char *value_string, const char* message) {
535   if (AbortVMOnException != NULL && value_string != NULL &&
536       strstr(value_string, AbortVMOnException)) {
537     if (AbortVMOnExceptionMessage == NULL || (message != NULL &&
538         strstr(message, AbortVMOnExceptionMessage))) {
539       if (message == NULL) {
540         fatal("Saw %s, aborting", value_string);
541       } else {
542         fatal("Saw %s: %s, aborting", value_string, message);
543       }
544     }
545   }
546 }
547 
548 void Exceptions::debug_check_abort(Handle exception, const char* message) {
549   if (AbortVMOnException != NULL) {
550     debug_check_abort_helper(exception, message);
551   }
552 }
553 
554 void Exceptions::debug_check_abort_helper(Handle exception, const char* message) {
555   ResourceMark rm;
556   if (message == NULL && exception->is_a(vmClasses::Throwable_klass())) {
557     oop msg = java_lang_Throwable::message(exception());
558     if (msg != NULL) {
559       message = java_lang_String::as_utf8_string(msg);
560     }
561   }
562   debug_check_abort(exception()->klass()->external_name(), message);
563 }
564 
565 // for logging exceptions
566 void Exceptions::log_exception(Handle exception, const char* message) {
567   ResourceMark rm;
568   Symbol* detail_message = java_lang_Throwable::detail_message(exception());
569   if (detail_message != NULL) {
570     log_info(exceptions)("Exception <%s: %s>\n thrown in %s",
571                          exception->print_value_string(),
572                          detail_message->as_C_string(),
573                          message);
574   } else {
575     log_info(exceptions)("Exception <%s>\n thrown in %s",
576                          exception->print_value_string(),
577                          message);
578   }
579 }