author | jrose |
Wed, 23 Sep 2009 23:56:15 -0700 | |
changeset 3912 | 3aaaaad1ccb0 |
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 |
class decode_env; |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
26 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
27 |
// The disassembler prints out assembly code annotated |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
28 |
// with Java specific information. |
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 |
class Disassembler { |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
31 |
friend class decode_env; |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
32 |
private: |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
33 |
// this is the type of the dll entry point: |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
34 |
typedef void* (*decode_func)(void* start, void* end, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
35 |
void* (*event_callback)(void*, const char*, void*), |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
36 |
void* event_stream, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
37 |
int (*printf_callback)(void*, const char*, ...), |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
38 |
void* printf_stream, |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
39 |
const char* options); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
40 |
// points to the library. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
41 |
static void* _library; |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
42 |
// bailout |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
43 |
static bool _tried_to_load_library; |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
44 |
// points to the decode function. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
45 |
static decode_func _decode_instructions; |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
46 |
// tries to load library and return whether it succedded. |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
47 |
static bool load_library(); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
48 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
49 |
// Machine dependent stuff |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
50 |
#include "incls/_disassembler_pd.hpp.incl" |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
51 |
|
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
52 |
public: |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
53 |
static bool can_decode() { |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
54 |
return (_decode_instructions != NULL) || load_library(); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
55 |
} |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
56 |
static void decode(CodeBlob *cb, outputStream* st = NULL); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
57 |
static void decode(nmethod* nm, outputStream* st = NULL); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
58 |
static void decode(address begin, address end, outputStream* st = NULL); |
df859fcca515
6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff
changeset
|
59 |
}; |