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