src/share/tools/hsdis/hsdis.h

Print this page


   1 /*
   2  * Copyright (c) 2008, 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  */
  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,


  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);


   1 /*
   2  * Copyright (c) 2008, 2010, 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  */
  24 
  25 #ifndef SHARE_TOOLS_HSDIS_HSDIS_H
  26 #define SHARE_TOOLS_HSDIS_HSDIS_H
  27 
  28 /* decode_instructions -- dump a range of addresses as native instructions
  29    This implements the protocol required by the HotSpot PrintAssembly option.
  30 
  31    The starting and ending addresses are within the current process's address space.
  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,


  51 #ifdef DLL_EXPORT
  52   DLL_EXPORT
  53 #endif
  54 void* decode_instructions(void* start, void* end,
  55                           void* (*event_callback)(void*, const char*, void*),
  56                           void* event_stream,
  57                           int (*printf_callback)(void*, const char*, ...),
  58                           void* printf_stream,
  59                           const char* options);
  60 
  61 /* convenience typedefs */
  62 
  63 typedef void* (*decode_instructions_event_callback_ftype)  (void*, const char*, void*);
  64 typedef int   (*decode_instructions_printf_callback_ftype) (void*, const char*, ...);
  65 typedef void* (*decode_instructions_ftype) (void* start, void* end,
  66                                             decode_instructions_event_callback_ftype event_callback,
  67                                             void* event_stream,
  68                                             decode_instructions_printf_callback_ftype printf_callback,
  69                                             void* printf_stream,
  70                                             const char* options);
  71 
  72 #endif // SHARE_TOOLS_HSDIS_HSDIS_H