• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-Nov-2021-

MakefileH A D03-Nov-20216.5 KiB238159

READMEH A D03-Nov-20216.4 KiB145109

hsdis-demo.cH A D03-Nov-20219.1 KiB282191

hsdis.cH A D03-Nov-202120.9 KiB584421

hsdis.hH A D03-Nov-20215.6 KiB11941

README

1Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
2DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3
4The Universal Permissive License (UPL), Version 1.0
5
6Subject to the condition set forth below, permission is hereby granted to
7any person obtaining a copy of this software, associated documentation
8and/or data (collectively the "Software"), free of charge and under any
9and all copyright rights in the Software, and any and all patent rights
10owned or freely licensable by each licensor hereunder covering either (i)
11the unmodified Software as contributed to or provided by such licensor,
12or (ii) the Larger Works (as defined below), to deal in both
13
14(a) the Software, and
15
16(b) any piece of software and/or hardware listed in the lrgrwrks.txt file
17if one is included with the Software (each a "Larger Work" to which the
18Software is contributed by such licensors),
19
20without restriction, including without limitation the rights to copy,
21create derivative works of, display, perform, and distribute the Software
22and make, use, sell, offer for sale, import, export, have made, and have
23sold the Software and the Larger Work(s), and to sublicense the foregoing
24rights on either these or other terms.
25
26This license is subject to the following condition:
27
28The above copyright notice and either this complete permission notice or
29at a minimum a reference to the UPL must be included in all copies or
30substantial portions of the Software.
31
32THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
33OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
35NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
36DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
37OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
38USE OR OTHER DEALINGS IN THE SOFTWARE.
39
40Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
41or visit www.oracle.com if you need additional information or have any
42questions.
43
44________________________________________________________________________
45
46'hsdis':  A HotSpot plugin for disassembling dynamically generated code.
47
48The files in this directory (Makefile, hsdis.[ch], hsdis-demo.c)
49are built independently of the HotSpot JVM.
50
51To use the plugin with a JVM, you need a new version that can load it.
52If the product mode of your JVM does not accept -XX:+PrintAssembly,
53you do not have a version that is new enough.
54
55* Building
56
57To build this project you need a copy of GNU binutils to build against.
58It is known to work with binutils 2.29.1, 2.30, and 2.31.1. Building
59against versions older than 2.29 is no longer supported. Download a
60copy of the software from http://directory.fsf.org/project/binutils or
61one of its mirrors.  Builds targetting windows currently require the
62use of a cross compiler.
63
64Binutils should be configured with the '--disable-nls' flag to disable
65Native Language Support, otherwise you might get an "undefined
66reference to `libintl_gettext'" if you try to load hsdis.so on systems
67which don't have NLS by default.  It also avoids build problems on
68other configurations that don't include the full NLS support.
69
70The makefile looks for the sources in build/binutils or you can
71specify it's location to the makefile using BINUTILS=path.  It will
72configure binutils and build it first and then build and link the
73disasembly adapter.  Make all will build the default target for your
74platform.  If you platform support both 32 and 64 simultaneously then
75"make both" will build them both at once.  "make all64" will
76explicitly build the 64 bit version.  By default this will build the
77disassembler library only.  If you build demo it will build a demo
78program that attempts to exercise the library.
79
80With recent version of binutils (i.e. binutils-2.23.2) you may get the
81following build error:
82
83WARNING: `makeinfo' is missing on your system.  You should only need it if
84         you modified a `.texi' or `.texinfo' file, or any other file
85         ...
86
87This is because of "Bug 15345 - binutils-2.23.2 tarball doesn't build
88without makeinfo" [2]. The easiest way to work around this problem is
89by doing a "touch $BINUTILS/bfd/doc/bfd.info".
90
91Windows
92
93In theory this should be buildable on Windows but getting a working
94GNU build environment on Windows has proven difficult.  MINGW should
95be able to do it but at the time of this writing I was unable to get
96this working.  Instead you can use the mingw cross compiler on linux
97to produce the windows binaries.  For 32-bit windows you can install
98mingw32 using your package manager and it will be added to your path
99automatically.  For 64-bit you need to download the 64 bit mingw from
100http://sourceforge.net/projects/mingw-w64.  Grab a copy of the
101complete toolchain and unpack it somewhere.  Put the bin directory of
102the toolchain in your path.  The mingw installs contain cross compile
103versions of gcc that are named with a prefix to indicate what they are
104targetting and you must tell the Makefile which one to use.  This
105should either be i586-mingw32msvc or x86_64-pc-mingw32 depending on
106which on you are targetting and there should be a version of gcc in
107your path named i586-mingw32msvc-gcc or x86_64-pc-mingw32-gcc.  Tell
108the makefile what prefix to use to find the mingw tools by using
109MINGW=.  For example:
110
111make MINGW=i586-mingw32msvc BINUTILS=build/binutils-2.31.1
112
113will build the Win32 cross compiled version of hsdis based on 2.31.1.
114
115* Installing
116
117Products are named like build/$OS-$LIBARCH/hsdis-$LIBARCH.so. You can
118install them next to your libjvm.so inside your JRE/JDK or alternatively
119put it anywhere on your LD_LIBRARY_PATH. The search path in the JVM is:
120
1211. <home>/lib/<vm>/libhsdis-<arch>.so
1222. <home>/lib/<vm>/hsdis-<arch>.so
1233. <home>/lib/hsdis-<arch>.so
1244. hsdis-<arch>.so  (using LD_LIBRARY_PATH)
125
126Now test:
127
128  export LD_LIBRARY_PATH .../hsdis/build/$OS-$LIBARCH:$LD_LIBRARY_PATH
129  dargs='-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly'
130  dargs=$dargs' -XX:PrintAssemblyOptions=hsdis-print-bytes'
131  java $dargs -Xbatch CompileCommand=print,*String.hashCode HelloWorld
132
133If the product mode of the JVM does not accept -XX:+PrintAssembly,
134you do not have a version new enough to use the hsdis plugin.
135
136* Wiki
137
138More information can be found in the OpenJDK HotSpot Wiki [1].
139
140
141Resources:
142
143[1] https://wiki.openjdk.java.net/display/HotSpot/PrintAssembly
144[2] http://sourceware.org/bugzilla/show_bug.cgi?id=15345
145