author | valeriep |
Mon, 11 Jun 2018 19:39:05 +0000 | |
changeset 50508 | 6aa873a6dae9 |
parent 47216 | 71c04702a3d5 |
child 51202 | 59b0d8afc831 |
permissions | -rw-r--r-- |
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
1 |
/* |
13873 | 2 |
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. |
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
4 |
* |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
8 |
* |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
13 |
* accompanied this code). |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
14 |
* |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
18 |
* |
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
347
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
347
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
347
diff
changeset
|
21 |
* questions. |
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
22 |
* |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
23 |
*/ |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
24 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
25 |
/* decode_instructions -- dump a range of addresses as native instructions |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
26 |
This implements the protocol required by the HotSpot PrintAssembly option. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
27 |
|
13873 | 28 |
The start_va, end_va is the virtual address the region of memory to |
29 |
disasemble and buffer contains the instructions to decode, |
|
30 |
Disassembling instructions in the current address space is done by |
|
31 |
having start_va == buffer. |
|
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
32 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
33 |
The option string, if not empty, is interpreted by the disassembler implementation. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
34 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
35 |
The printf callback is 'fprintf' or any other workalike. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
36 |
It is called as (*printf_callback)(printf_stream, "some format...", some, format, args). |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
37 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
38 |
The event callback receives an event tag (a string) and an argument (a void*). |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
39 |
It is called as (*event_callback)(event_stream, "tag", arg). |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
40 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
41 |
Events: |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
42 |
<insn pc='%p'> begin an instruction, at a given location |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
43 |
</insn pc='%d'> end an instruction, at a given location |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
44 |
<addr value='%p'/> emit the symbolic value of an address |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
45 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
46 |
A tag format is one of three basic forms: "tag", "/tag", "tag/", |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
47 |
where tag is a simple identifier, signifying (as in XML) a element start, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
48 |
element end, and standalone element. (To render as XML, add angle brackets.) |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
49 |
*/ |
14384
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
50 |
#ifndef SHARED_TOOLS_HSDIS_H |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
51 |
#define SHARED_TOOLS_HSDIS_H |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
52 |
|
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
53 |
extern |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
54 |
#ifdef DLL_EXPORT |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
55 |
DLL_EXPORT |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
56 |
#endif |
13873 | 57 |
void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va, |
58 |
unsigned char* buffer, uintptr_t length, |
|
59 |
void* (*event_callback)(void*, const char*, void*), |
|
60 |
void* event_stream, |
|
61 |
int (*printf_callback)(void*, const char*, ...), |
|
62 |
void* printf_stream, |
|
14384
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
63 |
const char* options, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
64 |
int newline /* bool value for nice new line */); |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
65 |
|
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
66 |
/* This is the compatability interface for older versions of hotspot */ |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
67 |
extern |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
68 |
#ifdef DLL_ENTRY |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
69 |
DLL_ENTRY |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
70 |
#endif |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
71 |
void* decode_instructions(void* start_pv, void* end_pv, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
72 |
void* (*event_callback)(void*, const char*, void*), |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
73 |
void* event_stream, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
74 |
int (*printf_callback)(void*, const char*, ...), |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
75 |
void* printf_stream, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
76 |
const char* options); |
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
77 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
78 |
/* convenience typedefs */ |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
79 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
80 |
typedef void* (*decode_instructions_event_callback_ftype) (void*, const char*, void*); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
81 |
typedef int (*decode_instructions_printf_callback_ftype) (void*, const char*, ...); |
14384
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
82 |
typedef void* (*decode_func_vtype) (uintptr_t start_va, uintptr_t end_va, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
83 |
unsigned char* buffer, uintptr_t length, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
84 |
decode_instructions_event_callback_ftype event_callback, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
85 |
void* event_stream, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
86 |
decode_instructions_printf_callback_ftype printf_callback, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
87 |
void* printf_stream, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
88 |
const char* options, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
89 |
int newline); |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
90 |
typedef void* (*decode_func_stype) (void* start_pv, void* end_pv, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
91 |
decode_instructions_event_callback_ftype event_callback, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
92 |
void* event_stream, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
93 |
decode_instructions_printf_callback_ftype printf_callback, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
94 |
void* printf_stream, |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
95 |
const char* options); |
801df8025142
8000489: older builds of hsdis don't work anymore after 6879063
minqi
parents:
13873
diff
changeset
|
96 |
#endif /* SHARED_TOOLS_HSDIS_H */ |