[DynInst_API:] Dyninst limitations for memory trace


Date: Mon, 22 Oct 2012 01:16:13 +0200
From: Pooya Salehi <pxsalehi@xxxxxxxxx>
Subject: [DynInst_API:] Dyninst limitations for memory trace
Hello.

As part of a student job in the University of Munich, I am trying to write a memory trace program using Dyninst that will record every memory reference of a program. Currently we are trying to investigate which frameworks/APIs is more suitable for this task, the three candidates being Dyninst, Pin and DynamoRIO.

I have encountered some problems while using Dyninst for this purpose, I hope someone can help me.

The first problem is, when trying to get the thread id using the BPatch_tidExpr, I get the following error at runtime:

--SERIOUS-- #100: Image: Unable to find function: dyn_pthread_self
[../../dyninstAPI/src/BPatch_snippet.C:1530] - Internal Dyninst error. Found 0 copies of DYNINSTthreadIndex. Expected 1

The other issue is while the examples in the programmer's guide instrument memory access of a single function, I need to recored memory reference of the whole program including external libraries. Currently what I do is first get the list of all the functions and then for each function insert snippets to recored memory references like the examples. The problem is since even for a very small program the number of functions is large, if I use process creation I get the following error:

process.C[1232]: BAD NEWS, process has exited
process.C[1184]: recursion guard
ast.C(1351): writing string value: Success
ast.C(1351): writing string value: Success
.
.
.
ast.C(1351): writing string value: Success
ast.C(1351): writing string value: Success
dyn_memtrace_proc: ../../dyninstAPI/src/addressSpace.C:1307: void trampTrapMappings::writeTrampVariable(const int_variable*, long unsigned int): Assertion `result' failed.
Aborted (core dumped)

so the probe insertion doesn't finish and the instrumentation doesn't begin!!

And if I try to rewrite the program binary on disk, I get the following error:

WARNING: overflow of codeGen structure, trying to enlarge

but this enlargement doesn't happen and and nothing moves forward anymore!!

So my question is, is there a way to instrument memory accesses of a whole (potentially) large program using Dyninst? It seems like since Dyninst doesn't have any JIT-mode and only works in Probe-mode, it cannot manage a large number of probes. But large number of probes in case of memory tracing is inevitable!!

Thanks in advance,
Pooya Salehi
[← Prev in Thread] Current Thread [Next in Thread→]