391 hc_backtrace_offset = 0, |
391 hc_backtrace_offset = 0, |
392 hc_detailMessage_offset = 1, |
392 hc_detailMessage_offset = 1, |
393 hc_cause_offset = 2, // New since 1.4 |
393 hc_cause_offset = 2, // New since 1.4 |
394 hc_stackTrace_offset = 3 // New since 1.4 |
394 hc_stackTrace_offset = 3 // New since 1.4 |
395 }; |
395 }; |
|
396 enum { |
|
397 hc_static_unassigned_stacktrace_offset = 0 // New since 1.7 |
|
398 }; |
396 // Trace constants |
399 // Trace constants |
397 enum { |
400 enum { |
398 trace_methods_offset = 0, |
401 trace_methods_offset = 0, |
399 trace_bcis_offset = 1, |
402 trace_bcis_offset = 1, |
400 trace_next_offset = 2, |
403 trace_next_offset = 2, |
404 |
407 |
405 static int backtrace_offset; |
408 static int backtrace_offset; |
406 static int detailMessage_offset; |
409 static int detailMessage_offset; |
407 static int cause_offset; |
410 static int cause_offset; |
408 static int stackTrace_offset; |
411 static int stackTrace_offset; |
|
412 static int static_unassigned_stacktrace_offset; |
409 |
413 |
410 // Printing |
414 // Printing |
411 static char* print_stack_element_to_buffer(methodOop method, int bci); |
415 static char* print_stack_element_to_buffer(methodOop method, int bci); |
412 static void print_to_stream(Handle stream, const char* str); |
416 static void print_to_stream(Handle stream, const char* str); |
413 // StackTrace (programmatic access, new since 1.4) |
417 // StackTrace (programmatic access, new since 1.4) |
414 static void clear_stacktrace(oop throwable); |
418 static void clear_stacktrace(oop throwable); |
415 // No stack trace available |
419 // No stack trace available |
416 static const char* no_stack_trace_message(); |
420 static const char* no_stack_trace_message(); |
|
421 // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed) |
|
422 static void set_stacktrace(oop throwable, oop st_element_array); |
|
423 static oop unassigned_stacktrace(); |
417 |
424 |
418 public: |
425 public: |
419 // Backtrace |
426 // Backtrace |
420 static oop backtrace(oop throwable); |
427 static oop backtrace(oop throwable); |
421 static void set_backtrace(oop throwable, oop value); |
428 static void set_backtrace(oop throwable, oop value); |
436 |
443 |
437 // Allocate space for backtrace (created but stack trace not filled in) |
444 // Allocate space for backtrace (created but stack trace not filled in) |
438 static void allocate_backtrace(Handle throwable, TRAPS); |
445 static void allocate_backtrace(Handle throwable, TRAPS); |
439 // Fill in current stack trace for throwable with preallocated backtrace (no GC) |
446 // Fill in current stack trace for throwable with preallocated backtrace (no GC) |
440 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable); |
447 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable); |
441 |
|
442 // Fill in current stack trace, can cause GC |
448 // Fill in current stack trace, can cause GC |
443 static void fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS); |
449 static void fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS); |
444 static void fill_in_stack_trace(Handle throwable, methodHandle method = methodHandle()); |
450 static void fill_in_stack_trace(Handle throwable, methodHandle method = methodHandle()); |
445 // Programmatic access to stack trace |
451 // Programmatic access to stack trace |
446 static oop get_stack_trace_element(oop throwable, int index, TRAPS); |
452 static oop get_stack_trace_element(oop throwable, int index, TRAPS); |