Data model implementation for libopdis. More...
#include <stdlib.h>
#include <string.h>
#include <opdis/model.h>
Defines | |
#define | PREFIX_SIZE(mnem_size) (4 * mnem_size) |
#define | delim_strcat(buf, max_size, str, delim, use_delim) |
Functions | |
opdis_insn_t *LIBCALL | opdis_insn_alloc (opdis_off_t num_operands) |
Allocate an instruction object and initialize its contents to zero. | |
opdis_insn_t *LIBCALL | opdis_insn_alloc_fixed (size_t ascii_sz, size_t mnemonic_sz, size_t num_operands, size_t op_ascii_sz) |
Allocate a fixed-size instruction object for use as a buffer. | |
opdis_insn_t *LIBCALL | opdis_insn_dupe (const opdis_insn_t *insn) |
Duplicate an instruction object. | |
void LIBCALL | opdis_insn_clear (opdis_insn_t *insn) |
Clear the contents of an instruction object. | |
void LIBCALL | opdis_insn_free (opdis_insn_t *insn) |
Free an allocated instruction object. | |
void LIBCALL | opdis_insn_set_ascii (opdis_insn_t *i, const char *ascii) |
Set the ascii field of an instruction. | |
void LIBCALL | opdis_insn_set_mnemonic (opdis_insn_t *i, const char *mnemonic) |
Set the mnemonic field of an instruction. | |
void LIBCALL | opdis_insn_add_prefix (opdis_insn_t *i, const char *prefix) |
Append a string to the prefix field. | |
void LIBCALL | opdis_insn_add_comment (opdis_insn_t *i, const char *cmt) |
Append a string to the comment field. | |
int LIBCALL | opdis_insn_add_operand (opdis_insn_t *i, opdis_op_t *op) |
Add an operand to an instruction. | |
opdis_op_t *LIBCALL | opdis_insn_next_avail_op (opdis_insn_t *i) |
Return next available allocated operand. | |
int LIBCALL | opdis_insn_is_branch (opdis_insn_t *i) |
Determine if the instruction has a branch target operand. | |
int LIBCALL | opdis_insn_fallthrough (opdis_insn_t *i) |
Determine if the execution falls through to the next instruction. | |
opdis_op_t *LIBCALL | opdis_op_alloc (void) |
Allocate an operand object. | |
opdis_op_t *LIBCALL | opdis_op_alloc_fixed (size_t ascii_sz) |
Allocate a fixed-size operand object for use as a buffer. | |
opdis_op_t *LIBCALL | opdis_op_dupe (opdis_op_t *op) |
Duplicate an operand object. | |
void LIBCALL | opdis_op_clear (opdis_op_t *op) |
Clear the contents of an operand object. | |
void LIBCALL | opdis_op_free (opdis_op_t *op) |
Free an allocated operand object. | |
void LIBCALL | opdis_op_set_ascii (opdis_op_t *op, const char *ascii) |
Set the ascii field of an operand. | |
int LIBCALL | opdis_insn_isa_str (const opdis_insn_t *insn, char *buf, int buf_len) |
Generate a string representation of instruction isa field. | |
int LIBCALL | opdis_insn_cat_str (const opdis_insn_t *insn, char *buf, int buf_len) |
Generate a string representation of instruction category field. | |
int LIBCALL | opdis_insn_flags_str (const opdis_insn_t *insn, char *buf, int buf_len, const char *delim) |
Generate a string representation of instruction flags field. | |
int LIBCALL | opdis_op_cat_str (const opdis_op_t *op, char *buf, int buf_len) |
Generate a string representation of operand category field. | |
int LIBCALL | opdis_op_flags_str (const opdis_op_t *op, char *buf, int buf_len, const char *delim) |
Generate a string representation of operand flags field. | |
int LIBCALL | opdis_reg_flags_str (const opdis_reg_t *reg, char *buf, int buf_len, const char *delim) |
Generate a string representation of register flags field. | |
int LIBCALL | opdis_addr_expr_shift_str (const opdis_addr_expr_t *exp, char *buf, int buf_len) |
Generate a string representation of addr expression shift field. |
Data model implementation for libopdis.
#define delim_strcat | ( | buf, | |||
max_size, | |||||
str, | |||||
delim, | |||||
use_delim | ) |
if ( use_delim ) { \
strncat( buf, delim, max_size ); \
max_size -= strlen(delim); \
} \
strncat( buf, str, max_size ); \
max_size -= strlen(str); \
use_delim = 1;