From: Nicholas Nethercote Date: Fri, 19 Oct 2018 05:27:07 +0000 (+1100) Subject: Implement VG_(apply_ExeContext)(). X-Git-Tag: VALGRIND_3_15_0~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b689c66d9b7f12852048db0e842560761bbf904;p=thirdparty%2Fvalgrind.git Implement VG_(apply_ExeContext)(). It's been declared for a long time, but was lacking a definition. --- diff --git a/coregrind/m_execontext.c b/coregrind/m_execontext.c index c5c8599069..43516e9772 100644 --- a/coregrind/m_execontext.c +++ b/coregrind/m_execontext.c @@ -225,13 +225,19 @@ void VG_(print_ExeContext_stats) ( Bool with_stacktraces ) ); } - /* Print an ExeContext. */ void VG_(pp_ExeContext) ( ExeContext* ec ) { VG_(pp_StackTrace)( VG_(get_ExeContext_epoch)(ec), ec->ips, ec->n_ips ); } +void VG_(apply_ExeContext)( + void(*action)(UInt n, DiEpoch ep, Addr ip, void* opaque), + void* opaque, ExeContext* ec) +{ + VG_(apply_StackTrace)(action, opaque, VG_(get_ExeContext_epoch)(ec), + ec->ips, ec->n_ips); +} void VG_(archive_ExeContext_in_range) (DiEpoch last_epoch, Addr text_avma, SizeT length ) diff --git a/include/pub_tool_execontext.h b/include/pub_tool_execontext.h index 5dbbb67810..369f2c68b2 100644 --- a/include/pub_tool_execontext.h +++ b/include/pub_tool_execontext.h @@ -80,11 +80,9 @@ ExeContext* VG_(record_depth_1_ExeContext)(ThreadId tid, Word first_ip_delta); // Apply a function to every element in the ExeContext. The parameter 'n' // gives the index of the passed ip. Doesn't go below main() unless // --show-below-main=yes is set. -// Currently, the below function is unused. If ever it is used one day, -// we should add epoch args similarly to function VG_(apply_StackTrace) -// in pub_tool_stacktrace.h. -extern void VG_(apply_ExeContext)( void(*action)(UInt n, Addr ip), - ExeContext* ec, UInt n_ips ); +extern void VG_(apply_ExeContext)( + void(*action)(UInt n, DiEpoch ep, Addr ip, void* opaque), + void* opaque, ExeContext* ec); // Compare two ExeContexts. Number of callers considered depends on `res': // Vg_LowRes: 2