Add binary to saved archive
authorChristoph Egger <Christoph.Egger@fau.de>
Thu, 5 Mar 2015 13:39:17 +0000 (14:39 +0100)
committerChristoph Egger <Christoph.Egger@fau.de>
Thu, 5 Mar 2015 13:39:17 +0000 (14:39 +0100)
src/core/InformationManager.cxx
src/core/InformationManager.hxx

index 1ea4ba0cb0357f7a12235d8af3adb17592659043..73ea5ef1cda9bfdb61fda0fe59e807ed7d11d524 100644 (file)
@@ -21,6 +21,7 @@ InformationManager::~InformationManager() {
 }
 
 void InformationManager::reset(const std::string& filename) {
+       this->filename = filename;
        disassembler.reset(createLLVMDisassembler(filename, this));
        if (disassembler.get() != NULL)
                disassembler.get()->start();
@@ -32,6 +33,20 @@ void InformationManager::save(const QString& filename) {
        zip.setComment("FRIDA 0.0");
        QuaZipFile outZipFile(&zip);
 
+       {
+               QFile binary(this->filename.c_str());
+               binary.open(QIODevice::ReadOnly);
+               QuaZipNewInfo zipinfo("binary");
+               zipinfo.setPermissions(static_cast<QFile::Permissions>(0x6444));
+               outZipFile.open(QIODevice::WriteOnly, zipinfo);
+               QByteArray buffer;
+               while (!binary.atEnd()) {
+                       buffer = binary.read(4096);
+                       outZipFile.write(buffer);
+               }
+               outZipFile.close();
+       }
+
        for (auto funpair : functions) {
                Function* fun = funpair.second;
                QuaZipNewInfo zipinfo(fun->getName().c_str());
index 243ca94407766506eab1d0582d341f4f93a11423..2e9358c9afdd05301d901241828b797e0877acc8 100644 (file)
@@ -91,6 +91,7 @@ private:
        std::unique_ptr<Disassembler> disassembler;
        std::map<uint64_t, Function*> functions;
        std::map<uint64_t, BasicBlock*> blocks;
+       std::string filename;
 
        log4cxx::LoggerPtr logger;
 };