]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
When doing instrumentation, pay attention to the Ist.IMark.delta
authorJulian Seward <jseward@acm.org>
Tue, 8 Nov 2011 19:32:57 +0000 (19:32 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 8 Nov 2011 19:32:57 +0000 (19:32 +0000)
fields.  This makes the --ct-verbose=1 output make a lot more sense
for Thumb code.  Should have no effect on any other platform.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12260

callgrind/main.c

index c44f360fa3f435ef1cf2ebfe9fb32e4cf152bcfc..ac71f52c01d85f21c7f90f876656e022a900da49 100644 (file)
@@ -905,10 +905,9 @@ IRSB* CLG_(instrument)( VgCallbackClosure* closure,
                        VexGuestExtents* vge,
                        IRType gWordTy, IRType hWordTy )
 {
-   Int      i, isize;
+   Int      i;
    IRStmt*  st;
    Addr     origAddr;
-   Addr64   cia; /* address of current insn */
    InstrInfo* curr_inode = NULL;
    ClgState clgs;
    UInt     cJumps = 0;
@@ -944,10 +943,9 @@ IRSB* CLG_(instrument)( VgCallbackClosure* closure,
    st = sbIn->stmts[i];
    CLG_ASSERT(Ist_IMark == st->tag);
 
-   origAddr = (Addr)st->Ist.IMark.addr;
-   cia   = st->Ist.IMark.addr;
-   isize = st->Ist.IMark.len;
-   CLG_ASSERT(origAddr == st->Ist.IMark.addr);  // XXX: check no overflow
+   origAddr = (Addr)st->Ist.IMark.addr + (Addr)st->Ist.IMark.delta;
+   CLG_ASSERT(origAddr == st->Ist.IMark.addr 
+                          + st->Ist.IMark.delta);  // XXX: check no overflow
 
    /* Get BB struct (creating if necessary).
     * JS: The hash table is keyed with orig_addr_noredir -- important!
@@ -977,8 +975,8 @@ IRSB* CLG_(instrument)( VgCallbackClosure* closure,
            break;
 
         case Ist_IMark: {
-            cia   = st->Ist.IMark.addr;
-            isize = st->Ist.IMark.len;
+            Addr64 cia   = st->Ist.IMark.addr + st->Ist.IMark.delta;
+            Int    isize = st->Ist.IMark.len;
             CLG_ASSERT(clgs.instr_offset == (Addr)cia - origAddr);
            // If Vex fails to decode an instruction, the size will be zero.
            // Pretend otherwise.