Hi,
I've been experimenting with access to registers in instrumentation,
including the newly available rsp/rbp, which is working fine. But what
I'd really like is a way to pass them all as a struct pt_regs* parameter
in a funcCallExpr. (I'm aware that some registers of pt_regs are not
available, which is ok - I'll fill in zeros.)
But I haven't figured out how I can locally allocate such a struct in
the first place. I don't want a fully global allocation, because the
instrumentation needs to be thread safe. I tried accessing a
compiled-in TLS global, but Dyninst couldn't find it. Really, a
stack-allocated struct would be best, but I can't find any way to create
that. Is it possible in the BPatch API?
As a fallback, I'm considering passing all of those register values as
individual parameters, but I'm hoping there's a better way.
Also, while I'm trying to figure out this struct question generically,
it might be neat if Dyninst had specific support for struct pt_regs. An
array of DWARF-numbered registers might work well too. But I expect
either way, Dyninst could save and provide these more efficiently
internally, perhaps as part of the existing state-saving.
Thanks,
Josh
|