jrose@535: /* trims@2708: * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. jrose@535: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jrose@535: * jrose@535: * This code is free software; you can redistribute it and/or modify it jrose@535: * under the terms of the GNU General Public License version 2 only, as jrose@535: * published by the Free Software Foundation. jrose@535: * jrose@535: * This code is distributed in the hope that it will be useful, but WITHOUT jrose@535: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jrose@535: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jrose@535: * version 2 for more details (a copy is included in the LICENSE file that jrose@535: * accompanied this code). jrose@535: * jrose@535: * You should have received a copy of the GNU General Public License version jrose@535: * 2 along with this work; if not, write to the Free Software Foundation, jrose@535: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jrose@535: * trims@1907: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: * or visit www.oracle.com if you need additional information or have any trims@1907: * questions. jrose@535: * jrose@535: */ jrose@535: stefank@2314: #ifndef SHARE_VM_COMPILER_DISASSEMBLER_HPP stefank@2314: #define SHARE_VM_COMPILER_DISASSEMBLER_HPP stefank@2314: stefank@2314: #include "runtime/globals.hpp" stefank@2314: #ifdef TARGET_OS_FAMILY_linux stefank@2314: # include "os_linux.inline.hpp" stefank@2314: #endif stefank@2314: #ifdef TARGET_OS_FAMILY_solaris stefank@2314: # include "os_solaris.inline.hpp" stefank@2314: #endif stefank@2314: #ifdef TARGET_OS_FAMILY_windows stefank@2314: # include "os_windows.inline.hpp" stefank@2314: #endif stefank@2314: jrose@535: class decode_env; jrose@535: jrose@535: // The disassembler prints out assembly code annotated jrose@535: // with Java specific information. jrose@535: jrose@535: class Disassembler { jrose@535: friend class decode_env; jrose@535: private: jrose@535: // this is the type of the dll entry point: jrose@535: typedef void* (*decode_func)(void* start, void* end, jrose@535: void* (*event_callback)(void*, const char*, void*), jrose@535: void* event_stream, jrose@535: int (*printf_callback)(void*, const char*, ...), jrose@535: void* printf_stream, jrose@535: const char* options); jrose@535: // points to the library. jrose@535: static void* _library; jrose@535: // bailout jrose@535: static bool _tried_to_load_library; jrose@535: // points to the decode function. jrose@535: static decode_func _decode_instructions; jrose@535: // tries to load library and return whether it succedded. jrose@535: static bool load_library(); jrose@535: jrose@535: // Machine dependent stuff stefank@2314: #ifdef TARGET_ARCH_x86 stefank@2314: # include "disassembler_x86.hpp" stefank@2314: #endif stefank@2314: #ifdef TARGET_ARCH_sparc stefank@2314: # include "disassembler_sparc.hpp" stefank@2314: #endif stefank@2314: #ifdef TARGET_ARCH_zero stefank@2314: # include "disassembler_zero.hpp" stefank@2314: #endif bobv@2508: #ifdef TARGET_ARCH_arm bobv@2508: # include "disassembler_arm.hpp" bobv@2508: #endif bobv@2508: #ifdef TARGET_ARCH_ppc bobv@2508: # include "disassembler_ppc.hpp" bobv@2508: #endif stefank@2314: jrose@535: jrose@535: public: jrose@535: static bool can_decode() { jrose@535: return (_decode_instructions != NULL) || load_library(); jrose@535: } jrose@535: static void decode(CodeBlob *cb, outputStream* st = NULL); jrose@535: static void decode(nmethod* nm, outputStream* st = NULL); jrose@535: static void decode(address begin, address end, outputStream* st = NULL); jrose@535: }; stefank@2314: stefank@2314: #endif // SHARE_VM_COMPILER_DISASSEMBLER_HPP