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