src/share/tools/hsdis/hsdis.h

Mon, 24 Sep 2012 12:44:00 -0700

author
minqi
date
Mon, 24 Sep 2012 12:44:00 -0700
changeset 4093
5a98bf7d847b
parent 2314
f95d63e2154a
child 4244
3d701c802d01
permissions
-rw-r--r--

6879063: SA should use hsdis for disassembly
Summary: We should in SA to use hsdis for it like the JVM does to replace the current java based disassembler.
Reviewed-by: twisti, jrose, sla
Contributed-by: yumin.qi@oracle.com

jrose@535 1 /*
minqi@4093 2 * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
jrose@535 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jrose@535 4 *
jrose@535 5 * This code is free software; you can redistribute it and/or modify it
jrose@535 6 * under the terms of the GNU General Public License version 2 only, as
jrose@535 7 * published by the Free Software Foundation.
jrose@535 8 *
jrose@535 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jrose@535 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jrose@535 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jrose@535 12 * version 2 for more details (a copy is included in the LICENSE file that
jrose@535 13 * accompanied this code).
jrose@535 14 *
jrose@535 15 * You should have received a copy of the GNU General Public License version
jrose@535 16 * 2 along with this work; if not, write to the Free Software Foundation,
jrose@535 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jrose@535 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
jrose@535 22 *
jrose@535 23 */
jrose@535 24
jrose@535 25 /* decode_instructions -- dump a range of addresses as native instructions
jrose@535 26 This implements the protocol required by the HotSpot PrintAssembly option.
jrose@535 27
minqi@4093 28 The start_va, end_va is the virtual address the region of memory to
minqi@4093 29 disasemble and buffer contains the instructions to decode,
minqi@4093 30 Disassembling instructions in the current address space is done by
minqi@4093 31 having start_va == buffer.
jrose@535 32
jrose@535 33 The option string, if not empty, is interpreted by the disassembler implementation.
jrose@535 34
jrose@535 35 The printf callback is 'fprintf' or any other workalike.
jrose@535 36 It is called as (*printf_callback)(printf_stream, "some format...", some, format, args).
jrose@535 37
jrose@535 38 The event callback receives an event tag (a string) and an argument (a void*).
jrose@535 39 It is called as (*event_callback)(event_stream, "tag", arg).
jrose@535 40
jrose@535 41 Events:
jrose@535 42 <insn pc='%p'> begin an instruction, at a given location
jrose@535 43 </insn pc='%d'> end an instruction, at a given location
jrose@535 44 <addr value='%p'/> emit the symbolic value of an address
jrose@535 45
jrose@535 46 A tag format is one of three basic forms: "tag", "/tag", "tag/",
jrose@535 47 where tag is a simple identifier, signifying (as in XML) a element start,
jrose@535 48 element end, and standalone element. (To render as XML, add angle brackets.)
jrose@535 49 */
jrose@535 50 extern
jrose@535 51 #ifdef DLL_EXPORT
jrose@535 52 DLL_EXPORT
jrose@535 53 #endif
minqi@4093 54 void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va,
minqi@4093 55 unsigned char* buffer, uintptr_t length,
minqi@4093 56 void* (*event_callback)(void*, const char*, void*),
minqi@4093 57 void* event_stream,
minqi@4093 58 int (*printf_callback)(void*, const char*, ...),
minqi@4093 59 void* printf_stream,
minqi@4093 60 const char* options);
jrose@535 61
jrose@535 62 /* convenience typedefs */
jrose@535 63
jrose@535 64 typedef void* (*decode_instructions_event_callback_ftype) (void*, const char*, void*);
jrose@535 65 typedef int (*decode_instructions_printf_callback_ftype) (void*, const char*, ...);
minqi@4093 66 typedef void* (*decode_instructions_ftype) (uintptr_t start_va, uintptr_t end_va,
minqi@4093 67 unsigned char* buffer, uintptr_t length,
jrose@535 68 decode_instructions_event_callback_ftype event_callback,
jrose@535 69 void* event_stream,
jrose@535 70 decode_instructions_printf_callback_ftype printf_callback,
jrose@535 71 void* printf_stream,
jrose@535 72 const char* options);

mercurial