##// END OF EJS Templates
SREC file perser WIP.
SREC file perser WIP.

File last commit:

r43:10bc9884d696 default
r44:81145171ec94 default
Show More
elffilewidget.cpp
135 lines | 4.8 KiB | text/x-c | CppLexer
/ src / common / elf / elffilewidget.cpp
ElfFile classes WIP.
r35 #include "elffilewidget.h"
#include "ui_elffilewidget.h"
Elf Symbol enumeration working, elf update buggy!
r42 #include <QtWidgets/QTableWidgetItem>
Jeandet Alexis
Elf viewer almost completed.
r43 #include "qhexedit.h"
#include "qtablewidgetintitem.h"
ElfFile classes WIP.
r35
elfFileWidget::elfFileWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::elfFileWidget)
{
ui->setupUi(this);
Jeandet Alexis
Elf viewer almost completed.
r43 connect(this->ui->sectionsList,SIGNAL(cellActivated(int,int)),this,SLOT(sectionCellActivated(int,int)));
ElfFile classes WIP.
r35 }
Jeandet Alexis
Elf viewer almost completed.
r43
ElfFile classes WIP.
r35 elfFileWidget::~elfFileWidget()
{
delete ui;
}
Jeandet Alexis
ElfFile classes WIP.
r36
Jeandet Alexis
Elf viewer almost completed.
r43
Jeandet Alexis
ElfFile classes WIP.
r36 void elfFileWidget::updateElfFile(ElfFile *file)
{
this->p_elf = file;
if(p_elf->isopened() && p_elf->iself())
{
this->ui->classLabel->setText(p_elf->getClass());
this->ui->VersionLabel->setText(QString::number(p_elf->getVersion()));
this->ui->machineLabel->setText(p_elf->getArchitecture());
this->ui->endiannesLabel->setText(p_elf->getEndianness());
ElfFile classes WIP.
r37 this->ui->abiLabel->setText(p_elf->getABI());
ElfFile classes WIP....
r40 this->ui->entryPointLabel->setText(QString("0x%1").arg((uint)p_elf->getEntryPointAddress(),8,16));
this->ui->typeLabel->setText(p_elf->getType());
this->ui->sectionCountLabel->setText(QString::number(p_elf->getSectionCount()));
Jeandet Alexis
Elf Symbol enumeration WIP.
r41 this->ui->symbolCountLabel->setText(QString::number(p_elf->getSymbolCount()));
Jeandet Alexis
ElfFile classes WIP.
r36 }
Elf Symbol enumeration working, elf update buggy!
r42 updateSymbols();
Jeandet Alexis
Elf viewer almost completed.
r43 updateSections();
Elf Symbol enumeration working, elf update buggy!
r42 }
Jeandet Alexis
Elf viewer almost completed.
r43
Elf Symbol enumeration working, elf update buggy!
r42 void elfFileWidget::updateSymbols()
{
this->ui->symbolsList->clear();
this->ui->symbolsList->setRowCount(p_elf->getSymbolCount());
Jeandet Alexis
Elf viewer almost completed.
r43 this->ui->symbolsList->setHorizontalHeaderLabels(QStringList()<<"Index"<<"Value"<<"Size"<<"Type"<<"Link"<<"Section"<<"Name");
Elf Symbol enumeration working, elf update buggy!
r42 for(int i=0;i<p_elf->getSymbolCount();i++)
{
Jeandet Alexis
Elf viewer almost completed.
r43 QTableWidgetItem *newItem = (QTableWidgetItem*)new QTableWidgetIntItem(QString("%1").arg(i),DecimalItem);
Elf Symbol enumeration working, elf update buggy!
r42 newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
this->ui->symbolsList->setItem(i, 0, newItem);
Jeandet Alexis
Elf viewer almost completed.
r43 newItem = (QTableWidgetItem*)new QTableWidgetIntItem(QString("0x%1").arg(p_elf->getSymbolAddress(i),8,16).replace(" ","0"),HexaDecimalItem);
Elf Symbol enumeration working, elf update buggy!
r42 newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
this->ui->symbolsList->setItem(i, 1, newItem);
Jeandet Alexis
Elf viewer almost completed.
r43 newItem = (QTableWidgetItem*)new QTableWidgetIntItem(QString("%1").arg(p_elf->getSymbolSize(i)),DecimalItem);
newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
this->ui->symbolsList->setItem(i, 2, newItem);
Elf Symbol enumeration working, elf update buggy!
r42 newItem = new QTableWidgetItem(p_elf->getSymbolType(i));
newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
Jeandet Alexis
Elf viewer almost completed.
r43 this->ui->symbolsList->setItem(i, 3, newItem);
Elf Symbol enumeration working, elf update buggy!
r42
newItem = new QTableWidgetItem(p_elf->getSymbolLinkType(i));
newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
Jeandet Alexis
Elf viewer almost completed.
r43 this->ui->symbolsList->setItem(i, 4, newItem);
Elf Symbol enumeration working, elf update buggy!
r42
newItem = new QTableWidgetItem(p_elf->getSymbolSectionName(i));
newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
Jeandet Alexis
Elf viewer almost completed.
r43 this->ui->symbolsList->setItem(i, 5, newItem);
Elf Symbol enumeration working, elf update buggy!
r42
newItem = new QTableWidgetItem(p_elf->getSymbolName(i));
newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
Jeandet Alexis
Elf viewer almost completed.
r43 this->ui->symbolsList->setItem(i, 6, newItem);
Elf Symbol enumeration working, elf update buggy!
r42 }
this->ui->symbolsList->resizeColumnsToContents();
Jeandet Alexis
ElfFile classes WIP.
r36 }
ElfFile classes WIP.
r37
Jeandet Alexis
Elf viewer almost completed.
r43 void elfFileWidget::updateSections()
{
this->ui->sectionsList->clear();
this->ui->sectionsList->setRowCount(p_elf->getSectionCount());
this->ui->sectionsList->setHorizontalHeaderLabels(QStringList()<<"Index"<<"Name"<<"Address"<<"Size");
for(int i=0;i<p_elf->getSectionCount();i++)
{
QTableWidgetItem *newItem = (QTableWidgetItem*) new QTableWidgetIntItem(QString("%1").arg(i),DecimalItem);
newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
this->ui->sectionsList->setItem(i,0, newItem);
newItem = new QTableWidgetItem(p_elf->getSectionName(i));
newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
this->ui->sectionsList->setItem(i, 1, newItem);
newItem = (QTableWidgetItem*) new QTableWidgetIntItem(QString("0x%1").arg(p_elf->getSectionPaddr(i),8,16).replace(" ","0"),HexaDecimalItem);
newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
this->ui->sectionsList->setItem(i, 2, newItem);
newItem = (QTableWidgetItem*) new QTableWidgetIntItem(QString("%1").arg(p_elf->getSectionDatasz(i)),DecimalItem);
newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
this->ui->sectionsList->setItem(i, 3, newItem);
}
this->ui->sectionsList->resizeColumnsToContents();
}
void elfFileWidget::sectionCellActivated(int row, int column)
{
Q_UNUSED(column)
char* buff=NULL;
int sectionIndex = p_elf->getSectionIndex(this->ui->sectionsList->item(row,1)->text());
if(sectionIndex!=-1)
{
this->p_elf->getSectionData(sectionIndex,&buff);
this->ui->sectionsHexView->setData(QByteArray(buff,this->p_elf->getSectionDatasz(sectionIndex)));
}
}
ElfFile classes WIP.
r37