ftmemsim-valgrind/coregrind/pub_core_seqmatch.h
Julian Seward 09dac86eca Add a new module, m_seqmatch, which does very simple sequence (regexp)
matching, in the function VG_(generic_match).  Patterns to be matched
against may contain only '*'-style wildcards (matches any number of
elements, we don't care what they are), '?' wildcards (matches exactly
one element, we don't care what it is) and literal elements.

It is totally abstractified, in the sense that the pattern and input
arrays may be arrays of anything.  The caller provides enough
information so that VG_(generic_match) can step along both arrays, and
can ask the questions "is this pattern element a '*' ?", "is this
pattern element a '?' ?", and "does this pattern element match an
input element ?".

The existing function VG_(string_match) is reimplemented using
VG_(generic_match), although the ability to escape metacharacters in
the pattern string is removed -- I don't think it was ever used.

In m_errormgr, matching of suppression stacks (including wildcard
"..." lines) against error stacks is re-implemented using
VG_(generic_match).

Further detailed comments are in m_seqmatch.h and pub_tool_seqmatch.h.

A negative side effect is that VG_(string_match) will be much slower
than before, due to the abstractification.  It may be necessary to
reimplement a specialised version later.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8816
2008-12-12 08:07:49 +00:00

52 lines
2.0 KiB
C

/*--------------------------------------------------------------------*/
/*--- A simple sequence matching facility. ---*/
/*--- pub_core_seqmatch.h ---*/
/*--------------------------------------------------------------------*/
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
Copyright (C) 2008-2008 OpenWorks Ltd
info@open-works.co.uk
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA.
The GNU General Public License is contained in the file COPYING.
*/
#ifndef __PUB_CORE_SEQMATCH_H
#define __PUB_CORE_SEQMATCH_H
//--------------------------------------------------------------------
// PURPOSE: Provides a simple generic sequence matching facility, with
// '*' and '?' style wildcards. Also provides a parameterisation
// thereof suitable for matching strings. See pub_tool_seqmatch.h
// for details.
//--------------------------------------------------------------------
// No core-only exports; everything in this module is visible to both
// the core and tools.
#include "pub_tool_seqmatch.h"
#endif // __PUB_CORE_SEQMATCH_H
/*--------------------------------------------------------------------*/
/*--- end pub_core_seqmatch.h ---*/
/*--------------------------------------------------------------------*/