Re: Question regarding 'Conditional jump or move depends on uninitialised value(s)'
Julian Seward <[email protected]> Sun, 16 Jun 2024 10:33:08 +0200
| Newsgroups | gmane.comp.debugging.valgrind |
|---|---|
| Message-ID | <[email protected]> |
> As Nick already suggested, start with --track-origins=yes.
That should be the first thing to try.
> As an alternative (if your build times are short or it's difficult to debug
> the code with gdb) then you can 'instrument' your code with conditions. For
> instance, if you think the variable "widget" is the culprit, then somewhere
> before the reported error add something like
>
> if (widget == 0)
> {
> std::cout << "widget condition true\n";
> }
Agreed; this is useful if --track-origins=yes doesn't help.
A somewhat more general way to force an immediate test is
#include <valgrind/memcheck.h>
...
VALGRIND_CHECK_MEM_IS_DEFINED(pointer, length) or
VALGRIND_CHECK_VALUE_IS_DEFINED(lvalue)
I've found those two to be useful in tracking down difficult errors.
J
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users