Skip to content

Instantly share code, notes, and snippets.

@moyix

moyix/repro.cpp Secret

Created October 14, 2017 16:00
Show Gist options
  • Save moyix/e0e8f398fff6bd5df80d9aad630df754 to your computer and use it in GitHub Desktop.
Save moyix/e0e8f398fff6bd5df80d9aad630df754 to your computer and use it in GitHub Desktop.
#define __STDC_FORMAT_MACROS
#include "panda/plugin.h"
// These need to be extern "C" so that the ABI is compatible with
// QEMU/PANDA, which is written in C
extern "C" {
bool init_plugin(void *);
void uninit_plugin(void *);
}
int after_block_exec(CPUState *env, TranslationBlock *tb) {
assert (tb->size != 0 && tb->icount != 0);
return 0;
}
bool init_plugin(void *self) {
panda_cb pcb;
pcb.after_block_exec = after_block_exec;
panda_register_callback(self, PANDA_CB_AFTER_BLOCK_EXEC, pcb);
return true;
}
void uninit_plugin(void *self) { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment