author | mchung |
Wed, 10 Feb 2010 17:51:07 -0800 | |
changeset 4917 | c98da2209f8c |
parent 347 | df859fcca515 |
child 5547 | f4b087cbb361 |
permissions | -rw-r--r-- |
347
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
1 |
/* |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
2 |
* Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. |
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 |
* |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
19 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
21 |
* have any questions. |
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 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
28 |
The starting and ending addresses are within the current process's address space. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
29 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
30 |
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
|
31 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
32 |
The printf callback is 'fprintf' or any other workalike. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
33 |
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
|
34 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
35 |
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
|
36 |
It is called as (*event_callback)(event_stream, "tag", arg). |
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 |
Events: |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
39 |
<insn pc='%p'> begin an instruction, at a given location |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
40 |
</insn pc='%d'> end an instruction, at a given location |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
41 |
<addr value='%p'/> emit the symbolic value of an address |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
42 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
43 |
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
|
44 |
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
|
45 |
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
|
46 |
*/ |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
47 |
extern |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
48 |
#ifdef DLL_EXPORT |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
49 |
DLL_EXPORT |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
50 |
#endif |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
51 |
void* decode_instructions(void* start, void* end, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
52 |
void* (*event_callback)(void*, const char*, void*), |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
53 |
void* event_stream, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
54 |
int (*printf_callback)(void*, const char*, ...), |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
55 |
void* printf_stream, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
56 |
const char* options); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
57 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
58 |
/* convenience typedefs */ |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
59 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
60 |
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
|
61 |
typedef int (*decode_instructions_printf_callback_ftype) (void*, const char*, ...); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
62 |
typedef void* (*decode_instructions_ftype) (void* start, void* end, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
63 |
decode_instructions_event_callback_ftype event_callback, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
64 |
void* event_stream, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
65 |
decode_instructions_printf_callback_ftype printf_callback, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
66 |
void* printf_stream, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
67 |
const char* options); |