Printing (disassembling) Instructions


Detailed Description

There are two kinds of printers. The legacy printers to not take a void* context parameter. The other printers take a void* context parameter that is only passed to a callback function registered by calling xed_register_disassembly_callback(). The callback is used for symbolic disassembly.


Legacy printers without context parameter

XED_DLL_EXPORT xed_bool_t xed_format (xed_syntax_enum_t syntax, xed_decoded_inst_t *xedd, char *out_buffer, int buffer_len, xed_uint64_t runtime_instruction_address)
 Disassemble the decoded instruction using the specified syntax.
XED_DLL_EXPORT xed_bool_t xed_format_att (xed_decoded_inst_t *xedd, char *out_buffer, xed_uint32_t buffer_len, xed_uint64_t runtime_instruction_address)
 Disassemble the decoded instruction using the ATT SYSV syntax.
XED_DLL_EXPORT xed_bool_t xed_format_intel (xed_decoded_inst_t *xedd, char *out_buffer, xed_uint32_t buffer_len, xed_uint64_t runtime_instruction_address)
 Disassemble the decoded instruction using the Intel syntax.
XED_DLL_EXPORT xed_bool_t xed_format_xed (xed_decoded_inst_t *xedd, char *out_buffer, xed_uint32_t buffer_len, xed_uint64_t runtime_instruction_address)
 Disassemble the decoded instruction using the XED syntax providing all operand resources (implicit, explicit, suppressed).

Printers with context parameter

XED_DLL_EXPORT xed_bool_t xed_format_att_context (xed_decoded_inst_t *xedd, char *out_buffer, xed_uint32_t buffer_len, xed_uint64_t runtime_instruction_address, void *context)
 Disassemble the decoded instruction using the ATT SYSV syntax.
XED_DLL_EXPORT xed_bool_t xed_format_context (xed_syntax_enum_t syntax, xed_decoded_inst_t *xedd, char *out_buffer, int buffer_len, xed_uint64_t runtime_instruction_address, void *context)
 Disassemble the decoded instruction using the specified syntax.
XED_DLL_EXPORT xed_bool_t xed_format_intel_context (xed_decoded_inst_t *xedd, char *out_buffer, xed_uint32_t buffer_len, xed_uint64_t runtime_instruction_address, void *context)
 Disassemble the decoded instruction using the Intel syntax.

Typedefs

typedef int XED_DLL_EXPORT(* xed_disassembly_callback_fn_t )(xed_uint64_t address, char *symbol_buffer, xed_uint32_t buffer_length, xed_uint64_t *offset, void *context)

Functions

XED_DLL_EXPORT void xed_register_disassembly_callback (xed_disassembly_callback_fn_t f)
 Register a disassembly call back function of type xed_disassembly_callback_fn_t to get called when the disassembler needs to get a symbol and offset for an address.


Typedef Documentation

typedef int XED_DLL_EXPORT(* xed_disassembly_callback_fn_t)(xed_uint64_t address, char *symbol_buffer, xed_uint32_t buffer_length, xed_uint64_t *offset, void *context)
 

Parameters:
address The input address for which we want symbolic name and offset
symbol_buffer A buffer to hold the symbol name. The callback function should fill this in and terminate with a null byte.
buffer_length The maximum length of the symbol_buffer including then null
offset A pointer to a xed_uint64_t to old the offset from the provided symbol.
context This void* pointer passed to the disassembler's new interface so that the caller can identify the proper context against which to resolve the symbols. The disassembler passes this value to the callback. The legacy formatters that do not have context will pass zero for this parameter.
Returns:
0 on failure, 1 on success.

Definition at line 60 of file xed-disas.h.


Function Documentation

XED_DLL_EXPORT xed_bool_t xed_format xed_syntax_enum_t  syntax,
xed_decoded_inst_t xedd,
char *  out_buffer,
int  buffer_len,
xed_uint64_t  runtime_instruction_address
 

Disassemble the decoded instruction using the specified syntax.

The output buffer must be at least 25 bytes long. Returns true if disassembly proceeded without errors.

Parameters:
syntax a xed_syntax_enum_t the specifies the disassembly format
xedd a xed_decoded_inst_t for a decoded instruction
out_buffer a buffer to write the disassembly in to.
buffer_len maximum length of the disassembly buffer
runtime_instruction_address the address of the instruction being disassembled
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

XED_DLL_EXPORT xed_bool_t xed_format_att xed_decoded_inst_t xedd,
char *  out_buffer,
xed_uint32_t  buffer_len,
xed_uint64_t  runtime_instruction_address
 

Disassemble the decoded instruction using the ATT SYSV syntax.

The output buffer must be at least 16 bytes long. Returns true if disassembly proceeded without errors.

Parameters:
xedd a xed_decoded_inst_t for a decoded instruction
out_buffer a buffer to write the disassembly in to.
buffer_len maximum length of the disassembly buffer
runtime_instruction_address the address of the instruction being disassembled
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

XED_DLL_EXPORT xed_bool_t xed_format_att_context xed_decoded_inst_t xedd,
char *  out_buffer,
xed_uint32_t  buffer_len,
xed_uint64_t  runtime_instruction_address,
void *  context
 

Disassemble the decoded instruction using the ATT SYSV syntax.

The output buffer must be at least 16 bytes long. Returns true if disassembly proceeded without errors.

Parameters:
xedd a xed_decoded_inst_t for a decoded instruction
out_buffer a buffer to write the disassembly in to.
buffer_len maximum length of the disassembly buffer
runtime_instruction_address the address of the instruction being disassembled
context A void* used only for the call back routine for symbolic disassembly if one is registered.
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

XED_DLL_EXPORT xed_bool_t xed_format_context xed_syntax_enum_t  syntax,
xed_decoded_inst_t xedd,
char *  out_buffer,
int  buffer_len,
xed_uint64_t  runtime_instruction_address,
void *  context
 

Disassemble the decoded instruction using the specified syntax.

The output buffer must be at least 25 bytes long. Returns true if disassembly proceeded without errors.

Parameters:
syntax a xed_syntax_enum_t the specifies the disassembly format
xedd a xed_decoded_inst_t for a decoded instruction
out_buffer a buffer to write the disassembly in to.
buffer_len maximum length of the disassembly buffer
runtime_instruction_address the address of the instruction being disassembled
context A void* used only for the call back routine for symbolic disassembly if one is registered.
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

XED_DLL_EXPORT xed_bool_t xed_format_intel xed_decoded_inst_t xedd,
char *  out_buffer,
xed_uint32_t  buffer_len,
xed_uint64_t  runtime_instruction_address
 

Disassemble the decoded instruction using the Intel syntax.

The output buffer must be at least 16 bytes long. Returns true if disassembly proceeded without errors.

Parameters:
xedd a xed_decoded_inst_t for a decoded instruction
out_buffer a buffer to write the disassembly in to.
buffer_len maximum length of the disassembly buffer
runtime_instruction_address the address of the instruction being disassembled
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

XED_DLL_EXPORT xed_bool_t xed_format_intel_context xed_decoded_inst_t xedd,
char *  out_buffer,
xed_uint32_t  buffer_len,
xed_uint64_t  runtime_instruction_address,
void *  context
 

Disassemble the decoded instruction using the Intel syntax.

The output buffer must be at least 16 bytes long. Returns true if disassembly proceeded without errors.

Parameters:
xedd a xed_decoded_inst_t for a decoded instruction
out_buffer a buffer to write the disassembly in to.
buffer_len maximum length of the disassembly buffer
runtime_instruction_address the address of the instruction being disassembled
context A void* used only for the call back routine for symbolic disassembly if one is registered.
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

XED_DLL_EXPORT xed_bool_t xed_format_xed xed_decoded_inst_t xedd,
char *  out_buffer,
xed_uint32_t  buffer_len,
xed_uint64_t  runtime_instruction_address
 

Disassemble the decoded instruction using the XED syntax providing all operand resources (implicit, explicit, suppressed).

The output buffer must be at least 25 bytes long. Returns true if disassembly proceeded without errors.

Parameters:
xedd a xed_decoded_inst_t for a decoded instruction
out_buffer a buffer to write the disassembly in to.
buffer_len maximum length of the disassembly buffer
runtime_instruction_address the address of the instruction being disassembled
Returns:
Returns 0 if the disassembly fails, 1 otherwise.

XED_DLL_EXPORT void xed_register_disassembly_callback xed_disassembly_callback_fn_t  f  ) 
 

Register a disassembly call back function of type xed_disassembly_callback_fn_t to get called when the disassembler needs to get a symbol and offset for an address.


Generated on Thu May 15 03:15:09 2008 for XED2 by  doxygen 1.4.6