/**
* Callback prior to instruction decode
*/
- void (*instr_cb)(void *data, unsigned n, void *instr);
+ void (*pre_instr_cb)(void *data, unsigned n, void *instr);
+
+ /**
+ * Callback after instruction decode
+ */
+ void (*post_instr_cb)(void *data, unsigned n, void *instr);
/**
* callback for undefined instructions
*/
if ((BITSET_TEST(state->call_targets, state->n) || entrypoint) &&
state->n != 0) {
- if (state->options->instr_cb) {
- state->options->instr_cb(state->options->cbdata,
+ if (state->options->pre_instr_cb) {
+ state->options->pre_instr_cb(state->options->cbdata,
state->n, instr.bitset);
}
isa_print(&state->print, "\n");
while (state->next_entrypoint != state->end_entrypoint &&
state->next_entrypoint->offset == state->n) {
- if (state->options->instr_cb) {
- state->options->instr_cb(state->options->cbdata,
+ if (state->options->pre_instr_cb) {
+ state->options->pre_instr_cb(state->options->cbdata,
state->n, instr.bitset);
}
isa_print(&state->print, "%s:\n", state->next_entrypoint->name);
}
if (BITSET_TEST(state->call_targets, state->n)) {
- if (state->options->instr_cb) {
- state->options->instr_cb(state->options->cbdata,
+ if (state->options->pre_instr_cb) {
+ state->options->pre_instr_cb(state->options->cbdata,
state->n, instr.bitset);
}
isa_print(&state->print, "fxn%d:\n", state->n);
}
if (BITSET_TEST(state->branch_targets, state->n)) {
- if (state->options->instr_cb) {
- state->options->instr_cb(state->options->cbdata,
+ if (state->options->pre_instr_cb) {
+ state->options->pre_instr_cb(state->options->cbdata,
state->n, instr.bitset);
}
isa_print(&state->print, "l%d:\n", state->n);
}
}
- if (state->options->instr_cb) {
- state->options->instr_cb(state->options->cbdata, state->n, instr.bitset);
+ if (state->options->pre_instr_cb) {
+ state->options->pre_instr_cb(state->options->cbdata, state->n, instr.bitset);
}
const struct isa_bitset *b = find_bitset(state, __instruction, instr);
} else {
errors = 0;
}
+
+ if (state->options->post_instr_cb) {
+ state->options->post_instr_cb(state->options->cbdata, state->n, instr.bitset);
+ }
+
isa_print(&state->print, "\n");
pop_scope(scope);