27 // platform-specific Disassembler classes.
28
29 #include "precompiled.hpp"
30 #include "asm/assembler.inline.hpp"
31 #include "compiler/abstractDisassembler.hpp"
32 #include "oops/oop.inline.hpp"
33 #include "utilities/debug.hpp"
34 #include "utilities/ostream.hpp"
35
36 // Default values for what is being printed as line prefix when disassembling a single instruction.
37 // Can be overridden by command line parameter PrintAssemblyOptions.
38 bool AbstractDisassembler::_show_data_hex = true;
39 bool AbstractDisassembler::_show_data_int = false;
40 bool AbstractDisassembler::_show_data_float = false;
41 bool AbstractDisassembler::_align_instr = false;
42 bool AbstractDisassembler::_show_pc = true;
43 bool AbstractDisassembler::_show_offset = false;
44 bool AbstractDisassembler::_show_structs = false;
45 bool AbstractDisassembler::_show_comment = false;
46 bool AbstractDisassembler::_show_block_comment = false;
47 #if defined(ARM) || defined(AARCH64)
48 bool AbstractDisassembler::_show_bytes = false; // set "true" to see what's in memory bit by bit
49 // might prove cumbersome because instr_len is hard to find on arm
50 #endif
51 #if defined(PPC)
52 bool AbstractDisassembler::_show_bytes = false; // set "true" to see what's in memory bit by bit
53 #endif
54 #if defined(S390)
55 bool AbstractDisassembler::_show_bytes = false; // set "true" to see what's in memory bit by bit
56 #endif
57 #if defined(SPARC)
58 bool AbstractDisassembler::_show_bytes = false; // set "true" to see what's in memory bit by bit
59 #endif
60 #if defined(X86)
61 bool AbstractDisassembler::_show_bytes = false; // set "true" to see what's in memory bit by bit
62 // might prove cumbersome because instr_len is hard to find on x86
63 #endif
64 #if defined(ZERO)
65 bool AbstractDisassembler::_show_bytes = false; // set "true" to see what's in memory bit by bit
66 #endif
67
68 // Return #bytes printed. Callers may use that for output alignment.
69 // Print instruction address, and offset from blob begin.
70 // Offset width (2, 4, 6, 8 bytes) is adapted to size of blob.
71 // Working assumption: we are at st->bol() upon entry. If not, it's the
72 // caller's responsibility to guarantee proper alignment.
73 int AbstractDisassembler::print_location(address here, address begin, address end, outputStream* st, bool align, bool print_header) {
74 const int pos_0 = st->position();
75
76 if (show_pc() || show_offset()) {
77 st->print(" ");
78 }
79
80 if (show_pc()) {
81 if (print_header) {
82 st->print(" %*s", 18, "Address");
83 } else {
84 st->print(" " PTR_FORMAT, p2i(here));
85 }
86 }
|
27 // platform-specific Disassembler classes.
28
29 #include "precompiled.hpp"
30 #include "asm/assembler.inline.hpp"
31 #include "compiler/abstractDisassembler.hpp"
32 #include "oops/oop.inline.hpp"
33 #include "utilities/debug.hpp"
34 #include "utilities/ostream.hpp"
35
36 // Default values for what is being printed as line prefix when disassembling a single instruction.
37 // Can be overridden by command line parameter PrintAssemblyOptions.
38 bool AbstractDisassembler::_show_data_hex = true;
39 bool AbstractDisassembler::_show_data_int = false;
40 bool AbstractDisassembler::_show_data_float = false;
41 bool AbstractDisassembler::_align_instr = false;
42 bool AbstractDisassembler::_show_pc = true;
43 bool AbstractDisassembler::_show_offset = false;
44 bool AbstractDisassembler::_show_structs = false;
45 bool AbstractDisassembler::_show_comment = false;
46 bool AbstractDisassembler::_show_block_comment = false;
47
48 // set "true" to see what's in memory bit by bit
49 // might prove cumbersome on platforms where instr_len is hard to find out
50 bool AbstractDisassembler::_show_bytes = false;
51
52 // Return #bytes printed. Callers may use that for output alignment.
53 // Print instruction address, and offset from blob begin.
54 // Offset width (2, 4, 6, 8 bytes) is adapted to size of blob.
55 // Working assumption: we are at st->bol() upon entry. If not, it's the
56 // caller's responsibility to guarantee proper alignment.
57 int AbstractDisassembler::print_location(address here, address begin, address end, outputStream* st, bool align, bool print_header) {
58 const int pos_0 = st->position();
59
60 if (show_pc() || show_offset()) {
61 st->print(" ");
62 }
63
64 if (show_pc()) {
65 if (print_header) {
66 st->print(" %*s", 18, "Address");
67 } else {
68 st->print(" " PTR_FORMAT, p2i(here));
69 }
70 }
|