mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 10:21:20 +00:00
This implements the interception of all globally public allocation functions by default. It works by adding a flag to the spec to say the interception only applies to global functions. Which is set for the somalloc spec. The librarypath to match is set to "*" unless the user overrides it. Then each DiSym keeps track of whether the symbol is local or global. For a spec which has isGlobal set only isGlobal symbols will match. Note that because of padding to keep the addresses in DiSym aligned the addition of the extra bool isGlobal doesn't actually grow the struct. The comments explain how the struct could be made more compact on 32bit systems, but this isn't as easy on 64bit systems. So I didn't try to do that in this patch. For ELF symbols keeping track of which are global is trivial. For pdb I had to guess and made only the "Public" symbols global. I don't know how/if macho keeps track of global symbols or not. For now I just mark all of them local (which just means things work as previously on platforms that use machos, no non-system symbols are matches by default for somalloc unless the user explicitly tells which library name to match). Included are two testcases for shared libraries (wrapmalloc) and staticly linked (wrapmallocstatic) malloc/free overrides that depend on the new default. One existing testcase (new_override) was adjusted to explicitly not use the new somalloc default because it depends on a user defined new implementation that has side-effects and should explicitly not be intercepted. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15726
On 4 Apr 06, the debuginfo reader (m_debuginfo) was majorly cleaned up
and restructured. It has been a bit of a tangle for a while. On 18 Sep 14
the STABS support was completely removed. The new structure looks like this:
debuginfo.c
readelf.c
readdwarf.c
storage.c
Each .c can only call those below it on the page.
storage.c contains the SegInfo structure and stuff for
maintaining/searching arrays of symbols, line-numbers, and Dwarf CF
info records.
readdwarf.c parses the relevant kind of info and call storage.c to
store the results.
readelf.c reads ELF format, hands syms directly to storage.c,
then delegates to readdwarf.c for debug info. All straightforward.
debuginfo.c is the top-level file, and is quite small.
There are 2 goals to this:
(1) Generally tidy up something which needs tidying up
(2) Introduce more modularity, so as to make it easier to add
readers for other formats, if needed
Rationale for (1) and (2) are obvious.
Originally there was also goal (3) Simplify the stabs reader.
But stabs support was broken since 3.9.0 and completely removed in 3.10.0.
The worst thing is that it is the stabs type reader that was crashing,
not the stabs line-number reader.
Old versions of the stabs type reader can be found in the subversion repository
as m_debuginfo/UNUSED_STABS.txt, the stabs line-number reader was in
m_debuginfo/readstabs.c. The old version of this file explained more
about the setup.