Re: [DynInst_API:] Snippet register get modified by EmitStackAlign


Date: Tue, 20 Jan 2015 11:55:07 -0600
From: Bill Williams <bill@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] Snippet register get modified by EmitStackAlign
On 01/15/2015 08:07 AM, Xi Chen wrote:
Hi,
   I got a situation that Dyninst overwrite register value which
generate in my snippet because of the protection of stack and eflag
register.  Because in the emitStackAlign function (emit-x86.C), it try
to align the stack and rax register is used in the middle. so if the
snippet which put result into $rax, the value will be modified.
   A generated example:
  lea    -0x80(%rsp),%rsp
  push   %rax
  lahf
  seto   %al
  push   %rax
  mov    0x655df0,%rax --> the snippet I added.
  pop    %rax
  add    $0x7f,%al
  sahf
  pop    %rax
  lea    0x80(%rsp),%rsp

I want to ask if there are any API which I can turn off this trampline code?
Thanks in advance.

This is one of the problems with inserting raw assembly snippets; Dyninst's instrumentation contract specifies that instrumentation may not modify the original program in an unspecified way. There are methods available to do this; for instance, you can modify original program variables, or you can modify original registers (in their appropriately saved locations) with registerExprs (though this is obviously not portable, and often not recommended).

Can you tell us a bit about the actual problem you're trying to solve? You're putting in a great deal of effort to try to force Dyninst to do things in a particular way, and there's often an easier way to accomplish a particular goal.


--
Best Regards
X.Chen




_______________________________________________
Dyninst-api mailing list
Dyninst-api@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api



--
--bw

Bill Williams
Paradyn Project
bill@xxxxxxxxxxx
[← Prev in Thread] Current Thread [Next in Thread→]