@@ -82,18 +82,33 @@ void NativeCallStack::print_on(outputStream* out, int indent) const {
82
82
char buf[1024 ];
83
83
int offset;
84
84
if (is_empty ()) {
85
- for ( int index = 0 ; index < indent; index ++) out->print ( " " );
85
+ out->fill_to (indent );
86
86
out->print (" [BOOTSTRAP]" );
87
87
} else {
88
88
for (int frame = 0 ; frame < NMT_TrackingStackDepth; frame ++) {
89
89
pc = get_frame (frame);
90
90
if (pc == nullptr ) break ;
91
- // Print indent
92
- for (int index = 0 ; index < indent; index ++) out->print (" " );
91
+ out->fill_to (indent);
92
+ out->print (" [" PTR_FORMAT " ]" , p2i (pc));
93
+ // Print function and library; shorten library name to just its last component
94
+ // for brevity, and omit it completely for libjvm.so
95
+ bool function_printed = false ;
93
96
if (os::dll_address_to_function_name (pc, buf, sizeof (buf), &offset)) {
94
- out->print (" [" PTR_FORMAT " ] %s+0x%x" , p2i (pc), buf, offset);
95
- } else {
96
- out->print (" [" PTR_FORMAT " ]" , p2i (pc));
97
+ out->print (" %s+0x%x" , buf, offset);
98
+ function_printed = true ;
99
+ }
100
+ if ((!function_printed || !os::address_is_in_vm (pc)) &&
101
+ os::dll_address_to_library_name (pc, buf, sizeof (buf), &offset)) {
102
+ const char * libname = strrchr (buf, os::file_separator ()[0 ]);
103
+ if (libname != nullptr ) {
104
+ libname++;
105
+ } else {
106
+ libname = buf;
107
+ }
108
+ out->print (" in %s" , libname);
109
+ if (!function_printed) {
110
+ out->print (" +0x%x" , offset);
111
+ }
97
112
}
98
113
99
114
// Note: we deliberately omit printing source information here. NativeCallStack::print_on()
0 commit comments