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

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

mercurial