Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.This code is free software; you can redistribute it and/or modify itunder the terms of the GNU General Public License version 2 only, aspublished by the Free Software Foundation.This code is distributed in the hope that it will be useful, but WITHOUTANY WARRANTY; without even the implied warranty of MERCHANTABILITY orFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licenseversion 2 for more details (a copy is included in the LICENSE file thataccompanied this code).You should have received a copy of the GNU General Public License version2 along with this work; if not, write to the Free Software Foundation,Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USAor visit www.oracle.com if you need additional information or have anyquestions.________________________________________________________________________'hsdis': A HotSpot plugin for disassembling dynamically generated code.The files in this directory (Makefile, hsdis.[ch], hsdis-demo.c)are built independently of the HotSpot JVM.To use the plugin with a JVM, you need a new version that can load it.If the product mode of your JVM does not accept -XX:+PrintAssembly,you do not have a version that is new enough.* BuildingTo build this project you a copy of GNU binutils to build against. Itis known to work with binutils 2.17 and binutils 2.19.1. Download acopy of the software from http://directory.fsf.org/project/binutils orone of it's mirrors. Builds targetting windows should use at least2.19 and currently requires the use of a cross compiler.The makefile looks for the sources in build/binutils or you canspecify it's location to the makefile using BINTUILS=path. It willconfigure binutils and build it first and then build and link thedisasembly adapter. Make all will build the default target for yourplatform. If you platform support both 32 and 64 simultaneously then"make both" will build them both at once. "make all64" willexplicitly build the 64 bit version. By default this will build thedisassembler library only. If you build demo it will build a demoprogram that attempts to exercise the library.WindowsIn theory this should be buildable on Windows but getting a workingGNU build environment on Windows has proven difficult. MINGW shouldbe able to do it but at the time of this writing I was unable to getthis working. Instead you can use the mingw cross compiler on linuxto produce the windows binaries. For 32-bit windows you can installmingw32 using your package manager and it will be added to your pathautomatically. For 64-bit you need to download the 64 bit mingw fromhttp://sourceforge.net/projects/mingw-w64. Grab a copy of thecomplete toolchain and unpack it somewhere. Put the bin directory ofthe toolchain in your path. The mingw installs contain cross compileversions of gcc that are named with a prefix to indicate what they aretargetting and you must tell the Makefile which one to use. Thisshould either be i586-mingw32msvc or x86_64-pc-mingw32 depending onwhich on you are targetting and there should be a version of gcc inyour path named i586-mingw32msvc-gcc or x86_64-pc-mingw32-gcc. Tellthe makefile what prefix to use to find the mingw tools by usingMINGW=. For example:make MINGW=i586-mingw32msvc BINTUILS=build/binutils-2.19.1will build the Win32 cross compiled version of hsdis based on 2.19.1.* InstallingProducts are named like build/$OS-$LIBARCH/hsdis-$LIBARCH.so. You caninstall them on your LD_LIBRARY_PATH, or inside of your JRE/JDK. Thesearch path in the JVM is:1. <home>/jre/lib/<arch>/<vm>/libhsdis-<arch>.so2. <home>/jre/lib/<arch>/<vm>/hsdis-<arch>.so3. <home>/jre/lib/<arch>/hsdis-<arch>.so4. hsdis-<arch>.so (using LD_LIBRARY_PATH)Note that there's a bug in hotspot versions prior to hs22 that causessteps 2 and 3 to fail when used with JDK7.Now test: export LD_LIBRARY_PATH .../hsdis/build/$OS-$LIBARCH:$LD_LIBRARY_PATH dargs='-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly' dargs=$dargs' -XX:PrintAssemblyOptions=hsdis-print-bytes' java $dargs -Xbatch CompileCommand=print,*String.hashCode HelloWorldIf the product mode of the JVM does not accept -XX:+PrintAssembly,you do not have a version new enough to use the hsdis plugin.