Bug 273007 - registers messed up (--db-attach=yes related?)
Summary: registers messed up (--db-attach=yes related?)
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-11 08:10 UTC by Pierre Habouzit
Modified: 2012-06-17 11:18 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
zigtest.s (4.73 KB, text/plain)
2011-05-11 08:10 UTC, Pierre Habouzit
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Habouzit 2011-05-11 08:10:10 UTC
Created attachment 59891 [details]
zigtest.s

Here is a cut&paste from a Debian bug (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=576236), which still applies to 3.6.1:

I've attached a .s file from a test program of unclear bugginess, which
we tried to use valgrind to check.  (It had fun and exciting strict
aliasing issues.)  In the course of debugging it, we found an error in
valgrind --db-attach=yes.

Steps to reproduce:

1) gcc zigtest.s -o zigtest
2) valgrind --db-attach=yes ./zigtest
3) When valgrind stops at an uninitialized value warning, say y to
   attach gdb.
4) "p/x $r8", which gave the value 0x30ecb1.
5) End gdb and let valgrind finish.
6) gdb ./zigtest
7) "break *0x0000000000400663"  (the address of the instruction valgrind
   stopped at)
8) "run"
9) "p/x $r8", which gave the value 0xb1.
10) Use "disas" on main to confirm that the instruction right before the
    point valgrind stopped at runs "movzbl %r8b, %r8d", which should
    zero all but the low 8 bits of %r8.  Thus, valgrind's value seems
    wrong.

- Josh Triplett
Comment 1 Philippe Waroquiers 2011-05-14 16:13:56 UTC
(In reply to comment #0)
> 9) "p/x $r8", which gave the value 0xb1.

At least with the last svn version, and the gdbserver,
when launching using:
valgrind --vgdb=full --vex-iropt-precise-memory-exns=yes --vgdb-error=1 ./zigtest

and attaching with gdb using:
gdb ./zigtest
tar rem | vgdb
p /x $r8
$5 = 0xb1
(gdb) 

it gives the good value.
(I suspect --vex-iropt-precise-memory-exns=yes should be sufficient for
--db-attach=yes, but I recommend the use of the new Valgrind gdbserver :).
Comment 2 Pierre Habouzit 2011-05-16 08:24:53 UTC
well svn isn't released yet, but yes I'm planning to package a snapshot at some point ;)
Comment 3 Philippe Waroquiers 2012-06-17 11:18:09 UTC
I understand that the comment 1 is ok as a solution, and that the debian bug has been closed.
So, closing this one (re-open if not ok).
Thanks