|
From: Josef W. <Jos...@gm...> - 2012-07-24 08:36:48
|
Am 24.07.2012 01:07, schrieb Philippe Waroquiers: > On Tue, 2012-07-24 at 00:51 +0200, Philippe Waroquiers wrote: >> On Tue, 2012-07-24 at 00:20 +0200, Josef Weidendorfer wrote: >> >>> I assume for amd64, that would be amd64g_calculate_rflags_all(...) >>> (in VEX/priv/guest_amd64_helpers.c). However I am not sure if the VEX >>> registers to use as parameters are fixed (if so, there would be no need >>> to pass them all the time from generated code?). >> Yes, I suppose that cc_op, cc_dep1, cc_dep2, cc_ndep >> have all to be computed by the generated code, depending on what >> instruction has just been executed. >> >> If I understand correctly, Valgrind generated code will compute the >> flags for an instruction only if a following instruction in the >> same block is reading them ? > Looking in valgrind-low-amd64.c:188, I see that V gdbsrv retrieves > the flags to send to GDB using: > rflags = LibVEX_GuestAMD64_get_rflags (amd64); > > which itself calls: > ULong rflags = amd64g_calculate_rflags_all_WRK( > vex_state->guest_CC_OP, > vex_state->guest_CC_DEP1, > vex_state->guest_CC_DEP2, > vex_state->guest_CC_NDEP > ); > > So, if the guest state is up to date, the flags sent to GDB should also > be correct. That means that the guest state is not up-to-date when vgdb is called within a block. Me wondering why this works at all for the other registers. Josef > Not clear to me when the guest_CC_* will be up to date. > Assuming these must/will be correct at the end of a block, > --vex-guest-max-insns=1 will then ensure they are always up to date. > > Philippe > > > > |