src/share/vm/utilities/ostream.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/utilities/ostream.cpp

src/share/vm/utilities/ostream.cpp

Print this page
rev 3510 : 7116786: RFE: Detailed information on VerifyErrors
Summary: Provide additional detail in VerifyError messages
Reviewed-by:

*** 235,246 **** } print_raw(suffix); return; } ! void outputStream::indent() { while (_position < _indentation) sp(); } void outputStream::print_jlong(jlong value) { // N.B. Same as INT64_FORMAT print(os::jlong_format_specifier(), value); --- 235,247 ---- } print_raw(suffix); return; } ! outputStream& outputStream::indent() { while (_position < _indentation) sp(); + return *this; } void outputStream::print_jlong(jlong value) { // N.B. Same as INT64_FORMAT print(os::jlong_format_specifier(), value);
*** 249,258 **** --- 250,300 ---- void outputStream::print_julong(julong value) { // N.B. Same as UINT64_FORMAT print(os::julong_format_specifier(), value); } + /** + * This prints out hex data in a 'windbg' or 'xxd' form, where each line is: + * <hex-address>: 8 * <hex-halfword> <ascii translation (optional)> + * example: + * 0000000: 7f44 4f46 0102 0102 0000 0000 0000 0000 .DOF............ + * 0000010: 0000 0000 0000 0040 0000 0020 0000 0005 .......@... .... + * 0000020: 0000 0000 0000 0040 0000 0000 0000 015d .......@.......] + * ... + * + * indent is applied to each line. Ends with a CR. + */ + void outputStream::print_data(void* data, size_t len, bool with_ascii) { + size_t limit = (len + 16) / 16 * 16; + for (size_t i = 0; i < limit; ++i) { + if (i % 16 == 0) { + indent().print("%07x:", i); + } + if (i % 2 == 0) { + print(" "); + } + if (i < len) { + print("%02x", ((unsigned char*)data)[i]); + } else { + print(" "); + } + if ((i + 1) % 16 == 0) { + if (with_ascii) { + print(" "); + for (size_t j = 0; j < 16; ++j) { + size_t idx = i + j - 15; + if (idx < len) { + char c = ((char*)data)[idx]; + print("%c", c >= 32 && c <= 126 ? c : '.'); + } + } + } + print_cr(""); + } + } + } + stringStream::stringStream(size_t initial_size) : outputStream() { buffer_length = initial_size; buffer = NEW_RESOURCE_ARRAY(char, buffer_length); buffer_pos = 0; buffer_fixed = false;
src/share/vm/utilities/ostream.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File