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 #include <mdb/mdb_target.h> 31 #include <mdb/mdb_modapi.h> 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #ifdef _MDB 38 39 /* 40 * Forward declaration of the disassembler structure: the internals are defined 41 * in mdb_disasm_impl.h and is opaque with respect to callers of this interface. 42 */ 43 44 struct mdb_disasm; 45 typedef struct mdb_disasm mdb_disasm_t; 46 47 /* 48 * Disassemblers are created by calling mdb_dis_create() with a disassembler 49 * constructor function. A constructed disassembler can be selected (made 50 * the current disassembler) by invoking mdb_dis_select(). 51 */ 52 53 typedef int mdb_dis_ctor_f(mdb_disasm_t *); 54 55 extern int mdb_dis_select(const char *); 56 extern mdb_disasm_t *mdb_dis_create(mdb_dis_ctor_f *); 57 extern void mdb_dis_destroy(mdb_disasm_t *); 58 59 /* 60 * Disassembler operations - instruction-to-string and backstep. 61 */ 62 extern mdb_tgt_addr_t mdb_dis_ins2str(mdb_disasm_t *, mdb_tgt_t *, 63 mdb_tgt_as_t, char *, size_t, mdb_tgt_addr_t); 64 extern mdb_tgt_addr_t mdb_dis_previns(mdb_disasm_t *, mdb_tgt_t *, 65 mdb_tgt_as_t, mdb_tgt_addr_t, uint_t); 66 extern mdb_tgt_addr_t mdb_dis_nextins(mdb_disasm_t *, mdb_tgt_t *, 67 mdb_tgt_as_t, mdb_tgt_addr_t); 68 69 /* 70 * Builtin dcmds for selecting and listing disassemblers: 71 */ 72 extern int cmd_dismode(uintptr_t, uint_t, int, const mdb_arg_t *); 73 extern int cmd_disasms(uintptr_t, uint_t, int, const mdb_arg_t *); 74 75 #endif /* _MDB */ 76 77 #ifdef __cplusplus 78 } 79 #endif 80 81 #endif /* _MDB_DISASM_H */ 82