[Issue 72] valgrind: use of unitialized values in the gcx module

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Mar 24 07:23:39 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=72

Vladimir Panteleev <thecybershadow at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow at gmail.com

--- Comment #8 from Vladimir Panteleev <thecybershadow at gmail.com> ---
(In reply to Brad Roberts from comment #6)
> Two ways to fix it, that I can see:

There is a third way.

We can use the Valgrind client API to tell Valgrind to pretend that the entire
stack is accessible and has well-defined data, using VALGRIND_MAKE_MEM_DEFINED.

By itself, this will hide bugs in user code that accesses uninitialized stack
values. However, that can also be avoided by using VALGRIND_GET_VBITS and
VALGRIND_SET_VBITS to back up and restore the validity state of the stack
before and after a GC scan.

>   1) always initialize empty stack slots -- cost performance

A small performance loss when running under Valgrind is rarely an issue. I
think the main difficulty with this approach is that it might not be possible
to implement, because we have no control over the stack frames of C functions.

--


More information about the Digitalmars-d-bugs mailing list