]>
git.siccegge.de Git - frida/frida.git/blob - src/core/InformationManager.cxx
1 #include "InformationManager.hxx"
2 #include "disassembler/llvm/LLVMDisassembler.hxx"
4 #include "quazip/quazip.h"
5 #include "quazip/quazipfile.h"
7 void InformationManager::reset(const std::string
& filename
) {
8 disassembler
.reset(createLLVMDisassembler(filename
, this));
9 if (disassembler
.get() != NULL
)
10 disassembler
.get()->start();
13 void InformationManager::save(const QString
& filename
) {
15 zip
.open(QuaZip::mdCreate
);
16 zip
.setComment("FRIDA 0.0");
17 QuaZipFile
outZipFile(&zip
);
19 for (Function
* fun
: functions
) {
20 QuaZipNewInfo
zipinfo(fun
->getName().c_str());
21 zipinfo
.setPermissions(static_cast<QFile::Permissions
>(0x6444));
22 outZipFile
.open(QIODevice::WriteOnly
, zipinfo
);
23 QXmlStreamWriter
stream(&outZipFile
);
24 stream
.setAutoFormatting(true);
25 stream
.setAutoFormattingIndent(-1);
26 stream
.writeStartDocument();
27 stream
.writeStartElement("function");
28 stream
.writeAttribute("name", fun
->getName().c_str());
29 stream
.writeAttribute("entry", QString::number(fun
->getStartAddress(), 16));
31 for (auto& blockentry
: fun
->blocks()) {
32 stream
.writeStartElement("block");
33 stream
.writeAttribute("id", blockentry
.second
->getName().c_str());
34 stream
.writeTextElement("start", QString::number(blockentry
.second
->getStartAddress(), 16));
35 stream
.writeTextElement("end", QString::number(blockentry
.second
->getEndAddress(), 16));
36 if (0 != blockentry
.second
->getNextBlock(0))
37 stream
.writeTextElement("next", QString::number(blockentry
.second
->getNextBlock(0), 16));
38 if (0 != blockentry
.second
->getNextBlock(1))
39 stream
.writeTextElement("next", QString::number(blockentry
.second
->getNextBlock(1), 16));
40 stream
.writeEndElement(); // "block"
43 stream
.writeEndElement(); // "function"
44 stream
.writeEndDocument();