1 /* |
1 /* |
2 * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
56 |
56 |
57 // This routine is in the shared library: |
57 // This routine is in the shared library: |
58 Disassembler::decode_func Disassembler::_decode_instructions = NULL; |
58 Disassembler::decode_func Disassembler::_decode_instructions = NULL; |
59 |
59 |
60 static const char hsdis_library_name[] = "hsdis-"HOTSPOT_LIB_ARCH; |
60 static const char hsdis_library_name[] = "hsdis-"HOTSPOT_LIB_ARCH; |
61 static const char decode_instructions_name[] = "decode_instructions"; |
61 static const char decode_instructions_name[] = "decode_instructions_virtual"; |
62 |
62 |
63 #define COMMENT_COLUMN 40 LP64_ONLY(+8) /*could be an option*/ |
63 #define COMMENT_COLUMN 40 LP64_ONLY(+8) /*could be an option*/ |
64 #define BYTES_COMMENT ";..." /* funky byte display comment */ |
64 #define BYTES_COMMENT ";..." /* funky byte display comment */ |
65 |
65 |
66 bool Disassembler::load_library() { |
66 bool Disassembler::load_library() { |
216 st->bol(); |
216 st->bol(); |
217 st->print_cr("%3.1f%% [%d]", bucket_count*100.0/total_ticks(), bucket_count); |
217 st->print_cr("%3.1f%% [%d]", bucket_count*100.0/total_ticks(), bucket_count); |
218 } |
218 } |
219 } |
219 } |
220 } |
220 } |
|
221 // follow each complete insn by a nice newline |
|
222 st->cr(); |
221 } |
223 } |
222 |
224 |
223 address handle_event(const char* event, address arg); |
225 address handle_event(const char* event, address arg); |
224 |
226 |
225 outputStream* output() { return _output; } |
227 outputStream* output() { return _output; } |
444 // Print whatever the library wants to print, w/o fancy callbacks. |
446 // Print whatever the library wants to print, w/o fancy callbacks. |
445 // This is mainly for debugging the library itself. |
447 // This is mainly for debugging the library itself. |
446 FILE* out = stdout; |
448 FILE* out = stdout; |
447 FILE* xmlout = (_print_raw > 1 ? out : NULL); |
449 FILE* xmlout = (_print_raw > 1 ? out : NULL); |
448 return (address) |
450 return (address) |
449 (*Disassembler::_decode_instructions)(start, end, |
451 (*Disassembler::_decode_instructions)((uintptr_t)start, (uintptr_t)end, |
|
452 start, end - start, |
450 NULL, (void*) xmlout, |
453 NULL, (void*) xmlout, |
451 NULL, (void*) out, |
454 NULL, (void*) out, |
452 options()); |
455 options()); |
453 } |
456 } |
454 |
457 |
455 return (address) |
458 return (address) |
456 (*Disassembler::_decode_instructions)(start, end, |
459 (*Disassembler::_decode_instructions)((uintptr_t)start, (uintptr_t)end, |
|
460 start, end - start, |
457 &event_to_env, (void*) this, |
461 &event_to_env, (void*) this, |
458 &printf_to_env, (void*) this, |
462 &printf_to_env, (void*) this, |
459 options()); |
463 options()); |
460 } |
464 } |
461 |
465 |