src/share/tools/hsdis/hsdis.h
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6879063 Sdiff src/share/tools/hsdis

src/share/tools/hsdis/hsdis.h

Print this page




   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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *
  23  */
  24 
  25 /* decode_instructions -- dump a range of addresses as native instructions
  26    This implements the protocol required by the HotSpot PrintAssembly option.
  27 
  28    The starting and ending addresses are within the current process's address space.



  29 
  30    The option string, if not empty, is interpreted by the disassembler implementation.
  31 
  32    The printf callback is 'fprintf' or any other workalike.
  33    It is called as (*printf_callback)(printf_stream, "some format...", some, format, args).
  34 
  35    The event callback receives an event tag (a string) and an argument (a void*).
  36    It is called as (*event_callback)(event_stream, "tag", arg).
  37 
  38    Events:
  39      <insn pc='%p'>             begin an instruction, at a given location
  40      </insn pc='%d'>            end an instruction, at a given location
  41      <addr value='%p'/>         emit the symbolic value of an address
  42 
  43    A tag format is one of three basic forms: "tag", "/tag", "tag/",
  44    where tag is a simple identifier, signifying (as in XML) a element start,
  45    element end, and standalone element.  (To render as XML, add angle brackets.)
  46 */
  47 extern
  48 #ifdef DLL_EXPORT
  49   DLL_EXPORT
  50 #endif
  51 void* decode_instructions(void* start, void* end,

  52                           void* (*event_callback)(void*, const char*, void*),
  53                           void* event_stream,
  54                           int (*printf_callback)(void*, const char*, ...),
  55                           void* printf_stream,
  56                           const char* options);
  57 
  58 /* convenience typedefs */
  59 
  60 typedef void* (*decode_instructions_event_callback_ftype)  (void*, const char*, void*);
  61 typedef int   (*decode_instructions_printf_callback_ftype) (void*, const char*, ...);
  62 typedef void* (*decode_instructions_ftype) (void* start, void* end,

  63                                             decode_instructions_event_callback_ftype event_callback,
  64                                             void* event_stream,
  65                                             decode_instructions_printf_callback_ftype printf_callback,
  66                                             void* printf_stream,
  67                                             const char* options);


   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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *
  23  */
  24 
  25 /* decode_instructions -- dump a range of addresses as native instructions
  26    This implements the protocol required by the HotSpot PrintAssembly option.
  27 
  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.
  32 
  33    The option string, if not empty, is interpreted by the disassembler implementation.
  34 
  35    The printf callback is 'fprintf' or any other workalike.
  36    It is called as (*printf_callback)(printf_stream, "some format...", some, format, args).
  37 
  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).
  40 
  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
  45 
  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);
  61 
  62 /* convenience typedefs */
  63 
  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);
src/share/tools/hsdis/hsdis.h
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File