|
From: Andrew K. <sup...@gm...> - 2017-11-15 21:24:57
|
Here is documented how to do client requests: http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq One thing that I would like to do is mark a range of memory as "uninitialized" so that valgrind can report an error for "conditional move or branch depends on uninitialized memory". For example, in zig we can do something like this: var a: u32 = 1234; // ... a = undefined; // ... if (a > 0) { // should be "conditional move or branch depends on uninitialized memory" } Zig has a "debug safety mode" where we can generate whatever code we want for assigning undefined. At the line `a = undefined` I want to generate code that tells valgrind to mark the memory of `a` as uninitialized. Is this possible? |
|
From: Ivo R. <iv...@iv...> - 2017-11-15 21:37:41
|
2017-11-15 22:24 GMT+01:00 Andrew Kelley <sup...@gm...>: > Here is documented how to do client requests: > > http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq > > One thing that I would like to do is mark a range of memory as > "uninitialized" so that valgrind can report an error for "conditional move > or branch depends on uninitialized memory". ... > Zig has a "debug safety mode" where we can generate whatever code we want > for assigning undefined. > At the line `a = undefined` I want to generate code that tells valgrind to > mark the memory of `a` as uninitialized. > > Is this possible? Oh yes, please have a look here: http://valgrind.org/docs/manual/mc-manual.html#mc-manual.clientreqs In particular VALGRIND_MAKE_MEM_UNDEFINED and VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE. I. |
|
From: Andrew K. <sup...@gm...> - 2017-11-15 21:44:06
|
Perfect! Thanks for the link. On Wed, Nov 15, 2017 at 4:37 PM, Ivo Raisr <iv...@iv...> wrote: > 2017-11-15 22:24 GMT+01:00 Andrew Kelley <sup...@gm...>: > > Here is documented how to do client requests: > > > > http://valgrind.org/docs/manual/manual-core-adv.html# > manual-core-adv.clientreq > > > > One thing that I would like to do is mark a range of memory as > > "uninitialized" so that valgrind can report an error for "conditional > move > > or branch depends on uninitialized memory". > ... > > Zig has a "debug safety mode" where we can generate whatever code we want > > for assigning undefined. > > At the line `a = undefined` I want to generate code that tells valgrind > to > > mark the memory of `a` as uninitialized. > > > > Is this possible? > > Oh yes, please have a look here: > http://valgrind.org/docs/manual/mc-manual.html#mc-manual.clientreqs > In particular VALGRIND_MAKE_MEM_UNDEFINED and > VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE. > > I. > |