comparison src/share/tools/hsdis/hsdis.h @ 6782:5a98bf7d847b

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
author minqi
date Mon, 24 Sep 2012 12:44:00 -0700
parents f95d63e2154a
children 3d701c802d01
comparison
equal deleted inserted replaced
6780:8440414b0fd8 6782:5a98bf7d847b
1 /* 1 /*
2 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 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. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
23 */ 23 */
24 24
25 /* decode_instructions -- dump a range of addresses as native instructions 25 /* decode_instructions -- dump a range of addresses as native instructions
26 This implements the protocol required by the HotSpot PrintAssembly option. 26 This implements the protocol required by the HotSpot PrintAssembly option.
27 27
28 The starting and ending addresses are within the current process's address space. 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.
29 32
30 The option string, if not empty, is interpreted by the disassembler implementation. 33 The option string, if not empty, is interpreted by the disassembler implementation.
31 34
32 The printf callback is 'fprintf' or any other workalike. 35 The printf callback is 'fprintf' or any other workalike.
33 It is called as (*printf_callback)(printf_stream, "some format...", some, format, args). 36 It is called as (*printf_callback)(printf_stream, "some format...", some, format, args).
46 */ 49 */
47 extern 50 extern
48 #ifdef DLL_EXPORT 51 #ifdef DLL_EXPORT
49 DLL_EXPORT 52 DLL_EXPORT
50 #endif 53 #endif
51 void* decode_instructions(void* start, void* end, 54 void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va,
52 void* (*event_callback)(void*, const char*, void*), 55 unsigned char* buffer, uintptr_t length,
53 void* event_stream, 56 void* (*event_callback)(void*, const char*, void*),
54 int (*printf_callback)(void*, const char*, ...), 57 void* event_stream,
55 void* printf_stream, 58 int (*printf_callback)(void*, const char*, ...),
56 const char* options); 59 void* printf_stream,
60 const char* options);
57 61
58 /* convenience typedefs */ 62 /* convenience typedefs */
59 63
60 typedef void* (*decode_instructions_event_callback_ftype) (void*, const char*, void*); 64 typedef void* (*decode_instructions_event_callback_ftype) (void*, const char*, void*);
61 typedef int (*decode_instructions_printf_callback_ftype) (void*, const char*, ...); 65 typedef int (*decode_instructions_printf_callback_ftype) (void*, const char*, ...);
62 typedef void* (*decode_instructions_ftype) (void* start, void* end, 66 typedef void* (*decode_instructions_ftype) (uintptr_t start_va, uintptr_t end_va,
67 unsigned char* buffer, uintptr_t length,
63 decode_instructions_event_callback_ftype event_callback, 68 decode_instructions_event_callback_ftype event_callback,
64 void* event_stream, 69 void* event_stream,
65 decode_instructions_printf_callback_ftype printf_callback, 70 decode_instructions_printf_callback_ftype printf_callback,
66 void* printf_stream, 71 void* printf_stream,
67 const char* options); 72 const char* options);