##// END OF EJS Templates
dsu3plugin:...
jeandet -
r60:dbbb04783771 default
parent child
Show More
@@ -46,20 +46,11 dsu3plugin::dsu3plugin(QWidget *parent):
46 {
46 {
47 this->UI = new dsu3pluginui();
47 this->UI = new dsu3pluginui();
48 this->setWidget((QWidget*)this->UI);
48 this->setWidget((QWidget*)this->UI);
49 this->elfparserInst = new elfparser();
49 this->elfFile = new ElfFile();
50 // this->pyObject = new dsu3pluginPywrapper(this);
51 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(openFile(QString)),this,SLOT(openFile(QString)));
52 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(loadFile()),this,SLOT(flashTarget()));
53 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(run()),this,SLOT(run()));
54 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(stop()),this,SLOT(stop()));
55 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheEnable()),this,SLOT(cacheEnable()));
56 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(cacheDisable()),this,SLOT(cacheDisable()));
57 // QObject::connect(((dsu3pluginPywrapper*)this->pyObject),SIGNAL(setCacheEnable(bool)),this,SLOT(setCacheEnable(bool)));
58
59 connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile()));
50 connect(this->UI,SIGNAL(openFile()),this,SLOT(openFile()));
60 connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget()));
51 connect(this->UI,SIGNAL(flashTarget()),this,SLOT(flashTarget()));
61 connect(this->UI,SIGNAL(run()),this,SLOT(toggleRun()));
52 connect(this->UI,SIGNAL(run()),this,SLOT(toggleRun()));
62 connect(this,SIGNAL(updateInfo(elfparser*)),this->UI,SIGNAL(updateInfo(elfparser*)));
53 connect(this,SIGNAL(updateInfo(ElfFile*)),this->UI,SLOT(updateInfo(ElfFile*)));
63 this->running = false;
54 this->running = false;
64 }
55 }
65
56
@@ -81,8 +72,8 void dsu3plugin::openFile()
81
72
82 void dsu3plugin::openFile(QString fileName)
73 void dsu3plugin::openFile(QString fileName)
83 {
74 {
84 this->elfparserInst->setFilename(fileName);
75 this->elfFile->openFile(fileName);
85 emit this->updateInfo(this->elfparserInst);
76 emit this->updateInfo(this->elfFile);
86 }
77 }
87
78
88 bool dsu3plugin::configureTarget()
79 bool dsu3plugin::configureTarget()
@@ -242,6 +233,17 void dsu3plugin::toggleRun()
242 this->run();
233 this->run();
243 }
234 }
244
235
236 bool dsu3plugin::dumpSymbol(const QString &symbolName, QString file, const QString &format)
237 {
238 if(this->elfFile->isopened())
239 {
240 int symbolIndex=this->elfFile->getSymbolIndex(symbolName);
241 if(symbolIndex!=-1)
242 return this->dumpMemory(this->elfFile->getSymbolAddress(symbolIndex),this->elfFile->getSymbolSize(symbolIndex)/4,file,format);
243 }
244 return false;
245 }
246
245 void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address)
247 void dsu3plugin::WriteRegs(uIntlist Values, unsigned int address)
246 {
248 {
247 unsigned int* buff;
249 unsigned int* buff;
@@ -265,11 +267,11 void dsu3plugin::writeSection(int index)
265 {
267 {
266 char* buffch=NULL;
268 char* buffch=NULL;
267 unsigned int* buff;
269 unsigned int* buff;
268 int size = this->elfparserInst->getSectionDatasz(index);
270 int size = this->elfFile->getSectionDatasz(index);
269 int sizeInt = size/4;
271 int sizeInt = size/4;
270 if(parent==NULL)
272 if(parent==NULL)
271 return;
273 return;
272 this->elfparserInst->getSectionData(index,&buffch);
274 this->elfFile->getSectionData(index,&buffch);
273 buff = (unsigned int*)malloc(((size/4)+1)*sizeof(unsigned int));
275 buff = (unsigned int*)malloc(((size/4)+1)*sizeof(unsigned int));
274 for(int i=0;i<sizeInt;i++)
276 for(int i=0;i<sizeInt;i++)
275 {
277 {
@@ -287,19 +289,15 void dsu3plugin::writeSection(int index)
287 }
289 }
288 sizeInt++;
290 sizeInt++;
289 }
291 }
290 parent->Write(buff,(unsigned int)sizeInt,(unsigned int)this->elfparserInst->getSectionPaddr(index));
292 parent->Write(buff,(unsigned int)sizeInt,(unsigned int)this->elfFile->getSectionPaddr(index));
291 free(buff);
293 free(buff);
292 }
294 }
293
295
294 void dsu3plugin::writeSection(const QString &name)
296 void dsu3plugin::writeSection(const QString &name)
295 {
297 {
296 for(int i=0;i<this->elfparserInst->getSectioncount();i++)
298 if(elfFile->isopened())
297 {
298 if(!this->elfparserInst->getSectionName(i).compare(name))
299 {
299 {
300 printf("about to write section %s @ 0x%x size = %d\n",elfparserInst->getSectionName(i).toStdString().c_str(),elfparserInst->getSectionPaddr(i),elfparserInst->getSectionMemsz(i));
300 writeSection(this->elfFile->getSectionIndex(name));
301 writeSection(i);
302 }
303 }
301 }
304 }
302 }
305
303
@@ -28,6 +28,7
28 #include <QMainWindow>
28 #include <QMainWindow>
29 #include <QList>
29 #include <QList>
30 #include "elfparser.h"
30 #include "elfparser.h"
31 #include <elffile.h>
31 #include <socexplorerplugin.h>
32 #include <socexplorerplugin.h>
32 #include <socexplorerengine.h>
33 #include <socexplorerengine.h>
33
34
@@ -55,15 +56,17 public slots:
55 void toggleRun();
56 void toggleRun();
56 //added for python backward compatibility
57 //added for python backward compatibility
57 void loadFile(){this->flashTarget();}
58 void loadFile(){this->flashTarget();}
59 bool dumpSymbol(const QString& symbolName,QString file,const QString& format);
60
58 signals:
61 signals:
59 void updateInfo(elfparser* parser);
62 void updateInfo(ElfFile* elfFile);
60 private:
63 private:
61 void WriteRegs(uIntlist Values, unsigned int address);
64 void WriteRegs(uIntlist Values, unsigned int address);
62 unsigned int ReadReg(unsigned int address);
65 unsigned int ReadReg(unsigned int address);
63 void writeSection(int index);
66 void writeSection(int index);
64 void writeSection(const QString& name);
67 void writeSection(const QString& name);
65 dsu3pluginui* UI;
68 dsu3pluginui* UI;
66 elfparser* elfparserInst;
69 ElfFile* elfFile;
67 bool running;
70 bool running;
68 };
71 };
69
72
@@ -29,16 +29,15 dsu3pluginui::dsu3pluginui(QWidget *pare
29 this->flashTargetQpb = new QPushButton(tr("Flash Target"));
29 this->flashTargetQpb = new QPushButton(tr("Flash Target"));
30 this->runQpb = new QPushButton(tr("Run"));
30 this->runQpb = new QPushButton(tr("Run"));
31 this->mainLayout = new QGridLayout();
31 this->mainLayout = new QGridLayout();
32 this->elfInfoWdgtInst = new elfInfoWdgt;
32 this->elfFileWidgetInst = new elfFileWidget();
33 this->mainLayout->addWidget(this->openFileQpb,0,0,1,1);
33 this->mainLayout->addWidget(this->openFileQpb,0,0,1,1);
34 this->mainLayout->addWidget(this->flashTargetQpb,0,1,1,1);
34 this->mainLayout->addWidget(this->flashTargetQpb,0,1,1,1);
35 this->mainLayout->addWidget(this->runQpb,0,2,1,1);
35 this->mainLayout->addWidget(this->runQpb,0,2,1,1);
36 this->mainLayout->addWidget(this->elfInfoWdgtInst,1,0,1,-1);
36 this->mainLayout->addWidget(this->elfFileWidgetInst,1,0,1,-1);
37 this->setLayout(this->mainLayout);
37 this->setLayout(this->mainLayout);
38 connect(this->openFileQpb,SIGNAL(clicked()),this,SIGNAL(openFile()));
38 connect(this->openFileQpb,SIGNAL(clicked()),this,SIGNAL(openFile()));
39 connect(this->flashTargetQpb,SIGNAL(clicked()),this,SIGNAL(flashTarget()));
39 connect(this->flashTargetQpb,SIGNAL(clicked()),this,SIGNAL(flashTarget()));
40 connect(this->runQpb,SIGNAL(clicked()),this,SIGNAL(run()));
40 connect(this->runQpb,SIGNAL(clicked()),this,SIGNAL(run()));
41 connect(this,SIGNAL(updateInfo(elfparser*)),this->elfInfoWdgtInst,SLOT(updateInfo(elfparser*)));
42
41
43 }
42 }
44
43
@@ -50,6 +49,11 void dsu3pluginui::setRunning(bool runni
50 this->runQpb->setText("Run");
49 this->runQpb->setText("Run");
51 }
50 }
52
51
52 void dsu3pluginui::updateInfo(ElfFile *file)
53 {
54 this->elfFileWidgetInst->setFile(file);
55 }
56
53
57
54
58
55
59
@@ -30,6 +30,8
30 #include <QVBoxLayout>
30 #include <QVBoxLayout>
31 #include <QGridLayout>
31 #include <QGridLayout>
32 #include "elfinfowdgt.h"
32 #include "elfinfowdgt.h"
33 #include <elffile.h>
34 #include <elffilewidget.h>
33
35
34 class dsu3pluginui : public QWidget
36 class dsu3pluginui : public QWidget
35 {
37 {
@@ -39,9 +41,9 public:
39
41
40 public slots:
42 public slots:
41 void setRunning(bool running);
43 void setRunning(bool running);
44 void updateInfo(ElfFile* file);
42 signals:
45 signals:
43 void openFile();
46 void openFile();
44 void updateInfo(elfparser* parser);
45 bool flashTarget();
47 bool flashTarget();
46 void run();
48 void run();
47 private:
49 private:
@@ -49,7 +51,7 private:
49 QPushButton* openFileQpb;
51 QPushButton* openFileQpb;
50 QPushButton* flashTargetQpb;
52 QPushButton* flashTargetQpb;
51 QPushButton* runQpb;
53 QPushButton* runQpb;
52 elfInfoWdgt* elfInfoWdgtInst;
54 elfFileWidget* elfFileWidgetInst;
53 };
55 };
54
56
55 #endif // DSU3PLUGINUI_H
57 #endif // DSU3PLUGINUI_H
General Comments 0
You need to be logged in to leave comments. Login now