479
480 class java_lang_Throwable: AllStatic {
481 friend class BacktraceBuilder;
482
483 private:
484 // Offsets
485 enum {
486 hc_backtrace_offset = 0,
487 hc_detailMessage_offset = 1,
488 hc_cause_offset = 2, // New since 1.4
489 hc_stackTrace_offset = 3 // New since 1.4
490 };
491 enum {
492 hc_static_unassigned_stacktrace_offset = 0 // New since 1.7
493 };
494 // Trace constants
495 enum {
496 trace_methods_offset = 0,
497 trace_bcis_offset = 1,
498 trace_mirrors_offset = 2,
499 trace_cprefs_offset = 3,
500 trace_next_offset = 4,
501 trace_size = 5,
502 trace_chunk_size = 32
503 };
504
505 static int backtrace_offset;
506 static int detailMessage_offset;
507 static int cause_offset;
508 static int stackTrace_offset;
509 static int static_unassigned_stacktrace_offset;
510
511 // Printing
512 static char* print_stack_element_to_buffer(Handle mirror, int method, int version, int bci, int cpref);
513 // StackTrace (programmatic access, new since 1.4)
514 static void clear_stacktrace(oop throwable);
515 // No stack trace available
516 static const char* no_stack_trace_message();
517 // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed)
518 static void set_stacktrace(oop throwable, oop st_element_array);
519 static oop unassigned_stacktrace();
520
521 public:
522 // Backtrace
523 static oop backtrace(oop throwable);
524 static void set_backtrace(oop throwable, oop value);
525 // Needed by JVMTI to filter out this internal field.
526 static int get_backtrace_offset() { return backtrace_offset;}
527 static int get_detailMessage_offset() { return detailMessage_offset;}
528 // Message
529 static oop message(oop throwable);
530 static oop message(Handle throwable);
531 static void set_message(oop throwable, oop value);
532 static Symbol* detail_message(oop throwable);
533 static void print_stack_element(outputStream *st, Handle mirror, int method,
534 int version, int bci, int cpref);
535 static void print_stack_element(outputStream *st, const methodHandle& method, int bci);
536 static void print_stack_usage(Handle stream);
537
538 // Allocate space for backtrace (created but stack trace not filled in)
539 static void allocate_backtrace(Handle throwable, TRAPS);
540 // Fill in current stack trace for throwable with preallocated backtrace (no GC)
541 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
542 // Fill in current stack trace, can cause GC
543 static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS);
544 static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
545 // Programmatic access to stack trace
546 static oop get_stack_trace_element(oop throwable, int index, TRAPS);
547 static int get_stack_trace_depth(oop throwable, TRAPS);
548 // Printing
549 static void print(oop throwable, outputStream* st);
550 static void print(Handle throwable, outputStream* st);
551 static void print_stack_trace(oop throwable, outputStream* st);
552 // Debugging
553 friend class JavaClasses;
554 };
1329 enum {
1330 hc_declaringClass_offset = 0,
1331 hc_methodName_offset = 1,
1332 hc_fileName_offset = 2,
1333 hc_lineNumber_offset = 3
1334 };
1335
1336 static int declaringClass_offset;
1337 static int methodName_offset;
1338 static int fileName_offset;
1339 static int lineNumber_offset;
1340
1341 public:
1342 // Setters
1343 static void set_declaringClass(oop element, oop value);
1344 static void set_methodName(oop element, oop value);
1345 static void set_fileName(oop element, oop value);
1346 static void set_lineNumber(oop element, int value);
1347
1348 // Create an instance of StackTraceElement
1349 static oop create(Handle mirror, int method, int version, int bci, int cpref, TRAPS);
1350 static oop create(const methodHandle& method, int bci, TRAPS);
1351
1352 // Debugging
1353 friend class JavaClasses;
1354 };
1355
1356
1357 // Interface to java.lang.AssertionStatusDirectives objects
1358
1359 class java_lang_AssertionStatusDirectives: AllStatic {
1360 private:
1361 enum {
1362 hc_classes_offset,
1363 hc_classEnabled_offset,
1364 hc_packages_offset,
1365 hc_packageEnabled_offset,
1366 hc_deflt_offset
1367 };
1368
1369 static int classes_offset;
|
479
480 class java_lang_Throwable: AllStatic {
481 friend class BacktraceBuilder;
482
483 private:
484 // Offsets
485 enum {
486 hc_backtrace_offset = 0,
487 hc_detailMessage_offset = 1,
488 hc_cause_offset = 2, // New since 1.4
489 hc_stackTrace_offset = 3 // New since 1.4
490 };
491 enum {
492 hc_static_unassigned_stacktrace_offset = 0 // New since 1.7
493 };
494 // Trace constants
495 enum {
496 trace_methods_offset = 0,
497 trace_bcis_offset = 1,
498 trace_mirrors_offset = 2,
499 trace_next_offset = 3,
500 trace_size = 4,
501 trace_chunk_size = 32
502 };
503
504 static int backtrace_offset;
505 static int detailMessage_offset;
506 static int cause_offset;
507 static int stackTrace_offset;
508 static int static_unassigned_stacktrace_offset;
509
510 // Printing
511 static char* print_stack_element_to_buffer(Handle mirror, const methodHandle& method, int version, int bci);
512 // StackTrace (programmatic access, new since 1.4)
513 static void clear_stacktrace(oop throwable);
514 // No stack trace available
515 static const char* no_stack_trace_message();
516 // Stacktrace (post JDK 1.7.0 to allow immutability protocol to be followed)
517 static void set_stacktrace(oop throwable, oop st_element_array);
518 static oop unassigned_stacktrace();
519
520 public:
521 // Backtrace
522 static oop backtrace(oop throwable);
523 static void set_backtrace(oop throwable, oop value);
524
525 // RedefineClasses support
526 // Mark methods as that are referenced in stacktraces so they
527 // aren't deallocated if they are redefined.
528 static void mark_on_stack(oop throwable);
529
530 // Needed by JVMTI to filter out this internal field.
531 static int get_backtrace_offset() { return backtrace_offset;}
532 static int get_detailMessage_offset() { return detailMessage_offset;}
533 // Message
534 static oop message(oop throwable);
535 static oop message(Handle throwable);
536 static void set_message(oop throwable, oop value);
537 static Symbol* detail_message(oop throwable);
538 static void print_stack_element(outputStream *st, Handle mirror, const methodHandle& method,
539 int version, int bci);
540 static void print_stack_element(outputStream *st, const methodHandle& method, int bci);
541 static void print_stack_usage(Handle stream);
542
543 // Allocate space for backtrace (created but stack trace not filled in)
544 static void allocate_backtrace(Handle throwable, TRAPS);
545 // Fill in current stack trace for throwable with preallocated backtrace (no GC)
546 static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
547 // Fill in current stack trace, can cause GC
548 static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS);
549 static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
550 // Programmatic access to stack trace
551 static oop get_stack_trace_element(oop throwable, int index, TRAPS);
552 static int get_stack_trace_depth(oop throwable, TRAPS);
553 // Printing
554 static void print(oop throwable, outputStream* st);
555 static void print(Handle throwable, outputStream* st);
556 static void print_stack_trace(oop throwable, outputStream* st);
557 // Debugging
558 friend class JavaClasses;
559 };
1334 enum {
1335 hc_declaringClass_offset = 0,
1336 hc_methodName_offset = 1,
1337 hc_fileName_offset = 2,
1338 hc_lineNumber_offset = 3
1339 };
1340
1341 static int declaringClass_offset;
1342 static int methodName_offset;
1343 static int fileName_offset;
1344 static int lineNumber_offset;
1345
1346 public:
1347 // Setters
1348 static void set_declaringClass(oop element, oop value);
1349 static void set_methodName(oop element, oop value);
1350 static void set_fileName(oop element, oop value);
1351 static void set_lineNumber(oop element, int value);
1352
1353 // Create an instance of StackTraceElement
1354 static oop create(Handle mirror, const methodHandle& method, int version, int bci, TRAPS);
1355 static oop create(const methodHandle& method, int bci, TRAPS);
1356
1357 // Debugging
1358 friend class JavaClasses;
1359 };
1360
1361
1362 // Interface to java.lang.AssertionStatusDirectives objects
1363
1364 class java_lang_AssertionStatusDirectives: AllStatic {
1365 private:
1366 enum {
1367 hc_classes_offset,
1368 hc_classEnabled_offset,
1369 hc_packages_offset,
1370 hc_packageEnabled_offset,
1371 hc_deflt_offset
1372 };
1373
1374 static int classes_offset;
|