]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/valgrind/src/valgrind-3.6.0-svn/callgrind/bbcc.c
update
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / callgrind / bbcc.c
index 24862a80caaacbee8ba9fef40a36856f2c4ec05e..ccc850d1cb959f57f9c9e2fab7de56e7e6d38f6f 100644 (file)
@@ -29,7 +29,7 @@
 #include "global.h"
 #include "costs.h"
 
-#include <pub_tool_threadstate.h>
+#include "pub_tool_threadstate.h"
 
 /*------------------------------------------------------------*/
 /*--- BBCC operations                                      ---*/
@@ -693,6 +693,7 @@ void CLG_(setup_bbcc)(BB* bb)
                /* change source for delayed push */
                CLG_(current_state).bbcc = top_ce->jcc->from;
                sp = top_ce->sp;
+               passed = top_ce->jcc->jmp;
                CLG_(pop_call_stack)();
            }
            else {
@@ -741,7 +742,11 @@ void CLG_(setup_bbcc)(BB* bb)
     }
   }
   else {
-    CLG_(unwind_call_stack)(sp, 0);
+    Int unwind_count = CLG_(unwind_call_stack)(sp, 0);
+    if (unwind_count > 0) {
+      /* if unwinding was done, this actually is a return */
+      jmpkind = Ijk_Ret;
+    }
     
     if (jmpkind == Ijk_Call) {
       delayed_push = True;
@@ -836,6 +841,8 @@ void CLG_(setup_bbcc)(BB* bb)
     if (!skip && CLG_(current_state).nonskipped) {
       /* a call from skipped to nonskipped */
       CLG_(current_state).bbcc = CLG_(current_state).nonskipped;
+      /* FIXME: take the real passed count from shadow stack */
+      passed = CLG_(current_state).bbcc->bb->cjmp_count;
     }
     CLG_(push_call_stack)(CLG_(current_state).bbcc, passed,
                         bbcc, sp, skip);