static
-IRBB* cg_instrument ( IRBB* bbIn, VexGuestLayout* layout,
- Addr64 orig_addr_noredir, VexGuestExtents* vge,
+IRBB* cg_instrument ( VgCallbackClosure* closure,
+ IRBB* bbIn,
+ VexGuestLayout* layout,
+ VexGuestExtents* vge,
IRType gWordTy, IRType hWordTy )
{
Int i, isize;
// Set up running state and get block info
cgs.events_used = 0;
- cgs.bbInfo = get_BB_info(bbIn, (Addr)orig_addr_noredir);
+ cgs.bbInfo = get_BB_info(bbIn, (Addr)closure->nraddr);
cgs.bbInfo_i = 0;
if (DEBUG_CG)
void VG_(basic_tool_funcs)(
void(*post_clo_init)(void),
- IRBB*(*instrument)(IRBB*, VexGuestLayout*,
- Addr64, VexGuestExtents*, IRType, IRType ),
+ IRBB*(*instrument)(VgCallbackClosure*, IRBB*,
+ VexGuestLayout*, VexGuestExtents*, IRType, IRType),
void(*fini)(Int)
)
{
// Basic functions
void (*tool_pre_clo_init) (void);
void (*tool_post_clo_init)(void);
- IRBB* (*tool_instrument) (IRBB*, VexGuestLayout*,
- Addr64, VexGuestExtents*, IRType, IRType);
+ IRBB* (*tool_instrument) (VgCallbackClosure*,
+ IRBB*,
+ VexGuestLayout*, VexGuestExtents*,
+ IRType, IRType);
void (*tool_fini) (Int);
// VG_(needs).core_errors
}
#endif
static
-IRBB* hg_instrument ( IRBB* bb_in, VexGuestLayout* layout,
- Addr64 orig_addr_noredir, VexGuestExtents* vge,
+IRBB* hg_instrument ( VgCallbackClosure* closure,
+ IRBB* bb,
+ VexGuestLayout* layout,
+ VexGuestExtents* vge,
IRType gWordTy, IRType hWordTy )
{
tl_assert(0); // Need to convert to Vex
/* ------------------------------------------------------------------ */
/* Basic tool functions */
+/* The tool_instrument function is passed as a callback to
+ LibVEX_Translate. VgInstrumentClosure carries additional info
+ which the instrumenter might like to know, but which is opaque to
+ Vex.
+*/
+typedef
+ struct {
+ Addr64 nraddr; /* non-redirected guest address */
+ Addr64 readdr; /* redirected guest address */
+ ThreadId tid; /* tid requesting translation */
+ }
+ VgCallbackClosure;
+
extern void VG_(basic_tool_funcs)(
// Do any initialisation that can only be done after command line
// processing.
// strange... Note that orig_addr_noredir is not necessarily the
// same as the address of the first instruction in the IR, due to
// function redirection.
- IRBB* (*instrument)(IRBB* bb_in, VexGuestLayout* layout,
- Addr64 orig_addr_noredir, VexGuestExtents* vge,
- IRType gWordTy, IRType hWordTy ),
+ IRBB*(*instrument)(VgCallbackClosure*,
+ IRBB* bb_in,
+ VexGuestLayout*, VexGuestExtents*,
+ IRType gWordTy, IRType hWordTy),
// Finish up, print out any results, etc. `exitcode' is program's exit
// code. The shadow can be found with VG_(get_exit_status_shadow)().
}
static
-IRBB* lk_instrument( IRBB* bb_in, VexGuestLayout* layout,
- Addr64 orig_addr_noredir, VexGuestExtents* vge,
- IRType gWordTy, IRType hWordTy )
+IRBB* lk_instrument ( VgCallbackClosure* closure,
+ IRBB* bb_in,
+ VexGuestLayout* layout,
+ VexGuestExtents* vge,
+ IRType gWordTy, IRType hWordTy )
{
IRDirty* di;
Int i;
/*------------------------------------------------------------*/
static
-IRBB* ms_instrument ( IRBB* bb_in, VexGuestLayout* layout,
- Addr64 orig_addr_noredir, VexGuestExtents* vge,
+IRBB* ms_instrument ( VgCallbackClosure* closure,
+ IRBB* bb_in,
+ VexGuestLayout* layout,
+ VexGuestExtents* vge,
IRType gWordTy, IRType hWordTy )
{
/* XXX Will Massif work when gWordTy != hWordTy ? */
/* Functions defined in mc_translate.c */
extern
-IRBB* MC_(instrument) ( IRBB* bb_in, VexGuestLayout* layout,
- Addr64 orig_addr_noredir, VexGuestExtents* vge,
+IRBB* MC_(instrument) ( VgCallbackClosure* closure,
+ IRBB* bb_in,
+ VexGuestLayout* layout,
+ VexGuestExtents* vge,
IRType gWordTy, IRType hWordTy );
#endif /* ndef __MC_INCLUDE_H */
}
-IRBB* MC_(instrument) ( IRBB* bb_in, VexGuestLayout* layout,
- Addr64 orig_addr_noredir, VexGuestExtents* vge,
+IRBB* MC_(instrument) ( VgCallbackClosure* closure,
+ IRBB* bb_in,
+ VexGuestLayout* layout,
+ VexGuestExtents* vge,
IRType gWordTy, IRType hWordTy )
{
Bool verboze = False; //True;
}
static
-IRBB* nl_instrument(IRBB* bb, VexGuestLayout* layout,
- Addr64 orig_addr_noredir, VexGuestExtents* vge,
- IRType gWordTy, IRType hWordTy)
+IRBB* nl_instrument ( VgCallbackClosure* closure,
+ IRBB* bb,
+ VexGuestLayout* layout,
+ VexGuestExtents* vge,
+ IRType gWordTy, IRType hWordTy )
{
return bb;
}