opdis/opdis.h File Reference

Public API for libopdis. More...

#include <dis-asm.h>
#include <opdis/types.h>
#include <opdis/insn_buf.h>
#include <opdis/model.h>
#include <opdis/tree.h>

Go to the source code of this file.

Data Structures

struct  opdis_info_t
 An opdis disassembler. More...

Typedefs

typedef int(* OPDIS_HANDLER )(const opdis_insn_t *i, void *arg)
 Callback used to determine if disassembly should continue.
typedef void(* OPDIS_DISPLAY )(const opdis_insn_t *i, void *arg)
 Callback used to display or store a disassembled instruction.
typedef int(* OPDIS_DECODER )(const opdis_insn_buf_t in, opdis_insn_t *out, const opdis_byte_t *buf, opdis_off_t offset, opdis_vma_t vma, opdis_off_t length, void *arg)
 Callback used to fill an opdis_insn_t from an opdis_insn_buf_t.
typedef opdis_vma_t(* OPDIS_RESOLVER )(const opdis_insn_t *i, void *arg)
 Callback used to convert a branch target to a buffer offset.
typedef void(* OPDIS_ERROR )(enum opdis_error_t error, const char *msg, void *arg)
 Callback used to handle error messages.
typedef opdis_info_topdis_t
 Disassembler handle (pointer to opdis_info_t).

Enumerations

enum  opdis_error_t {
  opdis_error_unknown, opdis_error_bounds, opdis_error_invalid_insn, opdis_error_decode_insn,
  opdis_error_bfd, opdis_error_max_items
}
 

Error codes passed to OPDIS_ERROR.

More...
enum  opdis_x86_syntax_t { opdis_x86_syntax_intel, opdis_x86_syntax_att }
 

Syntax options for x86 disassembly.

More...

Functions

int opdis_default_handler (const opdis_insn_t *i, void *arg)
 The built-in opdis handler callback. The default handler returns true unless the instruction is invalid or if the address has already been visited.
void opdis_default_display (const opdis_insn_t *i, void *arg)
 The built-in opdis display callback This callback writes the instruction ascii field to STDOUT.
int opdis_default_decoder (const opdis_insn_buf_t in, opdis_insn_t *out, const opdis_byte_t *buf, opdis_off_t, opdis_vma_t vma, opdis_off_t length, void *arg)
 The built-in opdis instruction decoder This callback fills the ascii, offset, vma, bytes, and size fields of the output instruction object. It is recommended that all other decoders invoke this callback directly to fill these fields.
opdis_vma_t opdis_default_resolver (const opdis_insn_t *i, void *arg)
 The built-in opdis resolver callback. This callback returns the immediate value of the taregt operand for the instruction (if set) or OPDIS_INVALID_ADDR.
void opdis_default_error_reporter (enum opdis_error_t error, const char *msg, void *arg)
 The built-in error reporter.
opdis_t LIBCALL opdis_init (void)
 Initialize an opdis disassembler.
opdis_t LIBCALL opdis_init_from_bfd (bfd *target)
 Initialize an opdis disassembler based on a BFD object.
void LIBCALL opdis_term (opdis_t o)
 Cleanup an opdis disassembler.
void LIBCALL opdis_set_defaults (opdis_t o)
 Initializes an opdis object to default, sane values.
void LIBCALL opdis_set_x86_syntax (opdis_t o, enum opdis_x86_syntax_t syntax)
 Configure the disassembler to use Intel or AT&T syntax.
void LIBCALL opdis_set_arch (opdis_t o, enum bfd_architecture arch, unsigned long mach, disassembler_ftype fn)
 Set the architecture and disassembler routine for libopcodes.
void LIBCALL opdis_set_disassembler_options (opdis_t o, const char *options)
 Set libopcodes disassembler options.
void LIBCALL opdis_set_display (opdis_t o, OPDIS_DISPLAY fn, void *arg)
 Set the callback used to display or store disassembled instructions.
void LIBCALL opdis_set_handler (opdis_t o, OPDIS_HANDLER fn, void *arg)
 Set the callback used to determine whether to continue disassembly.
void LIBCALL opdis_set_decoder (opdis_t o, OPDIS_DECODER fn, void *arg)
 Set the callback used to build an opdis_insn_t from libopcodes data.
void LIBCALL opdis_set_resolver (opdis_t o, OPDIS_RESOLVER fn, void *arg)
 Set the callback used to obtain the buffer offset of a branch target.
void LIBCALL opdis_set_error_reporter (opdis_t o, OPDIS_ERROR fn, void *arg)
 Set the callback used to report errors.
unsigned int LIBCALL opdis_disasm_insn_size (opdis_t o, opdis_buf_t buf, opdis_vma_t vma)
 Return the size of the instruction at an offset in the buffer.
unsigned int LIBCALL opdis_disasm_insn (opdis_t o, opdis_buf_t buf, opdis_vma_t vma, opdis_insn_t *insn)
 Disassemble a single instruction in the buffer.
int LIBCALL opdis_disasm_linear (opdis_t o, opdis_buf_t buf, opdis_vma_t vma, opdis_off_t length)
 Disassemble a sequence of instructions in order.
int LIBCALL opdis_disasm_cflow (opdis_t o, opdis_buf_t buf, opdis_vma_t vma)
 Disassemble a buffer following flow of control.
int LIBCALL opdis_disasm_bfd_linear (opdis_t o, bfd *abfd, opdis_vma_t vma, opdis_off_t length)
 Disassemble a sequence of instructions in a BFD.
int LIBCALL opdis_disasm_bfd_cflow (opdis_t o, bfd *abfd, opdis_vma_t vma)
 Disassemble a contents of a BFD following flow of control.
int LIBCALL opdis_disasm_bfd_section (opdis_t o, asection *sec)
 Disassemble a the contents of a BFD section using linear disassembly.
int LIBCALL opdis_disasm_bfd_symbol (opdis_t o, asymbol *sym)
 Disassemble a BFD following flow of control from a symbol.
int LIBCALL opdis_disasm_bfd_entry (opdis_t o, bfd *abfd)
 Disassemble a BFD following flow of control from entry point (_start).
void LIBCALL opdis_error (opdis_t o, enum opdis_error_t error, const char *msg)
 Send an error message to the error reporter/.
void LIBCALL opdis_debug (opdis_t o, int min_level, const char *format,...)
 Print debug message to STDERR.

Detailed Description

Public API for libopdis.

This defines the API for the libopdis library.

Author:
TG Community Developers <community@thoughtgang.org>
Note:
Copyright (c) 2010 ThoughtGang. Released under the GNU Public License, version 3. See http://www.gnu.org/licenses/gpl.txt for details.

Generated on Wed Mar 10 14:30:45 2010 for Opdis Disassembly Library by  doxygen 1.6.1