These files all speak about instrumentation functions.

Instrumentation functions now take a callback closure structure
(VgCallbackClosure*), so this commit changes the signatures
accordingly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5535
This commit is contained in:
Julian Seward 2006-01-17 02:06:39 +00:00
parent 285cab7087
commit f0d678baab
10 changed files with 54 additions and 24 deletions

View File

@ -705,8 +705,10 @@ void addEvent_Dw ( CgState* cgs, InstrInfo* inode, Int datasize, IRAtom* ea )
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;
@ -744,7 +746,7 @@ IRBB* cg_instrument ( IRBB* bbIn, VexGuestLayout* layout,
// 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)

View File

@ -40,8 +40,8 @@ VgToolInterface VG_(tdict);
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)
)
{

View File

@ -104,8 +104,10 @@ typedef struct {
// 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

View File

@ -2293,8 +2293,10 @@ UCodeBlock* TL_(instrument) ( UCodeBlock* cb_in, Addr not_used )
}
#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

View File

@ -73,6 +73,19 @@ extern const ToolInfo VG_(tool_info);
/* ------------------------------------------------------------------ */
/* 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.
@ -84,9 +97,10 @@ extern void VG_(basic_tool_funcs)(
// 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)().

View File

@ -273,9 +273,11 @@ static void lk_post_clo_init(void)
}
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;

View File

@ -1095,8 +1095,10 @@ static Bool ms_handle_client_request ( ThreadId tid, UWord* argv, UWord* ret )
/*------------------------------------------------------------*/
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 ? */

View File

@ -79,8 +79,10 @@ extern void MC_(helperc_MAKE_STACK_UNINIT) ( Addr base, UWord len );
/* 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 */

View File

@ -2977,8 +2977,10 @@ static Bool checkForBogusLiterals ( /*FLAT*/ IRStmt* st )
}
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;

View File

@ -37,9 +37,11 @@ static void nl_post_clo_init(void)
}
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;
}