Re: [DynInst_API:] Inserting x86 traps before points of interest


Date: Mon, 26 Oct 2015 13:25:04 -0500
From: Bill Williams <bill@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] Inserting x86 traps before points of interest
On 10/26/2015 01:11 PM, Yasser Shalabi wrote:

I need int3 to trigger the hypervisor. I am running in virtualized settings. I want to statically instrument the binary at points of interest to trigger these virtualization exits.


Makes sense, though I have a nagging feeling there may be a better way to do this.

Anyhow. Breakpoint snippets go through our runtime library's platform-independent breakpoint function; what you're seeing makes sense (possibly) if your DYNINSTAPI_RT_LIB environment variable is not set. We should be checking that before we blithely try to insert calls into the RT lib, though...

I know rewriter mode on Linux can generally talk to the RT lib, though, and rewriter mode on Windows is still not working (it's on my ever-expanding TODO list, but it's not there yet). So I would guess it's either platform or environment problems.

--bw

On Mon, Oct 26, 2015, 1:07 PMÂBill Williams <bill@xxxxxxxxxxx> wrote:
On 10/26/2015 01:00 PM, Yasser Shalabi wrote:
> Thanks for the quick reply bill!
>
> When I try:
>
>Â Â Â app->insertSnippet(BPatch_breakPointExpr(), instrumentation_points);
>Â Â Â BPatch_binaryEdit *appBin = dynamic_cast<BPatch_binaryEdit *>(app);
>Â Â Â appBin->writeFile(newName);
>
> I get an assertion failure:
>
> DyninstAPI-9.0.3/dyninstAPI/src/ast.C:2072: virtual bool
> AstCallNode::initRegisters(codeGen&): Assertion `callee' failed.
>
> Any tips on how to approach?
...what function is it trying to insert a call to? (A call stack from
gdb should be sufficient.) And what platform are you on?

In any event, a breakpointexpr may well not do the right thing in
rewriter mode; it's intended for use when Dyninst is serving as a live
debugger for the process. What's the bigger picture? What do you want to
accomplish when these traps are hit?

On Mon, Oct 26, 2015 at 11:11 AM, Bill Williams <bill@xxxxxxxxxxx> wrote:
>> On 10/26/2015 10:33 AM, Yasser Shalabi wrote:
>>
>> I want to insert int3 before points of interest.I have collected these
>> points using Dyninst. Any pointers on which parts of the API to instrument
>> these points with int3 instructions?
>>
>> A BPatch_breakpointExpr should do the trick.
>>
>> Thanks!
>> Yasser
>>
>>
>>
>> _______________________________________________
>> Dyninst-api mailing list
>> Dyninst-api@xxxxxxxxxxx
>> https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
>>
>>


[← Prev in Thread] Current Thread [Next in Thread→]