|
From: Josef W. <Jos...@gm...> - 2016-08-02 10:12:57
|
Am 29.07.2016 um 13:03 schrieb Patrick Bos:
>> I can search for the patch and send it to you.
>
> If it's not too much trouble, that would be wonderful! Looking forward to receiving it. I'm not too concerned about scaling, so anything you have would be great.
Attached. It should apply to current SVN version (probably also last VG
release).
Note that this patch only uses "Int v = sp[sep->parnum];" (search for it
in the patch)
to access the parnum'th (4-byte) integer parameter of a function, with
sp being the
stack pointer at function entry.
This only works with x86 (32bit). Look up the C ABI calling conventions
to see how to
get at parameters for amd64. amd64 uses registers to pass 1st 6 integer
values.
Register values can be found in the architecture state struct
"ThreadArchState arch",
which can be accessed via "VG_(threads)[tid].arch" in tool functions,
tid is the
current thread ID. For example, for amd64 and register RDI, which holds
the first
integer parameter (I would assume this to map to the "this" pointer with
C++), this
should be
VG_(threads)[tid].arch.vex.guest_RDI
This should make it very easy to accomplish what you want.
Cheers,
Josef
|