|
From: Josef W. <Jos...@gm...> - 2003-03-21 15:40:52
|
On Friday 21 March 2003 10:42, Nicholas Nethercote wrote:
> I've been thinking about Josef's suggestion about letting the skin decide
> if it wants to use __libc_malloc() or Valgrind's malloc(), and whether to
> wrap them. I think it could be done, although I haven't got around to
> trying it yet. This {mem,str,strn}cpy() checking could be done
> similarly... Memcheck and Addrcheck would use Valgrind's provided
> versions, using a wrapper that checks the args don't overlap, and other
> skins could use the libc versions. Ah, except it seems that glibc doesn't
> define __libc_memcpy the way it does __libc_malloc, which could make
> things tricky.
Hmm...
Doesn't GCC use it's own inline-version of memcpy when optimization is on?
An alternative solution for function wrapping would be not to use the runtime
linker (symbol overwriding, hack with __libc_malloc), but to change
instrumentation of the first BB of the given function, and do a "jmp" into
the valgrind wrapper version if the skin would like to use it.
This avoids the static behaviour of symbol definitions in shared libraries,
and can even be done by valgrind core before calling the instrumentation
function of the skin. Still, in the case of wrapping, the instrumentation
function of the skin should get the replaced jump for further
instrumentation.
> Still, this whole question of "do I use the normal version or Valgrind's
> version of function x()" is worth investigation, and I hope to look into
> it more soon.
In my latest calltree version, I introduced an infrastruction to specify
instrumentation parameters on the basis of a function symbol name.
This would be a good addition to valgrind core, and would come handy
with the above wrapping (wrapper function as parameter dependent on symbol
name).
As the lookup for instrumentation parameters has to be done on instrumentation
of every basic block, this has to be fast. I use a prefix tree for lookup.
This even allows to only specify symbol prefixes, i.e. a star wildcard at the
end.
E.g. say you have set
- parameter A=0 for symbol "foo1",
- parameter A=1 for symbol "foo1bar",
- parameter A=2 for symbol "foo2",
- parameter A=3 for symbol "foo*".
The prefix search tree looks like this:
"foo"
+-- "*": A=3
+-- "1": A=0
+-- "bar": A=1
+-- "2": A=2
e.g. if you have symbol "foobar", it goes down the tree and stops with A=3.
Does it make sense to merge this in some way with the error suppression stuff?
Josef
PS: Nick, could you send me the scripts for the SPEC2000 benchmarks?
I would like to check it with my skin.
>
> N
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
|