Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/tools/hsdis/hsdis.h
32285 views
/*1* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* The Universal Permissive License (UPL), Version 1.05*6* Subject to the condition set forth below, permission is hereby granted to7* any person obtaining a copy of this software, associated documentation8* and/or data (collectively the "Software"), free of charge and under any9* and all copyright rights in the Software, and any and all patent rights10* owned or freely licensable by each licensor hereunder covering either (i)11* the unmodified Software as contributed to or provided by such licensor,12* or (ii) the Larger Works (as defined below), to deal in both13*14* (a) the Software, and15*16* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file17* if one is included with the Software (each a "Larger Work" to which the18* Software is contributed by such licensors),19*20* without restriction, including without limitation the rights to copy,21* create derivative works of, display, perform, and distribute the Software22* and make, use, sell, offer for sale, import, export, have made, and have23* sold the Software and the Larger Work(s), and to sublicense the foregoing24* rights on either these or other terms.25*26* This license is subject to the following condition:27*28* The above copyright notice and either this complete permission notice or29* at a minimum a reference to the UPL must be included in all copies or30* substantial portions of the Software.31*32* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS33* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF34* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN35* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,36* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR37* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE38* USE OR OTHER DEALINGS IN THE SOFTWARE.39*40* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA41* or visit www.oracle.com if you need additional information or have any42* questions.43*44*/4546/* decode_instructions -- dump a range of addresses as native instructions47This implements the protocol required by the HotSpot PrintAssembly option.4849The start_va, end_va is the virtual address the region of memory to50disasemble and buffer contains the instructions to decode,51Disassembling instructions in the current address space is done by52having start_va == buffer.5354The option string, if not empty, is interpreted by the disassembler implementation.5556The printf callback is 'fprintf' or any other workalike.57It is called as (*printf_callback)(printf_stream, "some format...", some, format, args).5859The event callback receives an event tag (a string) and an argument (a void*).60It is called as (*event_callback)(event_stream, "tag", arg).6162Events:63<insn pc='%p'> begin an instruction, at a given location64</insn pc='%d'> end an instruction, at a given location65<addr value='%p'/> emit the symbolic value of an address6667A tag format is one of three basic forms: "tag", "/tag", "tag/",68where tag is a simple identifier, signifying (as in XML) a element start,69element end, and standalone element. (To render as XML, add angle brackets.)70*/71#ifndef SHARED_TOOLS_HSDIS_H72#define SHARED_TOOLS_HSDIS_H7374extern75#ifdef DLL_EXPORT76DLL_EXPORT77#endif78void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va,79unsigned char* buffer, uintptr_t length,80void* (*event_callback)(void*, const char*, void*),81void* event_stream,82int (*printf_callback)(void*, const char*, ...),83void* printf_stream,84const char* options,85int newline /* bool value for nice new line */);8687/* This is the compatability interface for older versions of hotspot */88extern89#ifdef DLL_ENTRY90DLL_ENTRY91#endif92void* decode_instructions(void* start_pv, void* end_pv,93void* (*event_callback)(void*, const char*, void*),94void* event_stream,95int (*printf_callback)(void*, const char*, ...),96void* printf_stream,97const char* options);9899/* convenience typedefs */100101typedef void* (*decode_instructions_event_callback_ftype) (void*, const char*, void*);102typedef int (*decode_instructions_printf_callback_ftype) (void*, const char*, ...);103typedef void* (*decode_func_vtype) (uintptr_t start_va, uintptr_t end_va,104unsigned char* buffer, uintptr_t length,105decode_instructions_event_callback_ftype event_callback,106void* event_stream,107decode_instructions_printf_callback_ftype printf_callback,108void* printf_stream,109const char* options,110int newline);111typedef void* (*decode_func_stype) (void* start_pv, void* end_pv,112decode_instructions_event_callback_ftype event_callback,113void* event_stream,114decode_instructions_printf_callback_ftype printf_callback,115void* printf_stream,116const char* options);117#endif /* SHARED_TOOLS_HSDIS_H */118119120