1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
/*
Copyright (C) 2006 - 2015 * Evan Teran evan.teran@gmail.com
* darkprof dark_prof@mail.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "FasLoader.hpp"
#include "IDebugger.h"
#include "IProcess.h"
#include "ISymbolManager.h"
#include "Symbol.h"
#include "edb.h"
#include <QMenu>
#include <QSettings>
namespace FasLoaderPlugin {
/**
* @brief FasLoader::FasLoader
* @param parent
*/
FasLoader::FasLoader(QObject *parent)
: QObject(parent) {
}
/**
* @brief FasLoader::menu
* @param parent
* @return
*/
QMenu *FasLoader::menu(QWidget *parent) {
Q_ASSERT(parent);
if (!menu_) {
menu_ = new QMenu(tr("FasLoader"), parent);
menu_->addAction(tr("&Load *.fas symbols"), this, SLOT(load()));
}
return menu_;
}
/**
* @brief FasLoader::load
*/
void FasLoader::load() {
if (edb::v1::debugger_core) {
if (IProcess *process = edb::v1::debugger_core->process()) {
const QString fileName = process->executable();
QString fasName = fileName;
fasName.append(".fas");
Fas::Core fasCore;
fasCore.load(fasName.toUtf8().constData());
auto pluginSymbols = fasCore.getSymbols();
for (auto pluginSymbol : pluginSymbols) {
auto symbol = std::make_shared<Symbol>();
symbol->file = fileName;
symbol->address = pluginSymbol.value;
symbol->name = QString::fromStdString(pluginSymbol.name);
symbol->size = pluginSymbol.size;
if (pluginSymbol.size > 0) {
symbol->type = 'd';
}
edb::v1::symbol_manager().addSymbol(symbol);
}
}
}
}
}
|