Index the BB_info table by redirected guest address, not
non-redirected guest address.  This is a small but significant change
needed to make function wrapping work.  The problem is that with
function wrapping two different translations are associated with the
non-redirected address (of a wrapped function entry point), and so
cachegrind asserts.  Whereas the redirected guest addresses reflect
the reality of only one translation associated with each address.  So
use them instead.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5582 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index 7fa516b..75d031f 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -745,8 +745,9 @@
    cia = st->Ist.IMark.addr;
 
    // Set up running state and get block info
+   tl_assert(closure->readdr == vge->base[0]);
    cgs.events_used = 0;
-   cgs.bbInfo      = get_BB_info(bbIn, (Addr)closure->nraddr);
+   cgs.bbInfo      = get_BB_info(bbIn, (Addr)closure->readdr);
    cgs.bbInfo_i    = 0;
 
    if (DEBUG_CG)
@@ -1231,7 +1232,7 @@
 void cg_discard_basic_block_info ( Addr64 orig_addr64, VexGuestExtents vge )
 {
    BB_info* bbInfo;
-   Addr     orig_addr = (Addr)orig_addr64;
+   Addr     orig_addr = (Addr)vge.base[0];
 
    tl_assert(vge.n_used > 0);