Bug 125651

Summary: vex amd64->IR: unhandled instruction bytes: 0xF8 0x49 0xFF 0xE3 (clc)
Product: [Developer tools] valgrind Reporter: neal <nnorwitz>
Component: vexAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 3.1.1   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description neal 2006-04-15 23:02:25 UTC
When running python regression tests on test_ctypes, I get the following error:

test_ctypes
--18638-- DWARF2 CFI reader: unhandled CFI instruction 0:10
--18638-- DWARF2 CFI reader: unhandled CFI instruction 0:10
vex amd64->IR: unhandled instruction bytes: 0xF8 0x49 0xFF 0xE3

To reproduce, build python from source.  I'm using Revision: 45378

http://svn.python.org/projects/python

./configure ; make ; ./python Lib/test/regrtest.py test_ctypes

Sorry, I don't have a minimal test case.  Valgrind works find on all the other
tests if test_ctypes is skipped.

If this is fixed in SVN, I can test a version (or help test/create a patch if
you have suggestions for fixing this).
Comment 1 Tom Hughes 2006-04-25 13:08:24 UTC
This is a clc instruction which the amd64 decoder doesn't handle at the moment (the x86 decoder does).
Comment 2 Julian Seward 2006-05-12 22:16:10 UTC
Fixed (vex r1613).  Please verify.
Comment 3 neal 2006-05-13 06:54:59 UTC
I still get this warning msg:

--28776-- DWARF2 CFI reader: unhandled CFI instruction 0:10
--28776-- DWARF2 CFI reader: unhandled CFI instruction 0:10

However the test no longer crashes V any more.  

The ctypes test which used to crash V, doesn't pass.  Though I'm not sure if that's because of a corner case wrt this instruction or something completely unrelated.

Thanks for fixing.
Comment 4 Julian Seward 2006-05-13 15:33:53 UTC
> The ctypes test which used to crash V, doesn't pass.

Hmm.  Not good.  Do you have any more details on that?
Comment 5 Julian Seward 2006-05-13 15:33:58 UTC
> ------- I still get this warning msg:
> --28776-- DWARF2 CFI reader: unhandled CFI instruction 0:10

This is with which version of the sources?  I believe this is fixed
in the trunk.
Comment 6 neal 2006-05-15 04:20:21 UTC
This was checked out from a clean directory.

neal@janus ~/build/valgrind $ ~/local/bin/valgrind --version
valgrind-3.2.0.SVN


neal@janus ~/build/valgrind $ svn info
Path: .
URL: svn://svn.valgrind.org/valgrind/trunk
Repository UUID: a5019735-40e9-0310-863c-91ae7b9d1cf9
Revision: 5902
Node Kind: directory
Schedule: normal
Last Changed Author: sewardj
Last Changed Rev: 5902
Last Changed Date: 2006-05-12 19:20:11 -0700 (Fri, 12 May 2006)
Properties Last Updated: 2006-05-12 21:26:08 -0700 (Fri, 12 May 2006)


neal@janus ~/build/python/svn/trunk $ svn info
Path: .
URL: svn+ssh://pythondev@svn.python.org/python/trunk
Repository UUID: 6015fed2-1504-0410-9fe1-9d1591cc4771
Revision: 45987
Node Kind: directory
Schedule: normal
Last Changed Author: gerhard.haering
Last Changed Rev: 45987
Last Changed Date: 2006-05-12 16:49:49 -0700 (Fri, 12 May 2006)
Properties Last Updated: 2006-05-12 21:35:43 -0700 (Fri, 12 May 2006)
Comment 7 Julian Seward 2006-05-21 13:58:15 UTC
I looked at this some more.

> --28776-- DWARF2 CFI reader: unhandled CFI instruction 0:10 

This is not a big deal; I'm inclined to ignore it for the time
being.  It will mean that stack unwinding will not work on some
deeply obscure function, but too rare to put effort into fixing.

> The ctypes test which used to crash V, doesn't pass.

I was more concerned about this and went looking for a bug in
Valgrind's amd64 CPU simulation.  It turns out this test causes
Python to generate bits of code on the fly and then run them, 
which fools Valgrind's default assumptions about self-modifying-code.
You can get V to handle this correctly by specifying --smc-check=all
(engage support for unfriendly self-modifying code).  This reduces
V's speed but makes it more robust:

$ vTRUNK -q --tool=none ./python Lib/test/regrtest.py test_ctypes
test test_ctypes failed -- Traceback (most recent call last): [...]

vTRUNK -q --smc-check=all --tool=none ./python Lib/test/regrtest.py test_ctypes
1 test OK.