Commit 18b9d2e4 authored by Axel Simon's avatar Axel Simon

longer dumps

parent a2bc9454
......@@ -22,11 +22,16 @@ static Lin* translateLin(__obj lin);
static Address* translateAddr(__obj addr);
RReilBB* translate(RReilAddress start, RReilAddress limit) {
RReilBB* translate(RReilAddress& start, RReilAddress limit) {
if (start>=limit) return NULL;
__obj semantics;
__resetHeap();
__word read = __decode(__translateBlock__, (__char*) start, (__word) (limit-start), &semantics);
start += read;
if (read==0) return NULL;
// char buf[2048];
// __pretty(__rreil_pretty_rev__,semantics,buf,sizeof(buf));
// std::cout << "RReil:\n" << buf << std::endl;
return translateRReilBB(semantics);
};
......
......@@ -81,7 +81,7 @@ class Address;
* has been decoded. Translate decoded instructions to RReil and return this semantic block. Returns NULL
* if the address contains an illegal instruction or the limit is reached.
*/
RReilBB* translate(RReilAddress start, RReilAddress limit);
RReilBB* translate(RReilAddress& start, RReilAddress limit);
class RReilBB : public std::vector<Stmt*> {
protected:
......
......@@ -79,12 +79,18 @@ int main(int argc, const char * argv[]) {
std::cout << "Segment containing code not found." << std::endl;
return 1;
}
// std::cout << "text segment is:\n";
// text->dump(std::cout);
// std::cout << std::endl;
uint64_t start = text->getBase();
char* limit;
char* addr = segments.resolve(start, &limit);
//std::cout << "first byte of text segment is " << std::hex << start << ": " << std::hex << (uint8_t) (*addr) << std::dec << std::endl;
RReilBB* b = translate(addr,limit);
if (b!=NULL) std::cout << "basic block:" << std::endl << *b << std::endl;
RReilAddress addr = segments.resolve(start, &limit);
while (true) {
//std::cout << "first byte of text segment is " << std::hex << start << ": " << std::hex << (uint8_t) (*addr) << std::dec << std::endl;
RReilBB* b = translate(addr,limit);
if (b==NULL) break;
std::cout << "basic block:" << std::endl << *b << std::endl;
};
return 0;
}
......@@ -1946,7 +1946,7 @@ val transBlock = do
transInstr;
jmp <- query $foundJump;
ic <- query $ins_count;
if jmp or ic>10 then query $stack else transBlock
if jmp or ic>100 then query $stack else transBlock
end
val translateBlock = do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment