On Tue, 2018-11-20 at 10:35 +0100, Ivo Raisr wrote: > Il giorno lun 19 nov 2018 alle ore 16:53 David Faure <fa...@kde.org> ha > scritto: > > > > When using vgdb (e.g. `valgrind --vgdb-error=0 myprog`) > > and there's a valgrind warning for an uninitialized read, on a line like > > if (a || b) > > > > The question that happens then is, of course, was it a or b that was > > uninitialized. If one uses vgdb to print the values of a and b, it won't > > necessarily be obvious (e.g. two bools, both happen to show as "false", with > > only one actually uninitialized). This makes me wonder, wouldn't it be > > possible for vgdb to output a warning when doing "print a" or "print b" from > > gdb and the value is marked as uninitialized? > > > > If I understand the architecture correctly, this should be possible to > > implement, right? > > I do not want to estimate how feasible would be to implement this feature. > Patches are welcome, of course. > > But you can use an existing feature: > http://valgrind.org/docs/manual/mc-manual.html#mc-manual.machine > http://valgrind.org/docs/manual/mc-manual.html#mc-manual.monitor-commands > > This will give you what (I think) you want. Yes, using e.g. the monitor command xb allows to look at the V bits: you need to know the address (and len) of the value you want to look at. If a value is in a register, then you have to print the shadow register.
For what concerns automatically printing warnings when GDB prints a 'non initialised' value: I think this is not very easy, and will likely give many false positives : the valgrind gdbserver has no idea why GDB asks to read some memory and/or asks to read the registers. In particular, GDB will very likely often read all the registers (including the one having uninitialised values). The GDB protocol also does not allow to read individual bits, and so, when a part of a byte is not initialised (but correctly so, i.e. not used by the program), printing the variable will give a warning. So, in summary, would be a nice thing to do, but I see no way to do it properly. Philippe _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users