Bug 222604

Summary: Add a "stop" frame to suppressions to do exact matches
Product: [Developer tools] valgrind Reporter: leiz
Component: generalAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: wishlist CC: bart.vanassche+kde, timurrrr
Priority: NOR    
Version: 3.6 SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: patch to implement a stop frame
improved patch, don't mess with string_match()
Rename stop to end, add a bit of documentation.

Description leiz 2010-01-13 22:41:59 UTC
Created attachment 39856 [details]
patch to implement a stop frame

I would like to be able to write a suppression that matches:

Memcheck:Leak
fun:foo
fun:bar

but not:

Memcheck:Leak
fun:foo
fun:bar
fun:qux

The proposal is to add a 'stop' frame to indicate when we should stop matching. i.e.

{
   exact_suppression
   Memcheck:Leak
   fun:foo
   fun:bar
   STOP
}

The stop frame would only make sense as the last frame. Attached is an unpolished patch that implements this.
Comment 1 leiz 2010-01-19 20:46:54 UTC
Created attachment 40054 [details]
improved patch, don't mess with string_match()
Comment 2 Julian Seward 2010-02-09 20:42:24 UTC
This is an interesting idea.  If you'd explained the motivation in a
bit more detail, as per http://wiki.winehq.org/Wine_and_Valgrind section
"Additional Patches", it might have gotten looked at sooner :-/

A terminological query.  I'm pretty much regexp-clueless, but I do
know regexps have some symbol which matches the end-of-input.  Is
that generally known as a "stop" symbol?  I ask because I'd prefer
to stick with existing regexp terminology if possible.
Comment 3 Julian Seward 2010-02-21 14:41:57 UTC
Ping?
Comment 4 leiz 2010-02-27 03:54:14 UTC
Created attachment 41154 [details]
Rename stop to end, add a bit of documentation.

Pong. (life got in the way)

I'm also somewhat regexp-clueless. Typically for string matching, $ is the end of line. Maybe "end frame" is a better name?
Comment 5 Bart Van Assche 2010-08-26 12:56:36 UTC
How about replacing the text "STOP" by "end-of-stack:" ?
Comment 6 Timur Iskhodzhanov 2010-08-26 13:31:23 UTC
FYI, Perl multiline-equivalent for "$" is "\z" (for "^" it's "\A")
http://en.wikipedia.org/wiki/Regular_expression_examples

What is the need for the end-of-stack thing?

Recently I was re-writing the suppression mechanism in Dr. Memory (which is a Valgrind analog with Windows and Linux support) and during the review we've decided full-stack matches are not necessary.

My experience of using Valgrind on Chromium shows that
a) stack frames below main or start_thread are platform-specific in the reports
b) frames below something like MessageLoop::ProcessMessage() differ between different runs due to different scheduling