void InformationManager::reset(const std::string& filename) {
this->filename = filename;
disassembler.reset(createLLVMDisassembler(filename, this));
+ emit resetEvent();
if (disassembler.get() != NULL)
disassembler.get()->start();
}
#include <functional>
#include <vector>
+#include "qt.hxx"
#include "Instruction.hxx"
class Function;
class BasicBlock;
class InformationManager;
-class Disassembler {
+class Disassembler : public QObject {
+#ifndef SWIG
+ Q_OBJECT
+#endif
public:
Disassembler() {}
virtual ~Disassembler() {}
virtual void getSymbols() = 0;
virtual uint64_t entryAddress() = 0;
- virtual Function * disassembleFunctionAt(uint64_t address, const std::string& name = "") = 0;
+#ifndef SWIG
+public slots:
+#endif
+ virtual Function * disassembleFunctionAt(uint64_t address) {
+ return disassembleFunctionAt(address, "");
+ }
+ virtual Function * disassembleFunctionAt(uint64_t address, const std::string& name) = 0;
virtual std::vector<Instruction> getInstructions(const BasicBlock* block) = 0;
};
QTreeWidgetItem * external = new QTreeWidgetItem(listWidget, QStringList("External Functions"));
external->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
external->setBackground(0, QBrush(QColor(0xff, 0xdd, 0xdd)));
+ connect(mgr, &InformationManager::resetEvent,
+ [this,mgr]() {
+ connect(this, SIGNAL(requestNewFunctionByAddress(uint64_t)),
+ mgr->getDisassembler(), SLOT(disassembleFunctionAt(uint64_t)));
+ });
connect(mgr, &InformationManager::newFunctionEvent,
[=] (NewFunctionEvent* event) {
std::string name = event->function->getName();
NewFunctionDialog dialog;
int result = dialog.exec();
if (QDialog::Accepted == result) {
- requestNewFunctionByAddress(dialog.result());
+ emit requestNewFunctionByAddress(dialog.result());
} else {
LOG4CXX_DEBUG(logger, "requestNewFunction aborted");
}
}
}
-void Mainwindow::requestNewFunctionByAddress(uint64_t address) {
- LOG4CXX_DEBUG(logger, "requesting Function at " << std::hex << address);
- manager->getDisassembler()->disassembleFunctionAt(address);
- switchMainPlaneToAddress(address);
-}
-
void Mainwindow::renameFunction(Function* function) {
SimpleStringDialog dialog("New name");
int result = dialog.exec();
QAction* act = menu.addAction(c.selectedText() + " is a Function");
QObject::connect(act, &QAction::triggered,
[=]() {
- parent->mainwindow->requestNewFunctionByAddress(address);
+ emit parent->mainwindow->requestNewFunctionByAddress(address);
if (NULL == table) return;
int row = table->cellAt(c).row();
uint64_t insAddress = parent->instructions[row].getAddress();