|
From: Siddharth N. <si...@gm...> - 2012-03-16 16:09:21
|
I was supposed to reply to this earlier! This method of looking at "CLG_(current_state).jmps_**passed" worked fine, so we can accurately figure out how we got to the current BB from the previous one. On 6 March 2012 18:28, Siddharth Nilakantan <si...@gm...> wrote: > haha, I knew there must be a way. great! So I'm guessing jmpkind at the > end of setup_bbcc() for BB1 should be the same as > CLG_(current_state)->jmp[CLG_(current_state).jmps_passed].jmpkind when > setup_bbcc() is called for the next immediate BB. > > Thanks a lot for your help. I'll use this info and let you know what > happens. > > > On 6 March 2012 17:37, Josef Weidendorfer <Jos...@gm...>wrote: > >> On 06.03.2012 23:01, Siddharth Nilakantan wrote: >> >>> Ohh, so by last, you meant the final exit (non-side exit) is the value >>> of cjmp_count. So there really is no way of determining >>> >> >> There is a way ;-) >> >> >> how we got to >> >>> the current BB from the previous one, as it could have used any of the >>> exits in the jmp[] array. >>> >> >> That is correct. However, setup_bbcc() knows the side exit from last BB: >> Callgrind instruments a write to "CLG_(current_state).jmps_**passed" >> before every side exit. Thus, when setup_bbcc() is called at the >> beginning of the next BB, "CLG_(current_state).jmps_**passed" will >> contain the side exit number. >> >> But you should not use "CLG_(current_state).jmps_**passed" outside of >> setup_bbcc() yourself, as it is reused to find out the side exit number >> of the currently running BB. >> >> The jmp[] array (and the complete BB struct) only stores information >> found at last instrumentation, and thus is static. >> >> >> Is there any point in the code where I can >> >>> capture and store the index of the most recently used exit for a BB or >>> is setup_bbcc's jmpkind the closest I can get to that? >>> >> >> Exactly. As mentioned in my last mail, you can store the "jmpkind" at >> the end of setup_bbcc() into a new field of CLG_(current_state). >> That alwyas should be correct. >> >> Probably, this technique to overwrite a global before every side exit >> to find out the side exit number seems a little dumb to you. But I do >> not see another way, as Valgrind does not allow instrumentation at >> side exits. >> >> Josef >> >> >>> On 6 March 2012 16:26, Josef Weidendorfer <Jos...@gm... >>> <mailto:Josef.Weidendorfer@**gmx.de <Jos...@gm...>>> wrote: >>> >>> On 06.03.2012 21:56, Siddharth Nilakantan wrote: >>> > However, for what should be a call or a return, I see that the >>> > cjmp_count = 0 even after that BB has been exited. >>> >>> Ah, sorry, I was to fast. "cjmp_count" is the number of side >>> exits, which of course can be 0. The length of the BB::jmp[] >>> array is cjmp_count+1. Thus, >>> >>> >>> I quickly migrated my code to valgrind 3.7. I noticed that >>> CLG_(current_state)->bbcc->bb actually points to the BB that is >>> executing currently. You mentioned that "The jumpkind is >>> now stored for every side exit, and for the last, you have to >>> look at >>> "...bb->jmp[...bb->cjmp_count-**__1].jmpkind" ". >>> >>> >>> This must be "...bb->jmp[...bb->cjmp_count]**__.jmpkind" instead. >>> >>> Josef >>> >>> >>> >> > |