196 void print_insn_labels(); |
196 void print_insn_labels(); |
197 void print_insn_bytes(address pc0, address pc); |
197 void print_insn_bytes(address pc0, address pc); |
198 void print_address(address value); |
198 void print_address(address value); |
199 |
199 |
200 public: |
200 public: |
201 decode_env(CodeBlob* code, outputStream* output, CodeComments c = CodeComments()); |
201 decode_env(CodeBlob* code, outputStream* output, CodeStrings c = CodeStrings()); |
202 |
202 |
203 address decode_instructions(address start, address end); |
203 address decode_instructions(address start, address end); |
204 |
204 |
205 void start_insn(address pc) { |
205 void start_insn(address pc) { |
206 _cur_insn = pc; |
206 _cur_insn = pc; |
240 int total_ticks() { return _total_ticks; } |
240 int total_ticks() { return _total_ticks; } |
241 void set_total_ticks(int n) { _total_ticks = n; } |
241 void set_total_ticks(int n) { _total_ticks = n; } |
242 const char* options() { return _option_buf; } |
242 const char* options() { return _option_buf; } |
243 }; |
243 }; |
244 |
244 |
245 decode_env::decode_env(CodeBlob* code, outputStream* output, CodeComments c) { |
245 decode_env::decode_env(CodeBlob* code, outputStream* output, CodeStrings c) { |
246 memset(this, 0, sizeof(*this)); |
246 memset(this, 0, sizeof(*this)); |
247 _output = output ? output : tty; |
247 _output = output ? output : tty; |
248 _code = code; |
248 _code = code; |
249 if (code != NULL && code->is_nmethod()) |
249 if (code != NULL && code->is_nmethod()) |
250 _nm = (nmethod*) code; |
250 _nm = (nmethod*) code; |
251 _comments.assign(c); |
251 _strings.assign(c); |
252 |
252 |
253 // by default, output pc but not bytes: |
253 // by default, output pc but not bytes: |
254 _print_pc = true; |
254 _print_pc = true; |
255 _print_bytes = false; |
255 _print_bytes = false; |
256 _bytes_per_line = Disassembler::pd_instruction_alignment(); |
256 _bytes_per_line = Disassembler::pd_instruction_alignment(); |
368 outputStream* st = output(); |
368 outputStream* st = output(); |
369 CodeBlob* cb = _code; |
369 CodeBlob* cb = _code; |
370 if (cb != NULL) { |
370 if (cb != NULL) { |
371 cb->print_block_comment(st, p); |
371 cb->print_block_comment(st, p); |
372 } |
372 } |
373 _comments.print_block_comment(st, (intptr_t)(p - _start)); |
373 _strings.print_block_comment(st, (intptr_t)(p - _start)); |
374 if (_print_pc) { |
374 if (_print_pc) { |
375 st->print(" " PTR_FORMAT ": ", p); |
375 st->print(" " PTR_FORMAT ": ", p); |
376 } |
376 } |
377 } |
377 } |
378 |
378 |
496 decode_env env(cb, st); |
496 decode_env env(cb, st); |
497 env.output()->print_cr("Decoding CodeBlob " PTR_FORMAT, cb); |
497 env.output()->print_cr("Decoding CodeBlob " PTR_FORMAT, cb); |
498 env.decode_instructions(cb->code_begin(), cb->code_end()); |
498 env.decode_instructions(cb->code_begin(), cb->code_end()); |
499 } |
499 } |
500 |
500 |
501 void Disassembler::decode(address start, address end, outputStream* st, CodeComments c) { |
501 void Disassembler::decode(address start, address end, outputStream* st, CodeStrings c) { |
502 if (!load_library()) return; |
502 if (!load_library()) return; |
503 decode_env env(CodeCache::find_blob_unsafe(start), st, c); |
503 decode_env env(CodeCache::find_blob_unsafe(start), st, c); |
504 env.decode_instructions(start, end); |
504 env.decode_instructions(start, end); |
505 } |
505 } |
506 |
506 |