xref: /titanic_44/usr/src/cmd/mdb/common/mdb/mdb_disasm.h (revision 99ebb4ca412cb0a19d77a3899a87c055b9c30fa8)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_MDB_DISASM_H
28 #define	_MDB_DISASM_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <mdb/mdb_target.h>
33 #include <mdb/mdb_modapi.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #ifdef _MDB
40 
41 /*
42  * Forward declaration of the disassembler structure: the internals are defined
43  * in mdb_disasm_impl.h and is opaque with respect to callers of this interface.
44  */
45 
46 struct mdb_disasm;
47 typedef struct mdb_disasm mdb_disasm_t;
48 
49 /*
50  * Disassemblers are created by calling mdb_dis_create() with a disassembler
51  * constructor function.  A constructed disassembler can be selected (made
52  * the current disassembler) by invoking mdb_dis_select().
53  */
54 
55 typedef int mdb_dis_ctor_f(mdb_disasm_t *);
56 
57 extern int mdb_dis_select(const char *);
58 extern mdb_disasm_t *mdb_dis_create(mdb_dis_ctor_f *);
59 extern void mdb_dis_destroy(mdb_disasm_t *);
60 
61 /*
62  * Disassembler operations - instruction-to-string and backstep.
63  */
64 extern mdb_tgt_addr_t mdb_dis_ins2str(mdb_disasm_t *, mdb_tgt_t *,
65     mdb_tgt_as_t, char *, size_t, mdb_tgt_addr_t);
66 extern mdb_tgt_addr_t mdb_dis_previns(mdb_disasm_t *, mdb_tgt_t *,
67     mdb_tgt_as_t, mdb_tgt_addr_t, uint_t);
68 extern mdb_tgt_addr_t mdb_dis_nextins(mdb_disasm_t *, mdb_tgt_t *,
69     mdb_tgt_as_t, mdb_tgt_addr_t);
70 
71 /*
72  * Builtin dcmds for selecting and listing disassemblers:
73  */
74 extern int cmd_dismode(uintptr_t, uint_t, int, const mdb_arg_t *);
75 extern int cmd_disasms(uintptr_t, uint_t, int, const mdb_arg_t *);
76 
77 #endif	/* _MDB */
78 
79 #ifdef	__cplusplus
80 }
81 #endif
82 
83 #endif	/* _MDB_DISASM_H */
84