mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 10:05:29 +00:00
showing inlined function calls. See 278972 valgrind stacktraces and suppression do not handle inlined function call debuginfo Reading the inlined dwarf call info is activated using the new clo --read-inline-info=yes Default is currently no but an objective is to optimise the performance and memory in order to possibly set it on by default. (see below discussion about performances). Basically, the patch provides the following pieces: 1. Implement a new dwarf3 reader that reads the inlined call info 2. Some performance improvements done for this new parser, and on some common code between the new parser and the var info parser. 3. Use the parsed inlined info to produce stacktrace showing inlined calls 4. Use the parsed inlined info in the suppression matching and suppression generation 5. and of course, some reg tests 1. new dwarf3 reader: --------------------- Two options were possible: add the reading of the inlined info in the current var info dwarf reader, or add a 2nd reader. The 2nd approach was preferred, for the following reasons: The var info reader is slow, memory hungry and quite complex. Having a separate parsing phase for the inlined information is simpler/faster when just reading the inlined info. Possibly, a single parser would be faster when using both --read-var-info=yes and --read-inline-info=yes. However, var-info being extremely memory/cpu hungry, it is unlikely to be used often, and having a separate parsing for inlined info does in any case make not much difference. (--read-var-info=yes is also now less interesting thanks to commit r13991, which provides a fast and low memory "reasonable" location for an address). The inlined info parser reads the dwarf info to make calls to priv_storage.h ML_(addInlInfo). 2. performance optimisations ---------------------------- * the abbrev cache has been improved in revision r14035. * The new parser skips the non interesting DIEs (the var-info parser has no logic to skip uninteresting DIEs). * Some other minor perf optimisation here and there. In total now, on a big executable, 15 seconds CPU are needed to create the inlined info (on my slow x86 pentium). With regards to memory, the dinfo arena: with inlined info: 172281856/121085952 max/curr mmap'd without : 157892608/106721280 max/curr mmap'd, So, basically, inlined information costs about 15Mb of memory for my big executable (compared to first version of the patch, this is already using less memory, thanks to the strpool deduppoolalloc. The needed memory can probably be decreased somewhat more. 3. produce better stack traces ------------------------------ VG_(describe_IP) has a new argument InlIPCursor *iipc which allows to describe inlined function calls by doing repetitive calls to describe_IP. See pub_tool_debuginfo.h for a description. 4. suppression generation and matching -------------------------------------- * suppression generation now also uses an InlIPCursor *iipc to generate a line for each inlined fn call. * suppression matching: to allow suppression matching to match one IP to several function calls in a suppression entry, the 'inputCompleter' object (that allows to lazily generate function or object names for a stacktrace when matching an error with a suppression) has been generalised a little bit more to also lazily generate the input sequence. VG_(generic_match) has been updated so as to be more generic with respect to the input completer : when providing an input completer, VG_(generic_match) does not need anymore to produce/compute any input itself : this is all delegated to the input completer. 5. various regtests ------------------- to test stack traces with inlined calls, and suppressions of (some of) these errors using inlined fn calls matching. Work still to do: ----------------- * improve parsing performance * improve the memory overhead. * handling the directory name for files of the inlined function calls is not yet done. (probably implies to refactor some code) * see if m_errormgr.c *offsets arrays cannot be managed via xarray git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14036
108 lines
4.5 KiB
C
108 lines
4.5 KiB
C
|
|
/*--------------------------------------------------------------------*/
|
|
/*--- A simple sequence matching facility. ---*/
|
|
/*--- pub_tool_seqmatch.h ---*/
|
|
/*--------------------------------------------------------------------*/
|
|
|
|
/*
|
|
This file is part of Valgrind, a dynamic binary instrumentation
|
|
framework.
|
|
|
|
Copyright (C) 2008-2013 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_TOOL_SEQMATCH_H
|
|
#define __PUB_TOOL_SEQMATCH_H
|
|
|
|
#include "pub_tool_basics.h" // UWord
|
|
|
|
/* Perform totally abstractified sequence matching, of an input
|
|
sequence against a pattern sequence. The pattern sequence may
|
|
include '*' elements (matches any number of anything) and '?'
|
|
elements (matches exactly one element). '*' patterns are matched
|
|
frugally, meaning that they are "assigned" the minimum amount of
|
|
input needed to make the match work.
|
|
|
|
This routine is recursive. The recursion depth is equal to the
|
|
number of '*' elements in the pattern. There is no guard against
|
|
excessive recursion. This function has no global state and so is
|
|
thread-safe and re-entrant. (It needs to be, since m_errormgr will
|
|
effectively construct two simultaneous calls to it, once to match
|
|
at the frame level, and whilst that is happening, once at the
|
|
function/object-name level.)
|
|
|
|
When matchAll is True, the entire input sequence must match the
|
|
pattern, else the match fails. When False, it's ok for some tail
|
|
of the input sequence to be unused -- so we're only matching a
|
|
prefix.
|
|
|
|
The pattern array is starts at 'patt' and consists of 'nPatt'
|
|
elements each of size 'szbPatt'. For the initial call, pass a
|
|
value of zero to 'ixPatt'.
|
|
|
|
The input sequence can be similarly described using
|
|
input/nInput/szbInput/ixInput.
|
|
Alternatively, the input can be lazily constructed using an
|
|
inputCompleter. When using an inputCompleter, input/nInput/szbInput
|
|
are unused.
|
|
|
|
pIsStar should return True iff the pointed-to pattern element is
|
|
conceptually a '*'.
|
|
|
|
pIsQuery should return True iff the pointed-to-pattern element is
|
|
conceptually a '?'.
|
|
|
|
pattEQinp takes a pointer to a pattern element and a pointer to an
|
|
input element. It should return True iff they are considered
|
|
equal. Note that the pattern element is guaranteed to be neither
|
|
(conceptually) '*' nor '?', so it must be a literal (in the sense
|
|
that all the input sequence elements are literal).
|
|
|
|
If inputCompleter is not NULL, the input will be lazily constructed
|
|
when pattEQinp is called.
|
|
For lazily constructing the input element, the two last arguments
|
|
of pattEQinp are the inputCompleter and the index of the input
|
|
element to complete.
|
|
VG_(generic_match) calls (*haveInputInpC)(inputCompleter,ixInput) to
|
|
check if there is an element ixInput in the input sequence.
|
|
*/
|
|
Bool VG_(generic_match) (
|
|
Bool matchAll,
|
|
const void* patt, SizeT szbPatt, UWord nPatt, UWord ixPatt,
|
|
const void* input, SizeT szbInput, UWord nInput, UWord ixInput,
|
|
Bool (*pIsStar)(const void*),
|
|
Bool (*pIsQuery)(const void*),
|
|
Bool (*pattEQinp)(const void*,const void*,void*,UWord),
|
|
void* inputCompleter,
|
|
Bool (*haveInputInpC)(void*,UWord)
|
|
);
|
|
|
|
/* Mini-regexp function. Searches for 'pat' in 'str'. Supports
|
|
meta-symbols '*' and '?'. There is no way to escape meta-symbols
|
|
in the pattern. */
|
|
Bool VG_(string_match) ( const HChar* pat, const HChar* str );
|
|
|
|
#endif // __PUB_TOOL_SEQMATCH_H
|
|
|
|
/*--------------------------------------------------------------------*/
|
|
/*--- end pub_tool_seqmatch.h ---*/
|
|
/*--------------------------------------------------------------------*/
|