47 |
47 |
48 class Disassembler { |
48 class Disassembler { |
49 friend class decode_env; |
49 friend class decode_env; |
50 private: |
50 private: |
51 // this is the type of the dll entry point: |
51 // this is the type of the dll entry point: |
52 typedef void* (*decode_func)(uintptr_t start_va, uintptr_t end_va, |
52 typedef void* (*decode_func_virtual)(uintptr_t start_va, uintptr_t end_va, |
53 unsigned char* buffer, uintptr_t length, |
53 unsigned char* buffer, uintptr_t length, |
|
54 void* (*event_callback)(void*, const char*, void*), |
|
55 void* event_stream, |
|
56 int (*printf_callback)(void*, const char*, ...), |
|
57 void* printf_stream, |
|
58 const char* options, |
|
59 int newline); |
|
60 // this is the type of the dll entry point for old version: |
|
61 typedef void* (*decode_func)(void* start_va, void* end_va, |
54 void* (*event_callback)(void*, const char*, void*), |
62 void* (*event_callback)(void*, const char*, void*), |
55 void* event_stream, |
63 void* event_stream, |
56 int (*printf_callback)(void*, const char*, ...), |
64 int (*printf_callback)(void*, const char*, ...), |
57 void* printf_stream, |
65 void* printf_stream, |
58 const char* options); |
66 const char* options); |
59 // points to the library. |
67 // points to the library. |
60 static void* _library; |
68 static void* _library; |
61 // bailout |
69 // bailout |
62 static bool _tried_to_load_library; |
70 static bool _tried_to_load_library; |
63 // points to the decode function. |
71 // points to the decode function. |
|
72 static decode_func_virtual _decode_instructions_virtual; |
64 static decode_func _decode_instructions; |
73 static decode_func _decode_instructions; |
65 // tries to load library and return whether it succedded. |
74 // tries to load library and return whether it succedded. |
66 static bool load_library(); |
75 static bool load_library(); |
67 |
76 |
68 // Machine dependent stuff |
77 // Machine dependent stuff |
83 #endif |
92 #endif |
84 |
93 |
85 |
94 |
86 public: |
95 public: |
87 static bool can_decode() { |
96 static bool can_decode() { |
88 return (_decode_instructions != NULL) || load_library(); |
97 return (_decode_instructions_virtual != NULL) || |
|
98 (_decode_instructions != NULL) || |
|
99 load_library(); |
89 } |
100 } |
90 static void decode(CodeBlob *cb, outputStream* st = NULL); |
101 static void decode(CodeBlob *cb, outputStream* st = NULL); |
91 static void decode(nmethod* nm, outputStream* st = NULL); |
102 static void decode(nmethod* nm, outputStream* st = NULL); |
92 static void decode(address begin, address end, outputStream* st = NULL, CodeComments c = CodeComments()); |
103 static void decode(address begin, address end, outputStream* st = NULL, CodeComments c = CodeComments()); |
93 }; |
104 }; |