From: Nicholas Nethercote Date: Fri, 26 Nov 2004 11:30:14 +0000 (+0000) Subject: Reinstated Helgrind and Cachegrind; at least, they are included in X-Git-Tag: svn/VALGRIND_3_0_0~1211 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9171a07599c10001d20bf5b9b56ff6ea25b07233;p=thirdparty%2Fvalgrind.git Reinstated Helgrind and Cachegrind; at least, they are included in compilation now. They both don't work, as I made the minimal changes necessary to get them compiling (eg. both of the TL_(instrument)() functions were commented out and replaced with a stub). This means that 'make dist' should more or less work again, which is necessary for my playing with the XML documentation. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3107 --- diff --git a/Makefile.am b/Makefile.am index 9f95c7bd61..74f35a9637 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,19 +5,12 @@ include $(top_srcdir)/Makefile.all.am ## include must be first for tool.h ## addrcheck must come after memcheck, for mac_*.o -#SUBDIRS = include coregrind . docs tests auxprogs \ -# memcheck \ -# addrcheck \ -# cachegrind \ -# corecheck \ -# helgrind \ -# massif \ -# lackey \ -# none SUBDIRS = include coregrind . docs tests auxprogs \ memcheck \ addrcheck \ + cachegrind \ corecheck \ + helgrind \ massif \ lackey \ none diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index 1a028be8e5..90cf31e1ed 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -350,6 +350,7 @@ void log_1I_2D_cache_access(instr_info* n, Addr data_addr1, Addr data_addr2) /*--- Instrumentation ---*/ /*------------------------------------------------------------*/ +#if 0 static BB_info* get_BB_info(UCodeBlock* cb_in, Addr orig_addr, Bool* bb_seen_before) { @@ -384,6 +385,7 @@ BB_info* get_BB_info(UCodeBlock* cb_in, Addr orig_addr, Bool* bb_seen_before) } return bb_info; } +#endif static void do_details( instr_info* n, Bool bb_seen_before, @@ -411,6 +413,7 @@ static Bool is_valid_data_size(Int data_size) 8 == data_size || 10 == data_size || MIN_LINE_SIZE == data_size); } +#if 0 // Instrumentation for the end of each x86 instruction. static void end_of_x86_instr(UCodeBlock* cb, instr_info* i_node, Bool bb_seen_before, @@ -490,7 +493,9 @@ void end_of_x86_instr(UCodeBlock* cb, instr_info* i_node, Bool bb_seen_before, uCCall(cb, helper, argc, argc, False); } +#endif +#if 0 UCodeBlock* TL_(instrument)(UCodeBlock* cb_in, Addr orig_addr) { UCodeBlock* cb; @@ -654,6 +659,13 @@ UCodeBlock* TL_(instrument)(UCodeBlock* cb_in, Addr orig_addr) #undef INVALID_DATA_SIZE } +#endif + +IRBB* TL_(instrument) ( IRBB* bb_in, VexGuestLayout* layout, IRType hWordTy ) +{ + VG_(message)(Vg_DebugMsg, "Cachegrind is not yet ready to handle Vex IR"); + VG_(exit)(1); +} /*------------------------------------------------------------*/ /*--- Cache configuration ---*/ @@ -1124,11 +1136,6 @@ void TL_(pre_clo_init)(void) VG_(needs_basic_block_discards)(); VG_(needs_command_line_options)(); - VG_(register_compact_helper)((Addr) & log_1I_0D_cache_access); - VG_(register_compact_helper)((Addr) & log_1I_1Dr_cache_access); - VG_(register_compact_helper)((Addr) & log_1I_1Dw_cache_access); - VG_(register_compact_helper)((Addr) & log_1I_2D_cache_access); - /* Get working directory */ tl_assert( VG_(getcwd_alloc)(&base_dir) ); diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index fb2738eecc..2b6175bd03 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -576,9 +576,16 @@ static __inline__ void init_nonvirgin_sword(Addr a) { shadow_word sword; - ThreadId tid = VG_(get_current_or_recent_tid)(); + ThreadId tid; ThreadLifeSeg *tls; + // The tid must be passed in here now; this requires more events to be + // given the tid in the first place. + // + //tid = VG_(get_current_or_recent_tid)(); + VG_(message)(Vg_DebugMsg, "tid needs to be passed in here"); + VG_(exit)(1); + tl_assert(tid != VG_INVALID_THREADID); tls = thread_seg[tid]; @@ -1825,7 +1832,8 @@ static void add_HG_Chunk ( ThreadId tid, Addr p, SizeT size ) /* Allocate memory and note change in memory available */ static __inline__ -void* alloc_and_new_mem ( SizeT size, SizeT alignment, Bool is_zeroed ) +void* alloc_and_new_mem ( ThreadId tid, SizeT size, SizeT alignment, + Bool is_zeroed ) { Addr p; @@ -1836,35 +1844,35 @@ void* alloc_and_new_mem ( SizeT size, SizeT alignment, Bool is_zeroed ) return NULL; } if (is_zeroed) VG_(memset)((void*)p, 0, size); - add_HG_Chunk ( VG_(get_current_or_recent_tid)(), p, size ); + add_HG_Chunk ( tid, p, size ); eraser_new_mem_heap( p, size, is_zeroed ); return (void*)p; } -void* TL_(malloc) ( SizeT n ) +void* TL_(malloc) ( ThreadId tid, SizeT n ) { - return alloc_and_new_mem ( n, VG_(clo_alignment), /*is_zeroed*/False ); + return alloc_and_new_mem ( tid, n, VG_(clo_alignment), /*is_zeroed*/False ); } -void* TL_(__builtin_new) ( SizeT n ) +void* TL_(__builtin_new) ( ThreadId tid, SizeT n ) { - return alloc_and_new_mem ( n, VG_(clo_alignment), /*is_zeroed*/False ); + return alloc_and_new_mem ( tid, n, VG_(clo_alignment), /*is_zeroed*/False ); } -void* TL_(__builtin_vec_new) ( SizeT n ) +void* TL_(__builtin_vec_new) ( ThreadId tid, SizeT n ) { - return alloc_and_new_mem ( n, VG_(clo_alignment), /*is_zeroed*/False ); + return alloc_and_new_mem ( tid, n, VG_(clo_alignment), /*is_zeroed*/False ); } -void* TL_(memalign) ( SizeT align, SizeT n ) +void* TL_(memalign) ( ThreadId tid, SizeT align, SizeT n ) { - return alloc_and_new_mem ( n, align, /*is_zeroed*/False ); + return alloc_and_new_mem ( tid, n, align, /*is_zeroed*/False ); } -void* TL_(calloc) ( SizeT nmemb, SizeT size ) +void* TL_(calloc) ( ThreadId tid, SizeT nmemb, SizeT size ) { - return alloc_and_new_mem ( nmemb*size, VG_(clo_alignment), + return alloc_and_new_mem ( tid, nmemb*size, VG_(clo_alignment), /*is_zeroed*/True ); } @@ -1915,7 +1923,7 @@ void die_and_free_mem ( ThreadId tid, HG_Chunk* hc, static __inline__ -void handle_free ( void* p ) +void handle_free ( ThreadId tid, void* p ) { HG_Chunk* hc; HG_Chunk** prev_chunks_next_ptr; @@ -1925,31 +1933,29 @@ void handle_free ( void* p ) if (hc == NULL) { return; } - die_and_free_mem ( VG_(get_current_or_recent_tid)(), - hc, prev_chunks_next_ptr ); + die_and_free_mem ( tid, hc, prev_chunks_next_ptr ); } -void TL_(free) ( void* p ) +void TL_(free) ( ThreadId tid, void* p ) { - handle_free(p); + handle_free(tid, p); } -void TL_(__builtin_delete) ( void* p ) +void TL_(__builtin_delete) ( ThreadId tid, void* p ) { - handle_free(p); + handle_free(tid, p); } -void TL_(__builtin_vec_delete) ( void* p ) +void TL_(__builtin_vec_delete) ( ThreadId tid, void* p ) { - handle_free(p); + handle_free(tid, p); } -void* TL_(realloc) ( void* p, SizeT new_size ) +void* TL_(realloc) ( ThreadId tid, void* p, SizeT new_size ) { HG_Chunk *hc; HG_Chunk **prev_chunks_next_ptr; Int i; - ThreadId tid = VG_(get_current_or_recent_tid)(); /* First try and find the block. */ hc = (HG_Chunk*)VG_(HT_get_node) ( hg_malloc_list, (UWord)p, @@ -2028,6 +2034,7 @@ Bool TL_(expensive_sanity_check)(void) static UInt stk_ld, nonstk_ld, stk_st, nonstk_st; +#if 0 /* Create and return an instrumented version of cb_in. Free cb_in before returning. */ UCodeBlock* TL_(instrument) ( UCodeBlock* cb_in, Addr not_used ) @@ -2267,7 +2274,12 @@ UCodeBlock* TL_(instrument) ( UCodeBlock* cb_in, Addr not_used ) VG_(free_UCodeBlock)(cb_in); return cb; } - +#endif +IRBB* TL_(instrument) ( IRBB* bb_in, VexGuestLayout* layout, IRType hWordTy ) +{ + VG_(message)(Vg_DebugMsg, "Helgrind is not yet ready to handle Vex IR"); + VG_(exit)(1); +} /*--------------------------------------------------------------------*/ /*--- Error and suppression handling ---*/ @@ -3309,20 +3321,7 @@ void TL_(pre_clo_init)(void) VG_(init_post_mutex_lock) (& eraser_post_mutex_lock); VG_(init_post_mutex_unlock) (& eraser_post_mutex_unlock); - VG_(register_compact_helper)((Addr) & eraser_mem_help_read_1); - VG_(register_compact_helper)((Addr) & eraser_mem_help_read_2); - VG_(register_compact_helper)((Addr) & eraser_mem_help_read_4); - VG_(register_noncompact_helper)((Addr) & eraser_mem_help_read_N); - - VG_(register_compact_helper)((Addr) & eraser_mem_help_write_1); - VG_(register_compact_helper)((Addr) & eraser_mem_help_write_2); - VG_(register_compact_helper)((Addr) & eraser_mem_help_write_4); - VG_(register_noncompact_helper)((Addr) & eraser_mem_help_write_N); - - VG_(register_noncompact_helper)((Addr) & bus_lock); - VG_(register_noncompact_helper)((Addr) & bus_unlock); - - for(i = 0; i < LOCKSET_HASH_SZ; i++) + for (i = 0; i < LOCKSET_HASH_SZ; i++) lockset_hash[i] = NULL; empty = alloc_LockSet(0);