Translated instruction doesn't get executed

Derrick McKee <[email protected]>
Newsgroups gmane.comp.debugging.valgrind
Message-ID <CAJoBWHwG6HzpR-XMyni6BrM8Wfv_srgO2Gy9Fy4tNqTyi0j=tA@mail.gmail.com>
Hi,

I am writing a new tool that involves calling a tool function at every
instruction.  However, there appears to be one instruction that never
gets executed, and I cannot figure out why.  The (partial)
instrumented IRSB is as follows:

------ IMark(0x112E42, 5, 0) ------
   DIRTY 1:I1 RdFX-gst(0,928) ::: record_current_state{0x58001ce0}(0x112E42:I64)
   t68 = Sub64(t2,0x8:I64)
   PUT(48) = t68
   STle(t68) = 0x112E47:I64
   t70 = Sub64(t68,0x80:I64)
   ====== AbiHint(t70, 128, 0x124A10:I64) ======
   ------ IMark(0x124A10, 1, 0) ------
   DIRTY 1:I1 RdFX-gst(0,928) ::: record_current_state{0x58001ce0}(0x124A10:I64)
   t79 = Sub64(t68,0x8:I64)
   PUT(48) = t79
   STle(t79) = t22
   PUT(184) = 0x124A11:I64
   ------ IMark(0x124A11, 3, 0) ------
   DIRTY 1:I1 RdFX-gst(0,928) ::: record_current_state{0x58001ce0}(0x124A11:I64)
   PUT(56) = t79
   PUT(184) = 0x124A14:I64
   ------ IMark(0x124A14, 4, 0) ------
   DIRTY 1:I1 RdFX-gst(0,928) ::: record_current_state{0x58001ce0}(0x124A14:I64)
   t82 = Add64(t79,0xFFFFFFFFFFFFFFF8:I64)
   STle(t82) = t64
   PUT(184) = 0x124A18:I64

The instruction that doesn't get executed is 0x124A10.  There are two
reasons I say the instruction is not executed.  First, I am printing
out the guest IP in record_current_state() and 0x124A10 is never
printed.  Second, I get a segfault at instruction 0x124A14, which
dereferences a stack location.  I have checked read/write permissions
of the location referenced in the STle IRStmt, and sure enough the
location is not valid for the guest.  This leads me to believe that
the t79=Sub64(t68, 0x8) isn't happening, because that should update
the memory permissions.

Interestingly, instruction 0x112E42 seemingly gets executed twice,
according to my instrumentation output:

==273360== Recording state for 0x112e42 (quote_name_buf)
==273360== Recording state for 0x112e42 (quote_name_buf)
==273360== Recording state for 0x124a11 (get_quoting_style)

-- 
Derrick McKee
Phone: (703) 957-9362
Email: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.