annotate src/share/tools/hsdis/README @ 100:c7c777385a15

6667042: PrintAssembly option does not work without special plugin Summary: remove old private plugin interface, simplify, rework old plugin to use unchanged Gnu sources Reviewed-by: kvn, rasbold
author jrose
date Wed, 02 Apr 2008 12:09:59 -0700
parents
children 67a2f5ba5582
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
1 Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
2 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
3
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
4 This code is free software; you can redistribute it and/or modify it
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
5 under the terms of the GNU General Public License version 2 only, as
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
6 published by the Free Software Foundation.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
7
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
8 This code is distributed in the hope that it will be useful, but WITHOUT
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
10 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
11 version 2 for more details (a copy is included in the LICENSE file that
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
12 accompanied this code).
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
13
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
14 You should have received a copy of the GNU General Public License version
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
15 2 along with this work; if not, write to the Free Software Foundation,
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
16 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
17
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
18 Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
19 CA 95054 USA or visit www.sun.com if you need additional information or
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
20 have any questions.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
21
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
22 ________________________________________________________________________
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
23
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
24 'hsdis': A HotSpot plugin for disassembling dynamically generated code.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
25
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
26 The files in this directory (Makefile, hsdis.[ch], hsdis-demo.c)
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
27 are built independently of the HotSpot JVM.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
28
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
29 To use the plugin with a JVM, you need a new version that can load it.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
30 If the product mode of your JVM does not accept -XX:+PrintAssembly,
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
31 you do not have a version that is new enough.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
32
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
33 * Building
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
34
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
35 To build this project you need a build of Gnu binutils to link against.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
36 It is known to work with binutils 2.17.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
37
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
38 The makefile looks for this build in $BINUTILS, or (if that is not set),
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
39 in .../binutils-2.17-$LIBARCH, where LIBARCH (as in HotSpot) is one of
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
40 the jre subdirectory keywords i386, amd64, sparc, sparcv9, etc.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
41
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
42 To build Gnu binutils, first download a copy of the software:
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
43 http://directory.fsf.org/project/binutils/
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
44
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
45 Unpack the binutils tarball into an empty directory:
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
46 chdir ../../../../..
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
47 tar -xzf - < ../binutils-2.17.tar.gz
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
48 mv binutils-2.17 binutils-2.17-i386 #or binutils-2.17-sparc
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
49 cd binutils-2.17-i386
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
50
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
51 From inside that directory, run configure and make:
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
52 ( export CFLAGS='-fPIC'
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
53 ./configure i386-pc-elf )
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
54 gnumake
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
55
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
56 (Leave out or change the argument to configure if not on an i386 system.)
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
57
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
58 Next, untar again into another empty directory for the LP64 version:
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
59 chdir ..
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
60 tar -xzf - < ../binutils-2.17.tar.gz
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
61 mv binutils-2.17 binutils-2.17-amd64 #or binutils-2.17-sparcv9
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
62 cd binutils-2.17-amd64
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
63
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
64 From inside that directory, run configure for LP64 and make:
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
65 ( export ac_cv_c_bigendian=no CFLAGS='-m64 -fPIC' LDFLAGS=-m64
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
66 ./configure amd64-pc-elf )
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
67 gnumake
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
68
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
69 The -fPIC option is needed because the generated code will be
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
70 linked into the hsdid-$LIBARCH.so binary. If you miss the
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
71 option, the JVM will fail to load the disassembler.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
72
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
73 You probably want two builds, one for 32 and one for 64 bits.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
74 To build the 64-bit variation of a platforn, add LP64=1 to
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
75 the make command line for hsdis.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
76
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
77 So, go back to the hsdis project and build:
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
78 chdir .../hsdis
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
79 gnumake
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
80 gnumake LP64=1
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
81
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
82 * Installing
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
83
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
84 Products are named like bin/$OS/hsdis-$LIBARCH.so.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
85 You can install them on your LD_LIBRARY_PATH,
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
86 or inside of your JRE next to $LIBARCH/libjvm.so.
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
87
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
88 Now test:
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
89 export LD_LIBRARY_PATH .../hsdis/bin/solaris:$LD_LIBRARY_PATH
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
90 dargs='-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly'
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
91 dargs=$dargs' -XX:PrintAssemblyOptions=hsdis-print-bytes'
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
92 java $dargs -Xbatch CompileCommand=print,*String.hashCode HelloWorld
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
93
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
94 If the product mode of the JVM does not accept -XX:+PrintAssembly,
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
95 you do not have a version new enough to use the hsdis plugin.