annotate src/share/tools/hsdis/README @ 3394:fe189d4a44e9

7044486: open jdk repos have files with incorrect copyright headers, which can end up in src bundles Reviewed-by: ohair, trims
author katleman
date Wed, 25 May 2011 13:31:51 -0700
parents c18cbe5936b8
children 04b9a2566eec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3394
fe189d4a44e9 7044486: open jdk repos have files with incorrect copyright headers, which can end up in src bundles
katleman
parents: 1552
diff changeset
1 Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
100
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
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 720
diff changeset
18 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 720
diff changeset
19 or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 720
diff changeset
20 questions.
100
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
720
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
35 To build this project you a copy of GNU binutils to build against. It
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
36 is known to work with binutils 2.17 and binutils 2.19.1. Download a
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
37 copy of the software from http://directory.fsf.org/project/binutils or
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
38 one of it's mirrors. Builds targetting windows should use at least
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
39 2.19 and currently requires the use of a cross compiler.
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
40
720
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
41 The makefile looks for the sources in build/binutils or you can
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
42 specify it's location to the makefile using BINTUILS=path. It will
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
43 configure binutils and build it first and then build and link the
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
44 disasembly adapter. Make all will build the default target for your
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
45 platform. If you platform support both 32 and 64 simultaneously then
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
46 "make both" will build them both at once. "make all64" will
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
47 explicitly build the 64 bit version. By default this will build the
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
48 disassembler library only. If you build demo it will build a demo
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
49 program that attempts to exercise the library.
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
50
720
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
51 Windows
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
52
720
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
53 In theory this should be buildable on Windows but getting a working
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
54 GNU build environment on Windows has proven difficult. MINGW should
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
55 be able to do it but at the time of this writing I was unable to get
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
56 this working. Instead you can use the mingw cross compiler on linux
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
57 to produce the windows binaries. For 32-bit windows you can install
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
58 mingw32 using your package manager and it will be added to your path
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
59 automatically. For 64-bit you need to download the 64 bit mingw from
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
60 http://sourceforge.net/projects/mingw-w64. Grab a copy of the
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
61 complete toolchain and unpack it somewhere. Put the bin directory of
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
62 the toolchain in your path. The mingw installs contain cross compile
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
63 versions of gcc that are named with a prefix to indicate what they are
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
64 targetting and you must tell the Makefile which one to use. This
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
65 should either be i586-mingw32msvc or x86_64-pc-mingw32 depending on
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
66 which on you are targetting and there should be a version of gcc in
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
67 your path named i586-mingw32msvc-gcc or x86_64-pc-mingw32-gcc. Tell
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
68 the makefile what prefix to use to find the mingw tools by using
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
69 MINGW=. For example:
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
70
720
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
71 make MINGW=i586-mingw32msvc BINTUILS=build/binutils-2.19.1
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
72
720
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
73 will build the Win32 cross compiled version of hsdis based on 2.19.1.
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
74
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
75 * Installing
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
76
720
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
77 Products are named like build/$OS-$LIBARCH/hsdis-$LIBARCH.so. You can
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
78 install them on your LD_LIBRARY_PATH, or inside of your JRE next to
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
79 $LIBARCH/libjvm.so.
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
80
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
81 Now test:
720
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
82
67a2f5ba5582 6684007: PrintAssembly plugin not available for linux or windows
never
parents: 100
diff changeset
83 export LD_LIBRARY_PATH .../hsdis/build/$OS-$LIBARCH:$LD_LIBRARY_PATH
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
84 dargs='-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly'
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
85 dargs=$dargs' -XX:PrintAssemblyOptions=hsdis-print-bytes'
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents:
diff changeset
86 java $dargs -Xbatch CompileCommand=print,*String.hashCode HelloWorld
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 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
89 you do not have a version new enough to use the hsdis plugin.