Question

I'm using the DyninstAPI (namely, the SymtabAPI component) to rewrite the symbol tables in binaries. I'm using the following methods to do so:

data_region->setPtrToRawData((void*) new_raw, data_region->getRegionSize())

The method returns successfully, I check my error codes, and I even re-read the data section which has successfully been replaced. The problem is that the original binary isn't rewritten with the new raw .data section, and the original raw .data section persists.

I've scoured the manual to see if there is some sort of commit function but none is documented and nothing of the sort is mentioned in the examples. EDIT: I just read through some of the source code for the Region class, and it looks like I'm essentially doing what patchData does (in case that is the method I should be using).

Suggestions?

The programming manuals are available at http://www.paradyn.org/html/manuals.html.

P.S. hopefully a more reputable user can add the tags DyninstAPI and SymtabAPI for me.

Was it helpful?

Solution

After consulting with the developers, they alerted me that the function I needed to call was emit and the syntax I ended up using was:

symtab_obj->emit("new_binary.out");

Thanks Drew!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top