From: Jeremy F. <je...@go...> - 2002-10-02 16:24:33
|
On Wed, 2002-10-02 at 04:23, Nicholas Nethercote wrote: Best way I can think of doing it, which only requires skin changes rather than core changes, is this: using the `extended_UCode' need, add a new UInstr PRE_JCC, which gets inserted by SK_(instrument) before conditional JMPs, evaluates the condition, and calls a C function (or whatever) if it's true. This would duplicate the condition evaluation but that shouldn't matter since they're trivial (just checking an EFLAGS bit I think). It's a bit nasty that something as simple as this requires a new UInstr... Well, I've actually come up with a simpler approach. Since what I want is to get the (from, to) pair for a BB graph edge, I'm simply updating a global (bb_from) with %EIP before each jump, and then create/update the edge at the entry to each BB (bb_from, %EIP). At present I'm using a single global, which means that I'll be creating spurious edges when there's context switches between threads. The obvious place to store the information is in the baseBlock, and have it copied to/from the thread state on context switch. I didn't see a mechanism for allocating variable space in the baseBlock, nor a way of conveniently addressing baseBlock offsets directly. Should I add it? Or some other way of storing per-thread information? J |