1466 _index++; |
1466 _index++; |
1467 } |
1467 } |
1468 |
1468 |
1469 }; |
1469 }; |
1470 |
1470 |
|
1471 Symbol* get_source_file_name(InstanceKlass* holder, int version) { |
|
1472 // Find the specific ik version that contains this source_file_name_index |
|
1473 // via the previous versions list, but use the current version's |
|
1474 // constant pool to look it up. The previous version's index has been |
|
1475 // merged for the current constant pool. |
|
1476 InstanceKlass* ik = holder->get_klass_version(version); |
|
1477 // This version has been cleaned up. |
|
1478 if (ik == NULL) return NULL; |
|
1479 int source_file_name_index = ik->source_file_name_index(); |
|
1480 return (source_file_name_index == 0) ? |
|
1481 (Symbol*)NULL : holder->constants()->symbol_at(source_file_name_index); |
|
1482 } |
|
1483 |
1471 // Print stack trace element to resource allocated buffer |
1484 // Print stack trace element to resource allocated buffer |
1472 char* java_lang_Throwable::print_stack_element_to_buffer(Handle mirror, |
1485 char* java_lang_Throwable::print_stack_element_to_buffer(Handle mirror, |
1473 int method_id, int version, int bci, int cpref) { |
1486 int method_id, int version, int bci, int cpref) { |
1474 |
1487 |
1475 // Get strings and string lengths |
1488 // Get strings and string lengths |
1482 // The method can be NULL if the requested class version is gone |
1495 // The method can be NULL if the requested class version is gone |
1483 Symbol* sym = (method != NULL) ? method->name() : holder->constants()->symbol_at(cpref); |
1496 Symbol* sym = (method != NULL) ? method->name() : holder->constants()->symbol_at(cpref); |
1484 char* method_name = sym->as_C_string(); |
1497 char* method_name = sym->as_C_string(); |
1485 buf_len += (int)strlen(method_name); |
1498 buf_len += (int)strlen(method_name); |
1486 |
1499 |
1487 // Use specific ik version as a holder since the mirror might |
|
1488 // refer to version that is now obsolete and no longer accessible |
|
1489 // via the previous versions list. |
|
1490 holder = holder->get_klass_version(version); |
|
1491 char* source_file_name = NULL; |
1500 char* source_file_name = NULL; |
1492 if (holder != NULL) { |
1501 Symbol* source = get_source_file_name(holder, version); |
1493 Symbol* source = holder->source_file_name(); |
1502 if (source != NULL) { |
1494 if (source != NULL) { |
1503 source_file_name = source->as_C_string(); |
1495 source_file_name = source->as_C_string(); |
1504 buf_len += (int)strlen(source_file_name); |
1496 buf_len += (int)strlen(source_file_name); |
|
1497 } |
|
1498 } |
1505 } |
1499 |
1506 |
1500 // Allocate temporary buffer with extra space for formatting and line number |
1507 // Allocate temporary buffer with extra space for formatting and line number |
1501 char* buf = NEW_RESOURCE_ARRAY(char, buf_len + 64); |
1508 char* buf = NEW_RESOURCE_ARRAY(char, buf_len + 64); |
1502 |
1509 |
1907 // The method was redefined, accurate line number information isn't available |
1914 // The method was redefined, accurate line number information isn't available |
1908 java_lang_StackTraceElement::set_fileName(element(), NULL); |
1915 java_lang_StackTraceElement::set_fileName(element(), NULL); |
1909 java_lang_StackTraceElement::set_lineNumber(element(), -1); |
1916 java_lang_StackTraceElement::set_lineNumber(element(), -1); |
1910 } else { |
1917 } else { |
1911 // Fill in source file name and line number. |
1918 // Fill in source file name and line number. |
1912 // Use specific ik version as a holder since the mirror might |
1919 Symbol* source = get_source_file_name(holder, version); |
1913 // refer to version that is now obsolete and no longer accessible |
|
1914 // via the previous versions list. |
|
1915 holder = holder->get_klass_version(version); |
|
1916 assert(holder != NULL, "sanity check"); |
|
1917 Symbol* source = holder->source_file_name(); |
|
1918 if (ShowHiddenFrames && source == NULL) |
1920 if (ShowHiddenFrames && source == NULL) |
1919 source = vmSymbols::unknown_class_name(); |
1921 source = vmSymbols::unknown_class_name(); |
1920 oop filename = StringTable::intern(source, CHECK_0); |
1922 oop filename = StringTable::intern(source, CHECK_0); |
1921 java_lang_StackTraceElement::set_fileName(element(), filename); |
1923 java_lang_StackTraceElement::set_fileName(element(), filename); |
1922 |
1924 |