@@ -1,11 +1,12 | |||||
1 | #include <QObject> |
|
1 | #include <QtCore/QObject> | |
2 | #include <QWidget> |
|
2 | #include <QtWidgets/QtWidgets> | |
3 | #include "qhexspinbox.h" |
|
3 | #include "qhexspinbox.h" | |
4 | #include "memsizewdgt.h" |
|
4 | #include "memsizewdgt.h" | |
5 | #include "qhexedit/qhexedit.h" |
|
5 | #include "qhexedit/qhexedit.h" | |
6 | #include "SocExplorerPlot.h" |
|
6 | #include "SocExplorerPlot.h" | |
7 | #include "tcp_terminal_client.h" |
|
7 | #include "tcp_terminal_client.h" | |
8 | #include "elf/elfparser.h" |
|
8 | #include "elf/elfparser.h" | |
9 |
#include " |
|
9 | #include "abstractexecfile.h" | |
10 | #include "elf/elffile.h" |
|
10 | #include "elf/elffile.h" | |
11 | #include "elf/elffilewidget.h" |
|
11 | #include "elf/elffilewidget.h" | |
|
12 | #include "elf/elfinfowdgt.h" |
@@ -21,17 +21,10 | |||||
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "abstractexecfile.h" |
|
22 | #include "abstractexecfile.h" | |
23 |
|
23 | |||
24 | abstractExecFile::abstractExecFile() |
|
|||
25 | { |
|
|||
26 | } |
|
|||
27 |
|
||||
28 | abstractExecFile::abstractExecFile(const QString &File) |
|
|||
29 | { |
|
|||
30 |
|
||||
31 | } |
|
|||
32 |
|
||||
33 |
|
24 | |||
34 | codeFragment::codeFragment() |
|
25 | codeFragment::codeFragment() | |
35 | { |
|
26 | { | |
36 |
|
27 | data = NULL; | ||
|
28 | size = 0; | |||
|
29 | address = 0; | |||
37 | } |
|
30 | } |
@@ -22,26 +22,27 | |||||
22 | #ifndef ABSTRACTEXECFILE_H |
|
22 | #ifndef ABSTRACTEXECFILE_H | |
23 | #define ABSTRACTEXECFILE_H |
|
23 | #define ABSTRACTEXECFILE_H | |
24 |
|
24 | |||
25 | #include <QObject> |
|
25 | #include <QtCore/QObject> | |
26 |
|
26 | |||
27 | class codeFragment |
|
27 | class codeFragment | |
28 | { |
|
28 | { | |
29 | public: |
|
29 | public: | |
30 | codeFragment(); |
|
30 | codeFragment(); | |
|
31 | codeFragment(char* data, quint32 size, quint32 address):data(data),size(size),address(address){} | |||
31 | char* data; |
|
32 | char* data; | |
32 | quint32 size; |
|
33 | quint32 size; | |
33 | quint32 address; |
|
34 | quint32 address; | |
34 | }; |
|
35 | }; | |
35 |
|
36 | |||
36 | class abstractExecFile |
|
37 | class abstractExecFile : public QObject | |
37 | { |
|
38 | { | |
|
39 | Q_OBJECT | |||
38 | public: |
|
40 | public: | |
39 | abstractExecFile(); |
|
41 | // virtual abstractExecFile()=0; | |
40 | abstractExecFile(const QString& File); |
|
|||
41 | virtual bool openFile(const QString& File)=0; |
|
42 | virtual bool openFile(const QString& File)=0; | |
42 | virtual bool isopened()=0; |
|
43 | virtual bool isopened()=0; | |
43 | virtual int closeFile()=0; |
|
44 | virtual int closeFile()=0; | |
44 | virtual QList<codeFragment> getFragments()=0; |
|
45 | virtual QList<codeFragment*> getFragments()=0; | |
45 |
|
46 | |||
46 | protected: |
|
47 | protected: | |
47 | QString p_fileName; |
|
48 | QString p_fileName; |
@@ -109,6 +109,9 SOURCES += \ | |||||
109 | FORMS += \ |
|
109 | FORMS += \ | |
110 | elf/elffilewidget.ui |
|
110 | elf/elffilewidget.ui | |
111 |
|
111 | |||
|
112 | OTHER_FILES += \ | |||
|
113 | ./pythongenerator.sh \ | |||
|
114 | ./pythonQtgeneratorCfg.txt | |||
112 |
|
115 | |||
113 |
|
116 | |||
114 |
|
117 |
This diff has been collapsed as it changes many lines, (746 lines changed) Show them Hide them | |||||
@@ -23,38 +23,71 | |||||
23 | ----------------------------------------------------------------------------*/ |
|
23 | ----------------------------------------------------------------------------*/ | |
24 | #include "elffile.h" |
|
24 | #include "elffile.h" | |
25 |
|
25 | |||
26 |
ElfFile::ElfFile( |
|
26 | ElfFile::ElfFile() | |
27 |
: |
|
27 | :abstractExecFile() | |
28 | { |
|
28 | { | |
|
29 | this->opened = false; | |||
|
30 | this->type_elf = false; | |||
|
31 | this->elfFile = NULL; | |||
|
32 | this->e = NULL; | |||
29 | } |
|
33 | } | |
30 |
|
34 | |||
31 |
ElfFile::ElfFile(const QString &File |
|
35 | ElfFile::ElfFile(const QString &File) | |
32 |
: |
|
36 | :abstractExecFile() | |
33 | { |
|
37 | { | |
|
38 | this->opened = false; | |||
|
39 | this->type_elf = false; | |||
|
40 | this->elfFile = NULL; | |||
|
41 | this->e = NULL; | |||
34 | this->p_fileName = File; |
|
42 | this->p_fileName = File; | |
35 |
|
|
43 | openFile(File); | |
36 | } |
|
44 | } | |
37 |
|
45 | |||
38 | bool ElfFile::openFile(const QString &File) |
|
46 | bool ElfFile::openFile(const QString &File) | |
39 | { |
|
47 | { | |
40 | this->p_fileName = File; |
|
48 | this->p_fileName = File; | |
41 | return setFilename(File); |
|
49 | this->closeFile(); | |
|
50 | if(elf_version(EV_CURRENT)==EV_NONE)return 0; | |||
|
51 | #ifdef _ELF_WINDOWS_ | |||
|
52 | this->elfFile = open(File.toStdString().c_str(),O_RDONLY|O_BINARY ,0); | |||
|
53 | #else | |||
|
54 | this->elfFile = open(File.toStdString().c_str(),O_RDONLY ,0); | |||
|
55 | #endif | |||
|
56 | if(this->elfFile==NULL)return 0; | |||
|
57 | this->e = elf_begin(this->elfFile,ELF_C_READ,NULL); | |||
|
58 | if(this->e==NULL)return 0; | |||
|
59 | this->ek = elf_kind(this->e); | |||
|
60 | gelf_getehdr (this->e, &this->ehdr ); | |||
|
61 | elf_getshdrstrndx (this->e, &this->shstrndx); | |||
|
62 | this->updateSegments(); | |||
|
63 | this->updateSections(); | |||
|
64 | return 1; | |||
42 | } |
|
65 | } | |
43 |
|
66 | |||
44 | bool ElfFile::isopened() |
|
67 | bool ElfFile::isopened() | |
45 | { |
|
68 | { | |
46 |
return |
|
69 | return this->opened; | |
47 | } |
|
70 | } | |
48 |
|
71 | |||
49 | int ElfFile::closeFile() |
|
72 | int ElfFile::closeFile() | |
50 | { |
|
73 | { | |
51 | return elfparser::closeFile(); |
|
74 | if(this->elfFile!=NULL) | |
|
75 | { | |||
|
76 | if(this->e!=NULL) | |||
|
77 | { | |||
|
78 | elf_end(this->e); | |||
|
79 | this->e = NULL; | |||
|
80 | } | |||
|
81 | close(this->elfFile); | |||
|
82 | this->elfFile = NULL; | |||
|
83 | } | |||
|
84 | return 0; | |||
52 | } |
|
85 | } | |
53 |
|
86 | |||
54 |
|
87 | |||
55 | QList<codeFragment> ElfFile::getFragments(QStringList fragmentList) |
|
88 | QList<codeFragment*> ElfFile::getFragments(QStringList fragmentList) | |
56 | { |
|
89 | { | |
57 | QList<codeFragment> fragments; |
|
90 | QList<codeFragment*> fragments; | |
58 | if (isopened()) |
|
91 | if (isopened()) | |
59 | { |
|
92 | { | |
60 | for(int i =0;i<fragmentList.count();i++) |
|
93 | for(int i =0;i<fragmentList.count();i++) | |
@@ -65,22 +98,22 QList<codeFragment> ElfFile::getFragment | |||||
65 | return fragments; |
|
98 | return fragments; | |
66 | } |
|
99 | } | |
67 |
|
100 | |||
68 | QList<codeFragment> ElfFile::getFragments() |
|
101 | QList<codeFragment*> ElfFile::getFragments() | |
69 | { |
|
102 | { | |
70 | return getFragments(QStringList()<<".data"<<".text"); |
|
103 | return getFragments(QStringList()<<".data"<<".text"); | |
71 | } |
|
104 | } | |
72 |
|
105 | |||
73 | codeFragment ElfFile::getFragment(const QString &name) |
|
106 | codeFragment *ElfFile::getFragment(const QString &name) | |
74 | { |
|
107 | { | |
75 | codeFragment fragment; |
|
108 | codeFragment* fragment= new codeFragment(); | |
76 | for(int i=0;i<getSectioncount();i++) |
|
109 | for(int i=0;i<getSectioncount();i++) | |
77 | { |
|
110 | { | |
78 | if(getSectionName(i) == name) |
|
111 | if(getSectionName(i) == name) | |
79 | { |
|
112 | { | |
80 |
fragment |
|
113 | fragment->data =NULL; | |
81 |
fragment |
|
114 | fragment->size = getSectionDatasz(i); | |
82 |
fragment |
|
115 | fragment->address = getSectionPaddr(i); | |
83 |
getSectionData(i,&fragment |
|
116 | getSectionData(i,&fragment->data); | |
84 | } |
|
117 | } | |
85 | } |
|
118 | } | |
86 |
|
119 | |||
@@ -92,10 +125,687 codeFragment ElfFile::getFragment(const | |||||
92 |
|
125 | |||
93 |
|
126 | |||
94 |
|
127 | |||
|
128 | QString elfresolveMachine(Elf64_Half e_machine) | |||
|
129 | { | |||
|
130 | QString machineName; | |||
|
131 | //Update from with bash script don't write it by yourself! | |||
|
132 | switch(e_machine) | |||
|
133 | { | |||
|
134 | case EM_NONE: | |||
|
135 | machineName = " No machine "; | |||
|
136 | break; | |||
|
137 | case EM_M32: | |||
|
138 | machineName = " AT&T WE 32100 "; | |||
|
139 | break; | |||
|
140 | case EM_SPARC: | |||
|
141 | machineName = " SUN SPARC "; | |||
|
142 | break; | |||
|
143 | case EM_386: | |||
|
144 | machineName = " Intel 80386 "; | |||
|
145 | break; | |||
|
146 | case EM_68K: | |||
|
147 | machineName = " Motorola m68k family "; | |||
|
148 | break; | |||
|
149 | case EM_88K: | |||
|
150 | machineName = " Motorola m88k family "; | |||
|
151 | break; | |||
|
152 | case EM_860: | |||
|
153 | machineName = " Intel 80860 "; | |||
|
154 | break; | |||
|
155 | case EM_MIPS: | |||
|
156 | machineName = " MIPS R3000 big-endian "; | |||
|
157 | break; | |||
|
158 | case EM_S370: | |||
|
159 | machineName = " IBM System/370 "; | |||
|
160 | break; | |||
|
161 | case EM_MIPS_RS3_LE: | |||
|
162 | machineName = " MIPS R3000 little-endian "; | |||
|
163 | break; | |||
|
164 | case EM_PARISC: | |||
|
165 | machineName = " HPPA "; | |||
|
166 | break; | |||
|
167 | case EM_VPP500: | |||
|
168 | machineName = " Fujitsu VPP500 "; | |||
|
169 | break; | |||
|
170 | case EM_SPARC32PLUS: | |||
|
171 | machineName = " Sun's \"v8plus\" "; | |||
|
172 | break; | |||
|
173 | case EM_960: | |||
|
174 | machineName = " Intel 80960 "; | |||
|
175 | break; | |||
|
176 | case EM_PPC: | |||
|
177 | machineName = " PowerPC "; | |||
|
178 | break; | |||
|
179 | case EM_PPC64: | |||
|
180 | machineName = " PowerPC 64-bit "; | |||
|
181 | break; | |||
|
182 | case EM_S390: | |||
|
183 | machineName = " IBM S390 "; | |||
|
184 | break; | |||
|
185 | case EM_V800: | |||
|
186 | machineName = " NEC V800 series "; | |||
|
187 | break; | |||
|
188 | case EM_FR20: | |||
|
189 | machineName = " Fujitsu FR20 "; | |||
|
190 | break; | |||
|
191 | case EM_RH32: | |||
|
192 | machineName = " TRW RH-32 "; | |||
|
193 | break; | |||
|
194 | case EM_RCE: | |||
|
195 | machineName = " Motorola RCE "; | |||
|
196 | break; | |||
|
197 | case EM_ARM: | |||
|
198 | machineName = " ARM "; | |||
|
199 | break; | |||
|
200 | case EM_FAKE_ALPHA: | |||
|
201 | machineName = " Digital Alpha "; | |||
|
202 | break; | |||
|
203 | case EM_SH: | |||
|
204 | machineName = " Hitachi SH "; | |||
|
205 | break; | |||
|
206 | case EM_SPARCV9: | |||
|
207 | machineName = " SPARC v9 64-bit "; | |||
|
208 | break; | |||
|
209 | case EM_TRICORE: | |||
|
210 | machineName = " Siemens Tricore "; | |||
|
211 | break; | |||
|
212 | case EM_ARC: | |||
|
213 | machineName = " Argonaut RISC Core "; | |||
|
214 | break; | |||
|
215 | case EM_H8_300: | |||
|
216 | machineName = " Hitachi H8/300 "; | |||
|
217 | break; | |||
|
218 | case EM_H8_300H: | |||
|
219 | machineName = " Hitachi H8/300H "; | |||
|
220 | break; | |||
|
221 | case EM_H8S: | |||
|
222 | machineName = " Hitachi H8S "; | |||
|
223 | break; | |||
|
224 | case EM_H8_500: | |||
|
225 | machineName = " Hitachi H8/500 "; | |||
|
226 | break; | |||
|
227 | case EM_IA_64: | |||
|
228 | machineName = " Intel Merced "; | |||
|
229 | break; | |||
|
230 | case EM_MIPS_X: | |||
|
231 | machineName = " Stanford MIPS-X "; | |||
|
232 | break; | |||
|
233 | case EM_COLDFIRE: | |||
|
234 | machineName = " Motorola Coldfire "; | |||
|
235 | break; | |||
|
236 | case EM_68HC12: | |||
|
237 | machineName = " Motorola M68HC12 "; | |||
|
238 | break; | |||
|
239 | case EM_MMA: | |||
|
240 | machineName = " Fujitsu MMA Multimedia Accelerator"; | |||
|
241 | break; | |||
|
242 | case EM_PCP: | |||
|
243 | machineName = " Siemens PCP "; | |||
|
244 | break; | |||
|
245 | case EM_NCPU: | |||
|
246 | machineName = " Sony nCPU embeeded RISC "; | |||
|
247 | break; | |||
|
248 | case EM_NDR1: | |||
|
249 | machineName = " Denso NDR1 microprocessor "; | |||
|
250 | break; | |||
|
251 | case EM_STARCORE: | |||
|
252 | machineName = " Motorola Start*Core processor "; | |||
|
253 | break; | |||
|
254 | case EM_ME16: | |||
|
255 | machineName = " Toyota ME16 processor "; | |||
|
256 | break; | |||
|
257 | case EM_ST100: | |||
|
258 | machineName = " STMicroelectronic ST100 processor "; | |||
|
259 | break; | |||
|
260 | case EM_TINYJ: | |||
|
261 | machineName = " Advanced Logic Corp. Tinyj emb.fam"; | |||
|
262 | break; | |||
|
263 | case EM_X86_64: | |||
|
264 | machineName = " AMD x86-64 architecture "; | |||
|
265 | break; | |||
|
266 | case EM_PDSP: | |||
|
267 | machineName = " Sony DSP Processor "; | |||
|
268 | break; | |||
|
269 | case EM_FX66: | |||
|
270 | machineName = " Siemens FX66 microcontroller "; | |||
|
271 | break; | |||
|
272 | case EM_ST9PLUS: | |||
|
273 | machineName = " STMicroelectronics ST9+ 8/16 mc "; | |||
|
274 | break; | |||
|
275 | case EM_ST7: | |||
|
276 | machineName = " STmicroelectronics ST7 8 bit mc "; | |||
|
277 | break; | |||
|
278 | case EM_68HC16: | |||
|
279 | machineName = " Motorola MC68HC16 microcontroller "; | |||
|
280 | break; | |||
|
281 | case EM_68HC11: | |||
|
282 | machineName = " Motorola MC68HC11 microcontroller "; | |||
|
283 | break; | |||
|
284 | case EM_68HC08: | |||
|
285 | machineName = " Motorola MC68HC08 microcontroller "; | |||
|
286 | break; | |||
|
287 | case EM_68HC05: | |||
|
288 | machineName = " Motorola MC68HC05 microcontroller "; | |||
|
289 | break; | |||
|
290 | case EM_SVX: | |||
|
291 | machineName = " Silicon Graphics SVx "; | |||
|
292 | break; | |||
|
293 | case EM_ST19: | |||
|
294 | machineName = " STMicroelectronics ST19 8 bit mc "; | |||
|
295 | break; | |||
|
296 | case EM_VAX: | |||
|
297 | machineName = " Digital VAX "; | |||
|
298 | break; | |||
|
299 | case EM_CRIS: | |||
|
300 | machineName = " Axis Communications 32-bit embedded processor "; | |||
|
301 | break; | |||
|
302 | case EM_JAVELIN: | |||
|
303 | machineName = " Infineon Technologies 32-bit embedded processor "; | |||
|
304 | break; | |||
|
305 | case EM_FIREPATH: | |||
|
306 | machineName = " Element 14 64-bit DSP Processor "; | |||
|
307 | break; | |||
|
308 | case EM_ZSP: | |||
|
309 | machineName = " LSI Logic 16-bit DSP Processor "; | |||
|
310 | break; | |||
|
311 | case EM_MMIX: | |||
|
312 | machineName = " Donald Knuth's educational 64-bit processor "; | |||
|
313 | break; | |||
|
314 | case EM_HUANY: | |||
|
315 | machineName = " Harvard University machine-independent object files "; | |||
|
316 | break; | |||
|
317 | case EM_PRISM: | |||
|
318 | machineName = " SiTera Prism "; | |||
|
319 | break; | |||
|
320 | case EM_AVR: | |||
|
321 | machineName = " Atmel AVR 8-bit microcontroller "; | |||
|
322 | break; | |||
|
323 | case EM_FR30: | |||
|
324 | machineName = " Fujitsu FR30 "; | |||
|
325 | break; | |||
|
326 | case EM_D10V: | |||
|
327 | machineName = " Mitsubishi D10V "; | |||
|
328 | break; | |||
|
329 | case EM_D30V: | |||
|
330 | machineName = " Mitsubishi D30V "; | |||
|
331 | break; | |||
|
332 | case EM_V850: | |||
|
333 | machineName = " NEC v850 "; | |||
|
334 | break; | |||
|
335 | case EM_M32R: | |||
|
336 | machineName = " Mitsubishi M32R "; | |||
|
337 | break; | |||
|
338 | case EM_MN10300: | |||
|
339 | machineName = " Matsushita MN10300 "; | |||
|
340 | break; | |||
|
341 | case EM_MN10200: | |||
|
342 | machineName = " Matsushita MN10200 "; | |||
|
343 | break; | |||
|
344 | case EM_PJ: | |||
|
345 | machineName = " picoJava "; | |||
|
346 | break; | |||
|
347 | case EM_OPENRISC: | |||
|
348 | machineName = " OpenRISC 32-bit embedded processor "; | |||
|
349 | break; | |||
|
350 | case EM_ARC_A5: | |||
|
351 | machineName = " ARC Cores Tangent-A5 "; | |||
|
352 | break; | |||
|
353 | case EM_XTENSA: | |||
|
354 | machineName = " Tensilica Xtensa Architecture "; | |||
|
355 | break; | |||
|
356 | case EM_AARCH64: | |||
|
357 | machineName = " ARM AARCH64 "; | |||
|
358 | break; | |||
|
359 | case EM_TILEPRO: | |||
|
360 | machineName = " Tilera TILEPro "; | |||
|
361 | break; | |||
|
362 | case EM_MICROBLAZE: | |||
|
363 | machineName = " Xilinx MicroBlaze "; | |||
|
364 | break; | |||
|
365 | case EM_TILEGX: | |||
|
366 | machineName = " Tilera TILE-Gx "; | |||
|
367 | break; | |||
|
368 | case EM_NUM: | |||
|
369 | machineName = ""; | |||
|
370 | break; | |||
|
371 | default: | |||
|
372 | machineName ="Unknow Machine"; | |||
|
373 | break; | |||
|
374 | } | |||
|
375 | return machineName; | |||
|
376 | } | |||
|
377 | ||||
|
378 | ||||
|
379 | ||||
|
380 | ||||
|
381 | QString ElfFile::getClass() | |||
|
382 | { | |||
|
383 | if(this->e!=NULL) | |||
|
384 | { | |||
|
385 | int eclass = gelf_getclass(this->e); | |||
|
386 | if(eclass==ELFCLASS32)return "ELF32"; | |||
|
387 | if(eclass==ELFCLASS64)return "ELF64"; | |||
|
388 | } | |||
|
389 | return "none"; | |||
|
390 | } | |||
|
391 | ||||
|
392 | ||||
|
393 | bool ElfFile::iself() | |||
|
394 | { | |||
|
395 | return this->type_elf; | |||
|
396 | } | |||
|
397 | ||||
|
398 | QString ElfFile::getArchitecture() | |||
|
399 | { | |||
|
400 | if(this->e!=NULL) | |||
|
401 | { | |||
|
402 | return elfresolveMachine(this->ehdr.e_machine); | |||
|
403 | } | |||
|
404 | return ""; | |||
|
405 | } | |||
|
406 | ||||
|
407 | ||||
|
408 | QString ElfFile::getType() | |||
|
409 | { | |||
|
410 | QString kind(""); | |||
|
411 | if(this->e!=NULL) | |||
|
412 | { | |||
|
413 | switch(this->ek) | |||
|
414 | { | |||
|
415 | case ELF_K_AR: | |||
|
416 | kind = "Archive"; | |||
|
417 | break; | |||
|
418 | case ELF_K_ELF: | |||
|
419 | kind = "Elf"; | |||
|
420 | break; | |||
|
421 | case ELF_K_COFF: | |||
|
422 | kind = "COFF"; | |||
|
423 | break; | |||
|
424 | case ELF_K_NUM: | |||
|
425 | kind = "NUM"; | |||
|
426 | break; | |||
|
427 | case ELF_K_NONE: | |||
|
428 | kind = "Data"; | |||
|
429 | break; | |||
|
430 | default: | |||
|
431 | kind = "Unknow"; | |||
|
432 | break; | |||
|
433 | } | |||
|
434 | } | |||
|
435 | return kind; | |||
|
436 | } | |||
|
437 | ||||
|
438 | QString ElfFile::getEndianness() | |||
|
439 | { | |||
|
440 | if(this->e!=NULL) | |||
|
441 | { | |||
|
442 | if(this->ehdr.e_ident[EI_DATA]==ELFDATA2LSB)return "2's complement, little endian"; | |||
|
443 | if(this->ehdr.e_ident[EI_DATA]==ELFDATA2MSB)return "2's complement, big endian"; | |||
|
444 | } | |||
|
445 | return "none"; | |||
|
446 | } | |||
|
447 | ||||
|
448 | QString ElfFile::getABI() | |||
|
449 | { | |||
|
450 | if(this->e!=NULL) | |||
|
451 | { | |||
|
452 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_NONE)return "UNIX System V ABI"; | |||
|
453 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_SYSV)return "Alias"; | |||
|
454 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_HPUX)return "HP-UX"; | |||
|
455 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_NETBSD)return "NetBSD"; | |||
|
456 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_GNU)return "Object uses GNU ELF extensions"; | |||
|
457 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_LINUX)return "Compatibility alias"; | |||
|
458 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_SOLARIS)return "Sun Solaris"; | |||
|
459 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_AIX)return "IBM AIX"; | |||
|
460 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_IRIX)return "SGI Irix"; | |||
|
461 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_FREEBSD)return "FreeBSD"; | |||
|
462 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_TRU64)return "Compaq TRU64 UNIX"; | |||
|
463 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_MODESTO)return " Novell Modesto"; | |||
|
464 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_OPENBSD)return "OpenBSD"; | |||
|
465 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_ARM_AEABI)return "ARM EABI"; | |||
|
466 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_ARM)return "ARM"; | |||
|
467 | if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_STANDALONE)return "Standalone (embedded) application"; | |||
|
468 | } | |||
|
469 | return "none"; | |||
|
470 | } | |||
|
471 | ||||
|
472 | ||||
|
473 | qint64 ElfFile::getVersion() | |||
|
474 | { | |||
|
475 | if(this->e!=NULL) | |||
|
476 | { | |||
|
477 | return this->ehdr.e_version; | |||
|
478 | } | |||
|
479 | } | |||
|
480 | ||||
|
481 | qint64 ElfFile::getEntryPointAddress() | |||
|
482 | { | |||
|
483 | if(this->e!=NULL) | |||
|
484 | { | |||
|
485 | return this->ehdr.e_entry; | |||
|
486 | } | |||
|
487 | } | |||
|
488 | ||||
|
489 | ||||
|
490 | int ElfFile::getSectioncount() | |||
|
491 | { | |||
|
492 | return (int)this->SectionCount; | |||
|
493 | } | |||
|
494 | ||||
|
495 | ||||
|
496 | int ElfFile::getSegmentcount() | |||
|
497 | { | |||
|
498 | return (int)this->SegmentCount; | |||
|
499 | } | |||
|
500 | ||||
|
501 | ||||
|
502 | QString ElfFile::getSegmentType(int index) | |||
|
503 | { | |||
|
504 | QString type(""); | |||
|
505 | if(this->e!=NULL) | |||
|
506 | { | |||
|
507 | if(index < this->Segments.count()) | |||
|
508 | { | |||
|
509 | switch(this->Segments.at(index)->p_type) | |||
|
510 | { | |||
|
511 | case PT_NULL: | |||
|
512 | type = "Program header table entry unused"; | |||
|
513 | break; | |||
|
514 | case PT_LOAD: | |||
|
515 | type = "Loadable program segment"; | |||
|
516 | break; | |||
|
517 | case PT_DYNAMIC : | |||
|
518 | type = "Dynamic linking information"; | |||
|
519 | break; | |||
|
520 | case PT_INTERP: | |||
|
521 | type ="Program interpreter"; | |||
|
522 | break; | |||
|
523 | case PT_NOTE: | |||
|
524 | type = "Auxiliary information"; | |||
|
525 | break; | |||
|
526 | case PT_SHLIB: | |||
|
527 | type = "Reserved"; | |||
|
528 | break; | |||
|
529 | case PT_PHDR: | |||
|
530 | type = "Entry for header table itself"; | |||
|
531 | break; | |||
|
532 | case PT_TLS: | |||
|
533 | type = "Thread-local storage segment"; | |||
|
534 | break; | |||
|
535 | case PT_NUM: | |||
|
536 | type = "Number of defined types"; | |||
|
537 | break; | |||
|
538 | case PT_LOOS: | |||
|
539 | type = "Start of OS-specific"; | |||
|
540 | break; | |||
|
541 | case PT_SUNWSTACK: | |||
|
542 | type = "Stack segment"; | |||
|
543 | break; | |||
|
544 | case PT_LOPROC: | |||
|
545 | type = "Start of processor-specific"; | |||
|
546 | break; | |||
|
547 | case PT_HIPROC: | |||
|
548 | type = "End of processor-specific"; | |||
|
549 | break; | |||
|
550 | default: | |||
|
551 | type = "Unknow Section Type"; | |||
|
552 | break; | |||
|
553 | } | |||
|
554 | } | |||
|
555 | } | |||
|
556 | ||||
|
557 | return type; | |||
|
558 | } | |||
|
559 | ||||
|
560 | ||||
|
561 | qint64 ElfFile::getSegmentOffset(int index) | |||
|
562 | { | |||
|
563 | int64_t Offset; | |||
|
564 | if(this->e!=NULL) | |||
|
565 | { | |||
|
566 | if(index < this->Segments.count()) | |||
|
567 | { | |||
|
568 | Offset = (int64_t)this->Segments.at(index)->p_offset; | |||
|
569 | } | |||
|
570 | } | |||
|
571 | return Offset; | |||
|
572 | } | |||
|
573 | ||||
|
574 | ||||
|
575 | qint64 ElfFile::getSegmentVaddr(int index) | |||
|
576 | { | |||
|
577 | int64_t Vaddr = 0; | |||
|
578 | if(this->e!=NULL) | |||
|
579 | { | |||
|
580 | if(index < this->Segments.count()) | |||
|
581 | { | |||
|
582 | Vaddr = (int64_t)this->Segments.at(index)->p_vaddr; | |||
|
583 | } | |||
|
584 | } | |||
|
585 | return Vaddr; | |||
|
586 | } | |||
|
587 | ||||
|
588 | ||||
|
589 | qint64 ElfFile::getSegmentPaddr(int index) | |||
|
590 | { | |||
|
591 | int64_t Paddr=0; | |||
|
592 | if(this->e!=NULL) | |||
|
593 | { | |||
|
594 | if(index < this->Segments.count()) | |||
|
595 | { | |||
|
596 | Paddr = (int64_t)this->Segments.at(index)->p_paddr; | |||
|
597 | } | |||
|
598 | } | |||
|
599 | return Paddr; | |||
|
600 | } | |||
|
601 | ||||
|
602 | qint64 ElfFile::getSectionPaddr(int index) | |||
|
603 | { | |||
|
604 | int64_t Paddr=0; | |||
|
605 | if(this->e!=NULL) | |||
|
606 | { | |||
|
607 | if(index < this->sections.count()) | |||
|
608 | { | |||
|
609 | Paddr = (int64_t)this->sections.at(index)->section_header->sh_addr; | |||
|
610 | } | |||
|
611 | } | |||
|
612 | return Paddr; | |||
|
613 | } | |||
|
614 | ||||
|
615 | ||||
|
616 | qint64 ElfFile::getSegmentFilesz(int index) | |||
|
617 | { | |||
|
618 | int64_t FileSz=0; | |||
|
619 | if(this->e!=NULL) | |||
|
620 | { | |||
|
621 | if(index < this->Segments.count()) | |||
|
622 | { | |||
|
623 | FileSz = (int64_t)this->Segments.at(index)->p_filesz; | |||
|
624 | } | |||
|
625 | } | |||
|
626 | return FileSz; | |||
|
627 | } | |||
|
628 | ||||
|
629 | qint64 ElfFile::getSectionDatasz(int index) | |||
|
630 | { | |||
|
631 | int64_t DataSz=0; | |||
|
632 | if(this->e!=NULL) | |||
|
633 | { | |||
|
634 | if(index < this->sections.count()) | |||
|
635 | { | |||
|
636 | DataSz = (int64_t)this->sections.at(index)->data->d_size; | |||
|
637 | } | |||
|
638 | } | |||
|
639 | return DataSz; | |||
|
640 | } | |||
|
641 | ||||
|
642 | bool ElfFile::getSectionData(int index, char **buffer) | |||
|
643 | { | |||
|
644 | if(this->e!=NULL) | |||
|
645 | { | |||
|
646 | if(index < this->sections.count()) | |||
|
647 | { | |||
|
648 | *buffer = (char *)this->sections.at(index)->data->d_buf; | |||
|
649 | return true; | |||
|
650 | } | |||
|
651 | } | |||
|
652 | return false; | |||
|
653 | } | |||
|
654 | ||||
|
655 | ||||
|
656 | qint64 ElfFile::getSegmentMemsz(int index) | |||
|
657 | { | |||
|
658 | int64_t MemSz=0; | |||
|
659 | if(this->e!=NULL) | |||
|
660 | { | |||
|
661 | if(index < this->Segments.count()) | |||
|
662 | { | |||
|
663 | MemSz = (int64_t)this->Segments.at(index)->p_memsz; | |||
|
664 | } | |||
|
665 | } | |||
|
666 | return MemSz; | |||
|
667 | } | |||
|
668 | ||||
|
669 | qint64 ElfFile::getSectionMemsz(int index) | |||
|
670 | { | |||
|
671 | int64_t MemSz=0; | |||
|
672 | if(this->e!=NULL) | |||
|
673 | { | |||
|
674 | if(index < this->sections.count()) | |||
|
675 | { | |||
|
676 | MemSz = (int64_t)this->sections.at(index)->section_header->sh_size; | |||
|
677 | } | |||
|
678 | } | |||
|
679 | return MemSz; | |||
|
680 | } | |||
|
681 | ||||
|
682 | ||||
|
683 | QString ElfFile::getSegmentFlags(int index) | |||
|
684 | { | |||
|
685 | QString flags(""); | |||
|
686 | if(this->e!=NULL) | |||
|
687 | { | |||
|
688 | if(index < this->Segments.count()) | |||
|
689 | { | |||
|
690 | if((this->Segments.at(index)->p_flags&PF_X) == PF_X)flags+="x"; | |||
|
691 | if((this->Segments.at(index)->p_flags&PF_W) == PF_W)flags+="w"; | |||
|
692 | if((this->Segments.at(index)->p_flags&PF_R) == PF_R)flags+="r"; | |||
|
693 | if((this->Segments.at(index)->p_flags&PF_MASKOS) == PF_MASKOS)flags+=" OS-specific"; | |||
|
694 | if((this->Segments.at(index)->p_flags&PF_MASKPROC) == PF_MASKPROC)flags+=" Processor-specific"; | |||
|
695 | } | |||
|
696 | } | |||
|
697 | return flags; | |||
|
698 | } | |||
|
699 | ||||
|
700 | ||||
|
701 | QString ElfFile::getSectionName(int index) | |||
|
702 | { | |||
|
703 | char* nameChr = elf_strptr(this->e , this->shstrndx , this->sections.at(index)->section_header->sh_name); | |||
|
704 | return QString(nameChr); | |||
|
705 | } | |||
|
706 | ||||
|
707 | ||||
|
708 | void ElfFile::updateSections() | |||
|
709 | { | |||
|
710 | for(int i=0;i<this->sections.count();i++) | |||
|
711 | { | |||
|
712 | delete this->sections.at(i); | |||
|
713 | } | |||
|
714 | this->sections.clear(); | |||
|
715 | this->scn = elf_nextscn (this->e , NULL ); | |||
|
716 | this->SectionCount = 0; | |||
|
717 | while( this->scn != NULL ) | |||
|
718 | { | |||
|
719 | GElf_Shdr* shdr = (GElf_Shdr*)malloc(sizeof(GElf_Shdr)); | |||
|
720 | gelf_getshdr ( this->scn , shdr ); | |||
|
721 | Elf_Data* data = elf_getdata(this->scn, NULL); | |||
|
722 | this->sections.append(new Elf_Section(data,shdr)); | |||
|
723 | this->SectionCount+=1; | |||
|
724 | this->scn = elf_nextscn(e , scn); | |||
|
725 | } | |||
|
726 | } | |||
|
727 | ||||
|
728 | ||||
|
729 | void ElfFile::updateSegments() | |||
|
730 | { | |||
|
731 | elf_getphdrnum (this->e , &this->SegmentCount); | |||
|
732 | for(int i=0;i<this->Segments.count();i++) | |||
|
733 | { | |||
|
734 | free(this->Segments.at(i)); | |||
|
735 | } | |||
|
736 | this->Segments.clear(); | |||
|
737 | for(int i=0;i<this->SegmentCount;i++) | |||
|
738 | { | |||
|
739 | GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr)); | |||
|
740 | gelf_getphdr (this->e , i , header ); | |||
|
741 | this->Segments.append(header); | |||
|
742 | } | |||
|
743 | } | |||
95 |
|
744 | |||
96 |
|
745 | |||
97 |
|
746 | |||
98 |
|
747 | |||
99 |
|
748 | |||
|
749 | QString ElfFile::getSectionType(int index) | |||
|
750 | { | |||
|
751 | QString type(""); | |||
|
752 | if(this->e!=NULL) | |||
|
753 | { | |||
|
754 | if(index < this->Segments.count()) | |||
|
755 | { | |||
|
756 | switch(this->Segments.at(index)->p_type) | |||
|
757 | { | |||
|
758 | case SHT_NULL : type = "Section header table entry unused"; break; | |||
|
759 | case SHT_PROGBITS : type = "Program data"; break; | |||
|
760 | case SHT_SYMTAB : type = "Symbol table"; break; | |||
|
761 | case SHT_STRTAB : type = "String table"; break; | |||
|
762 | case SHT_RELA : type = "Relocation entries with addends"; break; | |||
|
763 | case SHT_HASH : type = "Symbol hash table"; break; | |||
|
764 | case SHT_DYNAMIC : type = "Dynamic linking information"; break; | |||
|
765 | case SHT_NOTE : type = "Notes"; break; | |||
|
766 | case SHT_NOBITS :type = "Program space with no data (bss)"; break; | |||
|
767 | case SHT_REL :type = "Relocation entries, no addends"; break; | |||
|
768 | case SHT_SHLIB : type = "Reserved"; break; | |||
|
769 | case SHT_DYNSYM : type = "Dynamic linker symbol table"; break; | |||
|
770 | case SHT_INIT_ARRAY : type = "Array of constructors"; break; | |||
|
771 | case SHT_FINI_ARRAY : type = "Array of destructors"; break; | |||
|
772 | case SHT_PREINIT_ARRAY : type = "Array of pre-constructors"; break; | |||
|
773 | case SHT_GROUP : type = "Section group"; break; | |||
|
774 | case SHT_SYMTAB_SHNDX : type = "Extended section indeces"; break; | |||
|
775 | case SHT_NUM : type = "Number of defined types. "; break; | |||
|
776 | case SHT_LOOS : type = "Start OS-specific. "; break; | |||
|
777 | case SHT_LOSUNW : type = "Sun-specific low bound. "; break; | |||
|
778 | case SHT_SUNW_COMDAT : type = " "; break; | |||
|
779 | case SHT_SUNW_syminfo : type = " "; break; | |||
|
780 | case SHT_GNU_verdef : type = "Version definition section. "; break; | |||
|
781 | case SHT_GNU_verneed : type = "Version needs section. "; break; | |||
|
782 | case SHT_GNU_versym : type = "Version symbol table. "; break; | |||
|
783 | case SHT_LOPROC : type = "Start of processor-specific"; break; | |||
|
784 | case SHT_HIPROC : type = "End of processor-specific"; break; | |||
|
785 | case SHT_HIUSER : type = "End of application-specific"; break; | |||
|
786 | } | |||
|
787 | } | |||
|
788 | } | |||
|
789 | return type; | |||
|
790 | } | |||
100 |
|
791 | |||
101 |
|
792 | bool ElfFile::isElf(const QString &File) | ||
|
793 | { | |||
|
794 | int file =0; | |||
|
795 | #ifdef _ELF_WINDOWS_ | |||
|
796 | file = open(File.toStdString().c_str(),O_RDONLY|O_BINARY ,0); | |||
|
797 | #else | |||
|
798 | file = open(File.toStdString().c_str(),O_RDONLY ,0); | |||
|
799 | #endif | |||
|
800 | char Magic[4]; | |||
|
801 | if(file!=-1) | |||
|
802 | { | |||
|
803 | read(file,Magic,4); | |||
|
804 | close(file); | |||
|
805 | if(Magic[0]==0x7f && Magic[1]==0x45 && Magic[2]==0x4c && Magic[3]==0x46) | |||
|
806 | { | |||
|
807 | return true; | |||
|
808 | } | |||
|
809 | } | |||
|
810 | return false; | |||
|
811 | } |
@@ -20,31 +20,82 | |||||
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include <abstractexecfile.h> |
|
22 | #include <abstractexecfile.h> | |
23 | #include <elf.h> |
|
23 | #include <QtCore/QObject> | |
24 | #include "elfparser.h" |
|
24 | #include <QtCore/QStringList> | |
25 | #include <QStringList> |
|
25 | #include <libelf.h> | |
26 |
|
26 | #include <gelf.h> | ||
|
27 | #include <sys/types.h> | |||
|
28 | #include <sys/stat.h> | |||
|
29 | #include <fcntl.h> | |||
|
30 | #include <unistd.h> | |||
27 | #ifndef ELFFILE_H |
|
31 | #ifndef ELFFILE_H | |
28 | #define ELFFILE_H |
|
32 | #define ELFFILE_H | |
29 |
|
33 | |||
30 | class ElfFile :public QObject, public abstractExecFile, public elfparser |
|
34 | class Elf_Section | |
31 | { |
|
35 | { | |
32 | Q_OBJECT |
|
|||
33 | public: |
|
36 | public: | |
34 | ElfFile(QObject *parent = 0); |
|
37 | Elf_Section(){} | |
35 | ElfFile(const QString& File,QObject *parent = 0); |
|
38 | Elf_Section(Elf_Data* data,GElf_Shdr* section_header) | |
|
39 | { | |||
|
40 | this->data = data; | |||
|
41 | this->section_header = section_header; | |||
|
42 | } | |||
|
43 | Elf_Data* data; | |||
|
44 | GElf_Shdr* section_header; | |||
|
45 | }; | |||
|
46 | ||||
|
47 | class ElfFile : public abstractExecFile | |||
|
48 | { | |||
|
49 | Q_OBJECT | |||
|
50 | public: | |||
|
51 | ElfFile(); | |||
|
52 | ElfFile(const QString& File); | |||
36 | bool openFile(const QString& File); |
|
53 | bool openFile(const QString& File); | |
37 | bool isopened(); |
|
54 | bool isopened(); | |
38 | int closeFile(); |
|
55 | int closeFile(); | |
39 | QList<codeFragment> getFragments(); |
|
56 | QList<codeFragment*> getFragments(); | |
40 | QList<codeFragment> getFragments(QStringList fragmentList); |
|
57 | QList<codeFragment*> getFragments(QStringList fragmentList); | |
41 | // elfparser parser; |
|
|||
42 |
|
58 | |||
43 | signals: |
|
59 | QString getClass(); | |
|
60 | QString getArchitecture(); | |||
|
61 | QString getType(); | |||
|
62 | QString getEndianness(); | |||
|
63 | QString getABI(); | |||
|
64 | qint64 getVersion(); | |||
|
65 | qint64 getEntryPointAddress(); | |||
|
66 | int getSectioncount(); | |||
|
67 | int getSegmentcount(); | |||
|
68 | QString getSegmentType(int index); | |||
|
69 | qint64 getSegmentOffset(int index); | |||
|
70 | qint64 getSegmentVaddr(int index); | |||
|
71 | qint64 getSegmentPaddr(int index); | |||
|
72 | qint64 getSectionPaddr(int index); | |||
|
73 | qint64 getSegmentFilesz(int index); | |||
|
74 | qint64 getSectionDatasz(int index); | |||
|
75 | bool getSectionData(int index, char **buffer); | |||
|
76 | qint64 getSegmentMemsz(int index); | |||
|
77 | qint64 getSectionMemsz(int index); | |||
|
78 | QString getSegmentFlags(int index); | |||
|
79 | QString getSectionName(int index); | |||
|
80 | QString getSectionType(int index); | |||
|
81 | bool iself(); | |||
|
82 | static bool isElf(const QString& File); | |||
44 |
|
83 | |||
45 | public slots: |
|
|||
46 | private: |
|
84 | private: | |
47 | codeFragment getFragment(const QString& name); |
|
85 | codeFragment* getFragment(const QString& name); | |
|
86 | void updateSections(); | |||
|
87 | void updateSegments(); | |||
|
88 | int elfFile; | |||
|
89 | bool opened; | |||
|
90 | bool type_elf; | |||
|
91 | Elf* e; | |||
|
92 | Elf_Kind ek; | |||
|
93 | GElf_Ehdr ehdr; | |||
|
94 | Elf_Scn * scn; | |||
|
95 | Elf_Data * data; | |||
|
96 | size_t SectionCount,SegmentCount, shstrndx; | |||
|
97 | QList<GElf_Phdr*> Segments; | |||
|
98 | QList<Elf_Section*> sections; | |||
48 |
|
99 | |||
49 | }; |
|
100 | }; | |
50 |
|
101 |
@@ -1,7 +1,7 | |||||
1 | #ifndef ELFFILEWIDGET_H |
|
1 | #ifndef ELFFILEWIDGET_H | |
2 | #define ELFFILEWIDGET_H |
|
2 | #define ELFFILEWIDGET_H | |
3 |
|
3 | |||
4 | #include <QWidget> |
|
4 | #include <QtWidgets/QWidget> | |
5 | #include "elffile.h" |
|
5 | #include "elffile.h" | |
6 |
|
6 | |||
7 | namespace Ui { |
|
7 | namespace Ui { | |
@@ -13,8 +13,9 class elfFileWidget : public QWidget | |||||
13 | Q_OBJECT |
|
13 | Q_OBJECT | |
14 |
|
14 | |||
15 | public: |
|
15 | public: | |
16 |
|
|
16 | elfFileWidget(QWidget *parent = 0); | |
17 | ~elfFileWidget(); |
|
17 | ~elfFileWidget(); | |
|
18 | ||||
18 | public slots: |
|
19 | public slots: | |
19 | void updateElfFile(ElfFile* file); |
|
20 | void updateElfFile(ElfFile* file); | |
20 |
|
21 |
@@ -25,255 +25,7 | |||||
25 | #include <fcntl.h> |
|
25 | #include <fcntl.h> | |
26 | #include <unistd.h> |
|
26 | #include <unistd.h> | |
27 |
|
27 | |||
28 | QString elfresolveMachine(Elf64_Half e_machine) |
|
28 | extern QString elfresolveMachine(Elf64_Half e_machine); | |
29 | { |
|
|||
30 | QString machineName; |
|
|||
31 | //Update from with bash script don't write it by yourself! |
|
|||
32 | switch(e_machine) |
|
|||
33 | { |
|
|||
34 | case EM_NONE: |
|
|||
35 | machineName = " No machine "; |
|
|||
36 | break; |
|
|||
37 | case EM_M32: |
|
|||
38 | machineName = " AT&T WE 32100 "; |
|
|||
39 | break; |
|
|||
40 | case EM_SPARC: |
|
|||
41 | machineName = " SUN SPARC "; |
|
|||
42 | break; |
|
|||
43 | case EM_386: |
|
|||
44 | machineName = " Intel 80386 "; |
|
|||
45 | break; |
|
|||
46 | case EM_68K: |
|
|||
47 | machineName = " Motorola m68k family "; |
|
|||
48 | break; |
|
|||
49 | case EM_88K: |
|
|||
50 | machineName = " Motorola m88k family "; |
|
|||
51 | break; |
|
|||
52 | case EM_860: |
|
|||
53 | machineName = " Intel 80860 "; |
|
|||
54 | break; |
|
|||
55 | case EM_MIPS: |
|
|||
56 | machineName = " MIPS R3000 big-endian "; |
|
|||
57 | break; |
|
|||
58 | case EM_S370: |
|
|||
59 | machineName = " IBM System/370 "; |
|
|||
60 | break; |
|
|||
61 | case EM_MIPS_RS3_LE: |
|
|||
62 | machineName = " MIPS R3000 little-endian "; |
|
|||
63 | break; |
|
|||
64 | case EM_PARISC: |
|
|||
65 | machineName = " HPPA "; |
|
|||
66 | break; |
|
|||
67 | case EM_VPP500: |
|
|||
68 | machineName = " Fujitsu VPP500 "; |
|
|||
69 | break; |
|
|||
70 | case EM_SPARC32PLUS: |
|
|||
71 | machineName = " Sun's \"v8plus\" "; |
|
|||
72 | break; |
|
|||
73 | case EM_960: |
|
|||
74 | machineName = " Intel 80960 "; |
|
|||
75 | break; |
|
|||
76 | case EM_PPC: |
|
|||
77 | machineName = " PowerPC "; |
|
|||
78 | break; |
|
|||
79 | case EM_PPC64: |
|
|||
80 | machineName = " PowerPC 64-bit "; |
|
|||
81 | break; |
|
|||
82 | case EM_S390: |
|
|||
83 | machineName = " IBM S390 "; |
|
|||
84 | break; |
|
|||
85 | case EM_V800: |
|
|||
86 | machineName = " NEC V800 series "; |
|
|||
87 | break; |
|
|||
88 | case EM_FR20: |
|
|||
89 | machineName = " Fujitsu FR20 "; |
|
|||
90 | break; |
|
|||
91 | case EM_RH32: |
|
|||
92 | machineName = " TRW RH-32 "; |
|
|||
93 | break; |
|
|||
94 | case EM_RCE: |
|
|||
95 | machineName = " Motorola RCE "; |
|
|||
96 | break; |
|
|||
97 | case EM_ARM: |
|
|||
98 | machineName = " ARM "; |
|
|||
99 | break; |
|
|||
100 | case EM_FAKE_ALPHA: |
|
|||
101 | machineName = " Digital Alpha "; |
|
|||
102 | break; |
|
|||
103 | case EM_SH: |
|
|||
104 | machineName = " Hitachi SH "; |
|
|||
105 | break; |
|
|||
106 | case EM_SPARCV9: |
|
|||
107 | machineName = " SPARC v9 64-bit "; |
|
|||
108 | break; |
|
|||
109 | case EM_TRICORE: |
|
|||
110 | machineName = " Siemens Tricore "; |
|
|||
111 | break; |
|
|||
112 | case EM_ARC: |
|
|||
113 | machineName = " Argonaut RISC Core "; |
|
|||
114 | break; |
|
|||
115 | case EM_H8_300: |
|
|||
116 | machineName = " Hitachi H8/300 "; |
|
|||
117 | break; |
|
|||
118 | case EM_H8_300H: |
|
|||
119 | machineName = " Hitachi H8/300H "; |
|
|||
120 | break; |
|
|||
121 | case EM_H8S: |
|
|||
122 | machineName = " Hitachi H8S "; |
|
|||
123 | break; |
|
|||
124 | case EM_H8_500: |
|
|||
125 | machineName = " Hitachi H8/500 "; |
|
|||
126 | break; |
|
|||
127 | case EM_IA_64: |
|
|||
128 | machineName = " Intel Merced "; |
|
|||
129 | break; |
|
|||
130 | case EM_MIPS_X: |
|
|||
131 | machineName = " Stanford MIPS-X "; |
|
|||
132 | break; |
|
|||
133 | case EM_COLDFIRE: |
|
|||
134 | machineName = " Motorola Coldfire "; |
|
|||
135 | break; |
|
|||
136 | case EM_68HC12: |
|
|||
137 | machineName = " Motorola M68HC12 "; |
|
|||
138 | break; |
|
|||
139 | case EM_MMA: |
|
|||
140 | machineName = " Fujitsu MMA Multimedia Accelerator"; |
|
|||
141 | break; |
|
|||
142 | case EM_PCP: |
|
|||
143 | machineName = " Siemens PCP "; |
|
|||
144 | break; |
|
|||
145 | case EM_NCPU: |
|
|||
146 | machineName = " Sony nCPU embeeded RISC "; |
|
|||
147 | break; |
|
|||
148 | case EM_NDR1: |
|
|||
149 | machineName = " Denso NDR1 microprocessor "; |
|
|||
150 | break; |
|
|||
151 | case EM_STARCORE: |
|
|||
152 | machineName = " Motorola Start*Core processor "; |
|
|||
153 | break; |
|
|||
154 | case EM_ME16: |
|
|||
155 | machineName = " Toyota ME16 processor "; |
|
|||
156 | break; |
|
|||
157 | case EM_ST100: |
|
|||
158 | machineName = " STMicroelectronic ST100 processor "; |
|
|||
159 | break; |
|
|||
160 | case EM_TINYJ: |
|
|||
161 | machineName = " Advanced Logic Corp. Tinyj emb.fam"; |
|
|||
162 | break; |
|
|||
163 | case EM_X86_64: |
|
|||
164 | machineName = " AMD x86-64 architecture "; |
|
|||
165 | break; |
|
|||
166 | case EM_PDSP: |
|
|||
167 | machineName = " Sony DSP Processor "; |
|
|||
168 | break; |
|
|||
169 | case EM_FX66: |
|
|||
170 | machineName = " Siemens FX66 microcontroller "; |
|
|||
171 | break; |
|
|||
172 | case EM_ST9PLUS: |
|
|||
173 | machineName = " STMicroelectronics ST9+ 8/16 mc "; |
|
|||
174 | break; |
|
|||
175 | case EM_ST7: |
|
|||
176 | machineName = " STmicroelectronics ST7 8 bit mc "; |
|
|||
177 | break; |
|
|||
178 | case EM_68HC16: |
|
|||
179 | machineName = " Motorola MC68HC16 microcontroller "; |
|
|||
180 | break; |
|
|||
181 | case EM_68HC11: |
|
|||
182 | machineName = " Motorola MC68HC11 microcontroller "; |
|
|||
183 | break; |
|
|||
184 | case EM_68HC08: |
|
|||
185 | machineName = " Motorola MC68HC08 microcontroller "; |
|
|||
186 | break; |
|
|||
187 | case EM_68HC05: |
|
|||
188 | machineName = " Motorola MC68HC05 microcontroller "; |
|
|||
189 | break; |
|
|||
190 | case EM_SVX: |
|
|||
191 | machineName = " Silicon Graphics SVx "; |
|
|||
192 | break; |
|
|||
193 | case EM_ST19: |
|
|||
194 | machineName = " STMicroelectronics ST19 8 bit mc "; |
|
|||
195 | break; |
|
|||
196 | case EM_VAX: |
|
|||
197 | machineName = " Digital VAX "; |
|
|||
198 | break; |
|
|||
199 | case EM_CRIS: |
|
|||
200 | machineName = " Axis Communications 32-bit embedded processor "; |
|
|||
201 | break; |
|
|||
202 | case EM_JAVELIN: |
|
|||
203 | machineName = " Infineon Technologies 32-bit embedded processor "; |
|
|||
204 | break; |
|
|||
205 | case EM_FIREPATH: |
|
|||
206 | machineName = " Element 14 64-bit DSP Processor "; |
|
|||
207 | break; |
|
|||
208 | case EM_ZSP: |
|
|||
209 | machineName = " LSI Logic 16-bit DSP Processor "; |
|
|||
210 | break; |
|
|||
211 | case EM_MMIX: |
|
|||
212 | machineName = " Donald Knuth's educational 64-bit processor "; |
|
|||
213 | break; |
|
|||
214 | case EM_HUANY: |
|
|||
215 | machineName = " Harvard University machine-independent object files "; |
|
|||
216 | break; |
|
|||
217 | case EM_PRISM: |
|
|||
218 | machineName = " SiTera Prism "; |
|
|||
219 | break; |
|
|||
220 | case EM_AVR: |
|
|||
221 | machineName = " Atmel AVR 8-bit microcontroller "; |
|
|||
222 | break; |
|
|||
223 | case EM_FR30: |
|
|||
224 | machineName = " Fujitsu FR30 "; |
|
|||
225 | break; |
|
|||
226 | case EM_D10V: |
|
|||
227 | machineName = " Mitsubishi D10V "; |
|
|||
228 | break; |
|
|||
229 | case EM_D30V: |
|
|||
230 | machineName = " Mitsubishi D30V "; |
|
|||
231 | break; |
|
|||
232 | case EM_V850: |
|
|||
233 | machineName = " NEC v850 "; |
|
|||
234 | break; |
|
|||
235 | case EM_M32R: |
|
|||
236 | machineName = " Mitsubishi M32R "; |
|
|||
237 | break; |
|
|||
238 | case EM_MN10300: |
|
|||
239 | machineName = " Matsushita MN10300 "; |
|
|||
240 | break; |
|
|||
241 | case EM_MN10200: |
|
|||
242 | machineName = " Matsushita MN10200 "; |
|
|||
243 | break; |
|
|||
244 | case EM_PJ: |
|
|||
245 | machineName = " picoJava "; |
|
|||
246 | break; |
|
|||
247 | case EM_OPENRISC: |
|
|||
248 | machineName = " OpenRISC 32-bit embedded processor "; |
|
|||
249 | break; |
|
|||
250 | case EM_ARC_A5: |
|
|||
251 | machineName = " ARC Cores Tangent-A5 "; |
|
|||
252 | break; |
|
|||
253 | case EM_XTENSA: |
|
|||
254 | machineName = " Tensilica Xtensa Architecture "; |
|
|||
255 | break; |
|
|||
256 | case EM_AARCH64: |
|
|||
257 | machineName = " ARM AARCH64 "; |
|
|||
258 | break; |
|
|||
259 | case EM_TILEPRO: |
|
|||
260 | machineName = " Tilera TILEPro "; |
|
|||
261 | break; |
|
|||
262 | case EM_MICROBLAZE: |
|
|||
263 | machineName = " Xilinx MicroBlaze "; |
|
|||
264 | break; |
|
|||
265 | case EM_TILEGX: |
|
|||
266 | machineName = " Tilera TILE-Gx "; |
|
|||
267 | break; |
|
|||
268 | case EM_NUM: |
|
|||
269 | machineName = ""; |
|
|||
270 | break; |
|
|||
271 | default: |
|
|||
272 | machineName ="Unknow Machine"; |
|
|||
273 | break; |
|
|||
274 | } |
|
|||
275 | return machineName; |
|
|||
276 | } |
|
|||
277 |
|
29 | |||
278 |
|
30 | |||
279 | elfparser::elfparser() |
|
31 | elfparser::elfparser() | |
@@ -420,7 +172,7 QString elfparser::getABI() | |||||
420 | } |
|
172 | } | |
421 |
|
173 | |||
422 |
|
174 | |||
423 |
qint |
|
175 | qint64 elfparser::getVersion() | |
424 | { |
|
176 | { | |
425 | if(this->e!=NULL) |
|
177 | if(this->e!=NULL) | |
426 | { |
|
178 | { |
@@ -27,19 +27,7 | |||||
27 | #include <stdio.h> |
|
27 | #include <stdio.h> | |
28 | #include <QList> |
|
28 | #include <QList> | |
29 | #include <stdint.h> |
|
29 | #include <stdint.h> | |
30 |
|
30 | #include "elffile.h" | ||
31 | class Elf_Section |
|
|||
32 | { |
|
|||
33 | public: |
|
|||
34 | Elf_Section(){} |
|
|||
35 | Elf_Section(Elf_Data* data,GElf_Shdr* section_header) |
|
|||
36 | { |
|
|||
37 | this->data = data; |
|
|||
38 | this->section_header = section_header; |
|
|||
39 | } |
|
|||
40 | Elf_Data* data; |
|
|||
41 | GElf_Shdr* section_header; |
|
|||
42 | }; |
|
|||
43 |
|
31 | |||
44 | class elfparser |
|
32 | class elfparser | |
45 | { |
|
33 | { | |
@@ -54,7 +42,7 public: | |||||
54 | QString getType(); |
|
42 | QString getType(); | |
55 | QString getEndianness(); |
|
43 | QString getEndianness(); | |
56 | QString getABI(); |
|
44 | QString getABI(); | |
57 |
qint |
|
45 | qint64 getVersion(); | |
58 | qint64 getEntryPointAddress(); |
|
46 | qint64 getEntryPointAddress(); | |
59 | int getSectioncount(); |
|
47 | int getSectioncount(); | |
60 | int getSegmentcount(); |
|
48 | int getSegmentcount(); |
@@ -3,29 +3,277 | |||||
3 | #include <PythonQtMethodInfo.h> |
|
3 | #include <PythonQtMethodInfo.h> | |
4 | #include <PythonQtSignalReceiver.h> |
|
4 | #include <PythonQtSignalReceiver.h> | |
5 | #include <QVariant> |
|
5 | #include <QVariant> | |
|
6 | #include <abstractexecfile.h> | |||
6 | #include <elffile.h> |
|
7 | #include <elffile.h> | |
|
8 | #include <elfparser.h> | |||
7 |
|
9 | |||
8 | ElfFile* PythonQtWrapper_ElfFile::new_ElfFile(QObject* parent) |
|
10 | PythonQtShell_ElfFile::~PythonQtShell_ElfFile() { | |
|
11 | PythonQtPrivate* priv = PythonQt::priv(); | |||
|
12 | if (priv) { priv->shellClassDeleted(this); } | |||
|
13 | } | |||
|
14 | int PythonQtShell_ElfFile::closeFile() | |||
|
15 | { | |||
|
16 | if (_wrapper) { | |||
|
17 | PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "closeFile"); | |||
|
18 | PyErr_Clear(); | |||
|
19 | if (obj && !PythonQtSlotFunction_Check(obj)) { | |||
|
20 | static const char* argumentList[] ={"int"}; | |||
|
21 | static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(1, argumentList); | |||
|
22 | int returnValue; | |||
|
23 | void* args[1] = {NULL}; | |||
|
24 | PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true); | |||
|
25 | if (result) { | |||
|
26 | args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue); | |||
|
27 | if (args[0]!=&returnValue) { | |||
|
28 | if (args[0]==NULL) { | |||
|
29 | PythonQt::priv()->handleVirtualOverloadReturnError("closeFile", methodInfo, result); | |||
|
30 | } else { | |||
|
31 | returnValue = *((int*)args[0]); | |||
|
32 | } | |||
|
33 | } | |||
|
34 | } | |||
|
35 | if (result) { Py_DECREF(result); } | |||
|
36 | Py_DECREF(obj); | |||
|
37 | return returnValue; | |||
|
38 | } | |||
|
39 | } | |||
|
40 | return ElfFile::closeFile(); | |||
|
41 | } | |||
|
42 | QList<codeFragment* > PythonQtShell_ElfFile::getFragments() | |||
|
43 | { | |||
|
44 | if (_wrapper) { | |||
|
45 | PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "getFragments"); | |||
|
46 | PyErr_Clear(); | |||
|
47 | if (obj && !PythonQtSlotFunction_Check(obj)) { | |||
|
48 | static const char* argumentList[] ={"QList<codeFragment* >"}; | |||
|
49 | static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(1, argumentList); | |||
|
50 | QList<codeFragment* > returnValue; | |||
|
51 | void* args[1] = {NULL}; | |||
|
52 | PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true); | |||
|
53 | if (result) { | |||
|
54 | args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue); | |||
|
55 | if (args[0]!=&returnValue) { | |||
|
56 | if (args[0]==NULL) { | |||
|
57 | PythonQt::priv()->handleVirtualOverloadReturnError("getFragments", methodInfo, result); | |||
|
58 | } else { | |||
|
59 | returnValue = *((QList<codeFragment* >*)args[0]); | |||
|
60 | } | |||
|
61 | } | |||
|
62 | } | |||
|
63 | if (result) { Py_DECREF(result); } | |||
|
64 | Py_DECREF(obj); | |||
|
65 | return returnValue; | |||
|
66 | } | |||
|
67 | } | |||
|
68 | return ElfFile::getFragments(); | |||
|
69 | } | |||
|
70 | bool PythonQtShell_ElfFile::isopened() | |||
|
71 | { | |||
|
72 | if (_wrapper) { | |||
|
73 | PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "isopened"); | |||
|
74 | PyErr_Clear(); | |||
|
75 | if (obj && !PythonQtSlotFunction_Check(obj)) { | |||
|
76 | static const char* argumentList[] ={"bool"}; | |||
|
77 | static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(1, argumentList); | |||
|
78 | bool returnValue; | |||
|
79 | void* args[1] = {NULL}; | |||
|
80 | PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true); | |||
|
81 | if (result) { | |||
|
82 | args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue); | |||
|
83 | if (args[0]!=&returnValue) { | |||
|
84 | if (args[0]==NULL) { | |||
|
85 | PythonQt::priv()->handleVirtualOverloadReturnError("isopened", methodInfo, result); | |||
|
86 | } else { | |||
|
87 | returnValue = *((bool*)args[0]); | |||
|
88 | } | |||
|
89 | } | |||
|
90 | } | |||
|
91 | if (result) { Py_DECREF(result); } | |||
|
92 | Py_DECREF(obj); | |||
|
93 | return returnValue; | |||
|
94 | } | |||
|
95 | } | |||
|
96 | return ElfFile::isopened(); | |||
|
97 | } | |||
|
98 | bool PythonQtShell_ElfFile::openFile(const QString& File) | |||
|
99 | { | |||
|
100 | if (_wrapper) { | |||
|
101 | PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "openFile"); | |||
|
102 | PyErr_Clear(); | |||
|
103 | if (obj && !PythonQtSlotFunction_Check(obj)) { | |||
|
104 | static const char* argumentList[] ={"bool" , "const QString&"}; | |||
|
105 | static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(2, argumentList); | |||
|
106 | bool returnValue; | |||
|
107 | void* args[2] = {NULL, (void*)&File}; | |||
|
108 | PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true); | |||
|
109 | if (result) { | |||
|
110 | args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue); | |||
|
111 | if (args[0]!=&returnValue) { | |||
|
112 | if (args[0]==NULL) { | |||
|
113 | PythonQt::priv()->handleVirtualOverloadReturnError("openFile", methodInfo, result); | |||
|
114 | } else { | |||
|
115 | returnValue = *((bool*)args[0]); | |||
|
116 | } | |||
|
117 | } | |||
|
118 | } | |||
|
119 | if (result) { Py_DECREF(result); } | |||
|
120 | Py_DECREF(obj); | |||
|
121 | return returnValue; | |||
|
122 | } | |||
|
123 | } | |||
|
124 | return ElfFile::openFile(File); | |||
|
125 | } | |||
|
126 | ElfFile* PythonQtWrapper_ElfFile::new_ElfFile() | |||
9 | { |
|
127 | { | |
10 |
return new ElfFile( |
|
128 | return new PythonQtShell_ElfFile(); } | |
11 |
|
129 | |||
12 |
ElfFile* PythonQtWrapper_ElfFile::new_ElfFile(const QString& File |
|
130 | ElfFile* PythonQtWrapper_ElfFile::new_ElfFile(const QString& File) | |
13 | { |
|
131 | { | |
14 |
return new ElfFile(File |
|
132 | return new PythonQtShell_ElfFile(File); } | |
15 |
|
133 | |||
16 | int PythonQtWrapper_ElfFile::closeFile(ElfFile* theWrappedObject) |
|
134 | int PythonQtWrapper_ElfFile::closeFile(ElfFile* theWrappedObject) | |
17 | { |
|
135 | { | |
18 | return ( theWrappedObject->closeFile()); |
|
136 | return ( ((PythonQtPublicPromoter_ElfFile*)theWrappedObject)->promoted_closeFile()); | |
|
137 | } | |||
|
138 | ||||
|
139 | QString PythonQtWrapper_ElfFile::getABI(ElfFile* theWrappedObject) | |||
|
140 | { | |||
|
141 | return ( theWrappedObject->getABI()); | |||
|
142 | } | |||
|
143 | ||||
|
144 | QString PythonQtWrapper_ElfFile::getArchitecture(ElfFile* theWrappedObject) | |||
|
145 | { | |||
|
146 | return ( theWrappedObject->getArchitecture()); | |||
|
147 | } | |||
|
148 | ||||
|
149 | QString PythonQtWrapper_ElfFile::getClass(ElfFile* theWrappedObject) | |||
|
150 | { | |||
|
151 | return ( theWrappedObject->getClass()); | |||
|
152 | } | |||
|
153 | ||||
|
154 | QString PythonQtWrapper_ElfFile::getEndianness(ElfFile* theWrappedObject) | |||
|
155 | { | |||
|
156 | return ( theWrappedObject->getEndianness()); | |||
|
157 | } | |||
|
158 | ||||
|
159 | qint64 PythonQtWrapper_ElfFile::getEntryPointAddress(ElfFile* theWrappedObject) | |||
|
160 | { | |||
|
161 | return ( theWrappedObject->getEntryPointAddress()); | |||
|
162 | } | |||
|
163 | ||||
|
164 | QList<codeFragment* > PythonQtWrapper_ElfFile::getFragments(ElfFile* theWrappedObject) | |||
|
165 | { | |||
|
166 | return ( ((PythonQtPublicPromoter_ElfFile*)theWrappedObject)->promoted_getFragments()); | |||
|
167 | } | |||
|
168 | ||||
|
169 | QList<codeFragment* > PythonQtWrapper_ElfFile::getFragments(ElfFile* theWrappedObject, QStringList fragmentList) | |||
|
170 | { | |||
|
171 | return ( theWrappedObject->getFragments(fragmentList)); | |||
|
172 | } | |||
|
173 | ||||
|
174 | bool PythonQtWrapper_ElfFile::getSectionData(ElfFile* theWrappedObject, int index, char** buffer) | |||
|
175 | { | |||
|
176 | return ( theWrappedObject->getSectionData(index, buffer)); | |||
|
177 | } | |||
|
178 | ||||
|
179 | qint64 PythonQtWrapper_ElfFile::getSectionDatasz(ElfFile* theWrappedObject, int index) | |||
|
180 | { | |||
|
181 | return ( theWrappedObject->getSectionDatasz(index)); | |||
|
182 | } | |||
|
183 | ||||
|
184 | qint64 PythonQtWrapper_ElfFile::getSectionMemsz(ElfFile* theWrappedObject, int index) | |||
|
185 | { | |||
|
186 | return ( theWrappedObject->getSectionMemsz(index)); | |||
|
187 | } | |||
|
188 | ||||
|
189 | QString PythonQtWrapper_ElfFile::getSectionName(ElfFile* theWrappedObject, int index) | |||
|
190 | { | |||
|
191 | return ( theWrappedObject->getSectionName(index)); | |||
|
192 | } | |||
|
193 | ||||
|
194 | qint64 PythonQtWrapper_ElfFile::getSectionPaddr(ElfFile* theWrappedObject, int index) | |||
|
195 | { | |||
|
196 | return ( theWrappedObject->getSectionPaddr(index)); | |||
|
197 | } | |||
|
198 | ||||
|
199 | QString PythonQtWrapper_ElfFile::getSectionType(ElfFile* theWrappedObject, int index) | |||
|
200 | { | |||
|
201 | return ( theWrappedObject->getSectionType(index)); | |||
|
202 | } | |||
|
203 | ||||
|
204 | int PythonQtWrapper_ElfFile::getSectioncount(ElfFile* theWrappedObject) | |||
|
205 | { | |||
|
206 | return ( theWrappedObject->getSectioncount()); | |||
|
207 | } | |||
|
208 | ||||
|
209 | qint64 PythonQtWrapper_ElfFile::getSegmentFilesz(ElfFile* theWrappedObject, int index) | |||
|
210 | { | |||
|
211 | return ( theWrappedObject->getSegmentFilesz(index)); | |||
|
212 | } | |||
|
213 | ||||
|
214 | QString PythonQtWrapper_ElfFile::getSegmentFlags(ElfFile* theWrappedObject, int index) | |||
|
215 | { | |||
|
216 | return ( theWrappedObject->getSegmentFlags(index)); | |||
|
217 | } | |||
|
218 | ||||
|
219 | qint64 PythonQtWrapper_ElfFile::getSegmentMemsz(ElfFile* theWrappedObject, int index) | |||
|
220 | { | |||
|
221 | return ( theWrappedObject->getSegmentMemsz(index)); | |||
|
222 | } | |||
|
223 | ||||
|
224 | qint64 PythonQtWrapper_ElfFile::getSegmentOffset(ElfFile* theWrappedObject, int index) | |||
|
225 | { | |||
|
226 | return ( theWrappedObject->getSegmentOffset(index)); | |||
|
227 | } | |||
|
228 | ||||
|
229 | qint64 PythonQtWrapper_ElfFile::getSegmentPaddr(ElfFile* theWrappedObject, int index) | |||
|
230 | { | |||
|
231 | return ( theWrappedObject->getSegmentPaddr(index)); | |||
|
232 | } | |||
|
233 | ||||
|
234 | QString PythonQtWrapper_ElfFile::getSegmentType(ElfFile* theWrappedObject, int index) | |||
|
235 | { | |||
|
236 | return ( theWrappedObject->getSegmentType(index)); | |||
|
237 | } | |||
|
238 | ||||
|
239 | qint64 PythonQtWrapper_ElfFile::getSegmentVaddr(ElfFile* theWrappedObject, int index) | |||
|
240 | { | |||
|
241 | return ( theWrappedObject->getSegmentVaddr(index)); | |||
|
242 | } | |||
|
243 | ||||
|
244 | int PythonQtWrapper_ElfFile::getSegmentcount(ElfFile* theWrappedObject) | |||
|
245 | { | |||
|
246 | return ( theWrappedObject->getSegmentcount()); | |||
|
247 | } | |||
|
248 | ||||
|
249 | QString PythonQtWrapper_ElfFile::getType(ElfFile* theWrappedObject) | |||
|
250 | { | |||
|
251 | return ( theWrappedObject->getType()); | |||
|
252 | } | |||
|
253 | ||||
|
254 | qint64 PythonQtWrapper_ElfFile::getVersion(ElfFile* theWrappedObject) | |||
|
255 | { | |||
|
256 | return ( theWrappedObject->getVersion()); | |||
|
257 | } | |||
|
258 | ||||
|
259 | bool PythonQtWrapper_ElfFile::static_ElfFile_isElf(const QString& File) | |||
|
260 | { | |||
|
261 | return (ElfFile::isElf(File)); | |||
|
262 | } | |||
|
263 | ||||
|
264 | bool PythonQtWrapper_ElfFile::iself(ElfFile* theWrappedObject) | |||
|
265 | { | |||
|
266 | return ( theWrappedObject->iself()); | |||
19 | } |
|
267 | } | |
20 |
|
268 | |||
21 | bool PythonQtWrapper_ElfFile::isopened(ElfFile* theWrappedObject) |
|
269 | bool PythonQtWrapper_ElfFile::isopened(ElfFile* theWrappedObject) | |
22 | { |
|
270 | { | |
23 | return ( theWrappedObject->isopened()); |
|
271 | return ( ((PythonQtPublicPromoter_ElfFile*)theWrappedObject)->promoted_isopened()); | |
24 | } |
|
272 | } | |
25 |
|
273 | |||
26 | bool PythonQtWrapper_ElfFile::openFile(ElfFile* theWrappedObject, const QString& File) |
|
274 | bool PythonQtWrapper_ElfFile::openFile(ElfFile* theWrappedObject, const QString& File) | |
27 | { |
|
275 | { | |
28 | return ( theWrappedObject->openFile(File)); |
|
276 | return ( ((PythonQtPublicPromoter_ElfFile*)theWrappedObject)->promoted_openFile(File)); | |
29 | } |
|
277 | } | |
30 |
|
278 | |||
31 |
|
279 | |||
@@ -473,12 +721,150 QString PythonQtWrapper_XByteArray::toR | |||||
473 |
|
721 | |||
474 |
|
722 | |||
475 |
|
723 | |||
|
724 | PythonQtShell_abstractExecFile::~PythonQtShell_abstractExecFile() { | |||
|
725 | PythonQtPrivate* priv = PythonQt::priv(); | |||
|
726 | if (priv) { priv->shellClassDeleted(this); } | |||
|
727 | } | |||
|
728 | int PythonQtShell_abstractExecFile::closeFile() | |||
|
729 | { | |||
|
730 | if (_wrapper) { | |||
|
731 | PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "closeFile"); | |||
|
732 | PyErr_Clear(); | |||
|
733 | if (obj && !PythonQtSlotFunction_Check(obj)) { | |||
|
734 | static const char* argumentList[] ={"int"}; | |||
|
735 | static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(1, argumentList); | |||
|
736 | int returnValue; | |||
|
737 | void* args[1] = {NULL}; | |||
|
738 | PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true); | |||
|
739 | if (result) { | |||
|
740 | args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue); | |||
|
741 | if (args[0]!=&returnValue) { | |||
|
742 | if (args[0]==NULL) { | |||
|
743 | PythonQt::priv()->handleVirtualOverloadReturnError("closeFile", methodInfo, result); | |||
|
744 | } else { | |||
|
745 | returnValue = *((int*)args[0]); | |||
|
746 | } | |||
|
747 | } | |||
|
748 | } | |||
|
749 | if (result) { Py_DECREF(result); } | |||
|
750 | Py_DECREF(obj); | |||
|
751 | return returnValue; | |||
|
752 | } | |||
|
753 | } | |||
|
754 | return int(); | |||
|
755 | } | |||
|
756 | QList<codeFragment* > PythonQtShell_abstractExecFile::getFragments() | |||
|
757 | { | |||
|
758 | if (_wrapper) { | |||
|
759 | PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "getFragments"); | |||
|
760 | PyErr_Clear(); | |||
|
761 | if (obj && !PythonQtSlotFunction_Check(obj)) { | |||
|
762 | static const char* argumentList[] ={"QList<codeFragment* >"}; | |||
|
763 | static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(1, argumentList); | |||
|
764 | QList<codeFragment* > returnValue; | |||
|
765 | void* args[1] = {NULL}; | |||
|
766 | PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true); | |||
|
767 | if (result) { | |||
|
768 | args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue); | |||
|
769 | if (args[0]!=&returnValue) { | |||
|
770 | if (args[0]==NULL) { | |||
|
771 | PythonQt::priv()->handleVirtualOverloadReturnError("getFragments", methodInfo, result); | |||
|
772 | } else { | |||
|
773 | returnValue = *((QList<codeFragment* >*)args[0]); | |||
|
774 | } | |||
|
775 | } | |||
|
776 | } | |||
|
777 | if (result) { Py_DECREF(result); } | |||
|
778 | Py_DECREF(obj); | |||
|
779 | return returnValue; | |||
|
780 | } | |||
|
781 | } | |||
|
782 | return QList<codeFragment* >(); | |||
|
783 | } | |||
|
784 | bool PythonQtShell_abstractExecFile::isopened() | |||
|
785 | { | |||
|
786 | if (_wrapper) { | |||
|
787 | PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "isopened"); | |||
|
788 | PyErr_Clear(); | |||
|
789 | if (obj && !PythonQtSlotFunction_Check(obj)) { | |||
|
790 | static const char* argumentList[] ={"bool"}; | |||
|
791 | static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(1, argumentList); | |||
|
792 | bool returnValue; | |||
|
793 | void* args[1] = {NULL}; | |||
|
794 | PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true); | |||
|
795 | if (result) { | |||
|
796 | args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue); | |||
|
797 | if (args[0]!=&returnValue) { | |||
|
798 | if (args[0]==NULL) { | |||
|
799 | PythonQt::priv()->handleVirtualOverloadReturnError("isopened", methodInfo, result); | |||
|
800 | } else { | |||
|
801 | returnValue = *((bool*)args[0]); | |||
|
802 | } | |||
|
803 | } | |||
|
804 | } | |||
|
805 | if (result) { Py_DECREF(result); } | |||
|
806 | Py_DECREF(obj); | |||
|
807 | return returnValue; | |||
|
808 | } | |||
|
809 | } | |||
|
810 | return bool(); | |||
|
811 | } | |||
|
812 | bool PythonQtShell_abstractExecFile::openFile(const QString& File) | |||
|
813 | { | |||
|
814 | if (_wrapper) { | |||
|
815 | PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "openFile"); | |||
|
816 | PyErr_Clear(); | |||
|
817 | if (obj && !PythonQtSlotFunction_Check(obj)) { | |||
|
818 | static const char* argumentList[] ={"bool" , "const QString&"}; | |||
|
819 | static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(2, argumentList); | |||
|
820 | bool returnValue; | |||
|
821 | void* args[2] = {NULL, (void*)&File}; | |||
|
822 | PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true); | |||
|
823 | if (result) { | |||
|
824 | args[0] = PythonQtConv::ConvertPythonToQt(methodInfo->parameters().at(0), result, false, NULL, &returnValue); | |||
|
825 | if (args[0]!=&returnValue) { | |||
|
826 | if (args[0]==NULL) { | |||
|
827 | PythonQt::priv()->handleVirtualOverloadReturnError("openFile", methodInfo, result); | |||
|
828 | } else { | |||
|
829 | returnValue = *((bool*)args[0]); | |||
|
830 | } | |||
|
831 | } | |||
|
832 | } | |||
|
833 | if (result) { Py_DECREF(result); } | |||
|
834 | Py_DECREF(obj); | |||
|
835 | return returnValue; | |||
|
836 | } | |||
|
837 | } | |||
|
838 | return bool(); | |||
|
839 | } | |||
|
840 | abstractExecFile* PythonQtWrapper_abstractExecFile::new_abstractExecFile() | |||
|
841 | { | |||
|
842 | return new PythonQtShell_abstractExecFile(); } | |||
|
843 | ||||
|
844 | ||||
|
845 | ||||
|
846 | PythonQtShell_codeFragment::~PythonQtShell_codeFragment() { | |||
|
847 | PythonQtPrivate* priv = PythonQt::priv(); | |||
|
848 | if (priv) { priv->shellClassDeleted(this); } | |||
|
849 | } | |||
|
850 | codeFragment* PythonQtWrapper_codeFragment::new_codeFragment() | |||
|
851 | { | |||
|
852 | return new PythonQtShell_codeFragment(); } | |||
|
853 | ||||
|
854 | ||||
|
855 | ||||
476 | elfFileWidget* PythonQtWrapper_elfFileWidget::new_elfFileWidget(QWidget* parent) |
|
856 | elfFileWidget* PythonQtWrapper_elfFileWidget::new_elfFileWidget(QWidget* parent) | |
477 | { |
|
857 | { | |
478 | return new elfFileWidget(parent); } |
|
858 | return new elfFileWidget(parent); } | |
479 |
|
859 | |||
480 |
|
860 | |||
481 |
|
861 | |||
|
862 | elfInfoWdgt* PythonQtWrapper_elfInfoWdgt::new_elfInfoWdgt(QWidget* parent) | |||
|
863 | { | |||
|
864 | return new elfInfoWdgt(parent); } | |||
|
865 | ||||
|
866 | ||||
|
867 | ||||
482 | elfparser* PythonQtWrapper_elfparser::new_elfparser() |
|
868 | elfparser* PythonQtWrapper_elfparser::new_elfparser() | |
483 | { |
|
869 | { | |
484 | return new elfparser(); } |
|
870 | return new elfparser(); } | |
@@ -508,16 +894,36 QString PythonQtWrapper_elfparser::getE | |||||
508 | return ( theWrappedObject->getEndianness()); |
|
894 | return ( theWrappedObject->getEndianness()); | |
509 | } |
|
895 | } | |
510 |
|
896 | |||
|
897 | qint64 PythonQtWrapper_elfparser::getEntryPointAddress(elfparser* theWrappedObject) | |||
|
898 | { | |||
|
899 | return ( theWrappedObject->getEntryPointAddress()); | |||
|
900 | } | |||
|
901 | ||||
511 | bool PythonQtWrapper_elfparser::getSectionData(elfparser* theWrappedObject, int index, char** buffer) |
|
902 | bool PythonQtWrapper_elfparser::getSectionData(elfparser* theWrappedObject, int index, char** buffer) | |
512 | { |
|
903 | { | |
513 | return ( theWrappedObject->getSectionData(index, buffer)); |
|
904 | return ( theWrappedObject->getSectionData(index, buffer)); | |
514 | } |
|
905 | } | |
515 |
|
906 | |||
|
907 | qint64 PythonQtWrapper_elfparser::getSectionDatasz(elfparser* theWrappedObject, int index) | |||
|
908 | { | |||
|
909 | return ( theWrappedObject->getSectionDatasz(index)); | |||
|
910 | } | |||
|
911 | ||||
|
912 | qint64 PythonQtWrapper_elfparser::getSectionMemsz(elfparser* theWrappedObject, int index) | |||
|
913 | { | |||
|
914 | return ( theWrappedObject->getSectionMemsz(index)); | |||
|
915 | } | |||
|
916 | ||||
516 | QString PythonQtWrapper_elfparser::getSectionName(elfparser* theWrappedObject, int index) |
|
917 | QString PythonQtWrapper_elfparser::getSectionName(elfparser* theWrappedObject, int index) | |
517 | { |
|
918 | { | |
518 | return ( theWrappedObject->getSectionName(index)); |
|
919 | return ( theWrappedObject->getSectionName(index)); | |
519 | } |
|
920 | } | |
520 |
|
921 | |||
|
922 | qint64 PythonQtWrapper_elfparser::getSectionPaddr(elfparser* theWrappedObject, int index) | |||
|
923 | { | |||
|
924 | return ( theWrappedObject->getSectionPaddr(index)); | |||
|
925 | } | |||
|
926 | ||||
521 | QString PythonQtWrapper_elfparser::getSectionType(elfparser* theWrappedObject, int index) |
|
927 | QString PythonQtWrapper_elfparser::getSectionType(elfparser* theWrappedObject, int index) | |
522 | { |
|
928 | { | |
523 | return ( theWrappedObject->getSectionType(index)); |
|
929 | return ( theWrappedObject->getSectionType(index)); | |
@@ -528,16 +934,41 int PythonQtWrapper_elfparser::getSecti | |||||
528 | return ( theWrappedObject->getSectioncount()); |
|
934 | return ( theWrappedObject->getSectioncount()); | |
529 | } |
|
935 | } | |
530 |
|
936 | |||
|
937 | qint64 PythonQtWrapper_elfparser::getSegmentFilesz(elfparser* theWrappedObject, int index) | |||
|
938 | { | |||
|
939 | return ( theWrappedObject->getSegmentFilesz(index)); | |||
|
940 | } | |||
|
941 | ||||
531 | QString PythonQtWrapper_elfparser::getSegmentFlags(elfparser* theWrappedObject, int index) |
|
942 | QString PythonQtWrapper_elfparser::getSegmentFlags(elfparser* theWrappedObject, int index) | |
532 | { |
|
943 | { | |
533 | return ( theWrappedObject->getSegmentFlags(index)); |
|
944 | return ( theWrappedObject->getSegmentFlags(index)); | |
534 | } |
|
945 | } | |
535 |
|
946 | |||
|
947 | qint64 PythonQtWrapper_elfparser::getSegmentMemsz(elfparser* theWrappedObject, int index) | |||
|
948 | { | |||
|
949 | return ( theWrappedObject->getSegmentMemsz(index)); | |||
|
950 | } | |||
|
951 | ||||
|
952 | qint64 PythonQtWrapper_elfparser::getSegmentOffset(elfparser* theWrappedObject, int index) | |||
|
953 | { | |||
|
954 | return ( theWrappedObject->getSegmentOffset(index)); | |||
|
955 | } | |||
|
956 | ||||
|
957 | qint64 PythonQtWrapper_elfparser::getSegmentPaddr(elfparser* theWrappedObject, int index) | |||
|
958 | { | |||
|
959 | return ( theWrappedObject->getSegmentPaddr(index)); | |||
|
960 | } | |||
|
961 | ||||
536 | QString PythonQtWrapper_elfparser::getSegmentType(elfparser* theWrappedObject, int index) |
|
962 | QString PythonQtWrapper_elfparser::getSegmentType(elfparser* theWrappedObject, int index) | |
537 | { |
|
963 | { | |
538 | return ( theWrappedObject->getSegmentType(index)); |
|
964 | return ( theWrappedObject->getSegmentType(index)); | |
539 | } |
|
965 | } | |
540 |
|
966 | |||
|
967 | qint64 PythonQtWrapper_elfparser::getSegmentVaddr(elfparser* theWrappedObject, int index) | |||
|
968 | { | |||
|
969 | return ( theWrappedObject->getSegmentVaddr(index)); | |||
|
970 | } | |||
|
971 | ||||
541 | int PythonQtWrapper_elfparser::getSegmentcount(elfparser* theWrappedObject) |
|
972 | int PythonQtWrapper_elfparser::getSegmentcount(elfparser* theWrappedObject) | |
542 | { |
|
973 | { | |
543 | return ( theWrappedObject->getSegmentcount()); |
|
974 | return ( theWrappedObject->getSegmentcount()); | |
@@ -548,6 +979,11 QString PythonQtWrapper_elfparser::getT | |||||
548 | return ( theWrappedObject->getType()); |
|
979 | return ( theWrappedObject->getType()); | |
549 | } |
|
980 | } | |
550 |
|
981 | |||
|
982 | qint64 PythonQtWrapper_elfparser::getVersion(elfparser* theWrappedObject) | |||
|
983 | { | |||
|
984 | return ( theWrappedObject->getVersion()); | |||
|
985 | } | |||
|
986 | ||||
551 | bool PythonQtWrapper_elfparser::static_elfparser_isElf(const QString& File) |
|
987 | bool PythonQtWrapper_elfparser::static_elfparser_isElf(const QString& File) | |
552 | { |
|
988 | { | |
553 | return (elfparser::isElf(File)); |
|
989 | return (elfparser::isElf(File)); |
@@ -2,8 +2,10 | |||||
2 | #include <QObject> |
|
2 | #include <QObject> | |
3 | #include <QVariant> |
|
3 | #include <QVariant> | |
4 | #include <SocExplorerPlot.h> |
|
4 | #include <SocExplorerPlot.h> | |
|
5 | #include <abstractexecfile.h> | |||
5 | #include <elffile.h> |
|
6 | #include <elffile.h> | |
6 | #include <elffilewidget.h> |
|
7 | #include <elffilewidget.h> | |
|
8 | #include <elfinfowdgt.h> | |||
7 | #include <elfparser.h> |
|
9 | #include <elfparser.h> | |
8 | #include <memsizewdgt.h> |
|
10 | #include <memsizewdgt.h> | |
9 | #include <qhexedit.h> |
|
11 | #include <qhexedit.h> | |
@@ -13,14 +15,64 | |||||
13 |
|
15 | |||
14 |
|
16 | |||
15 |
|
17 | |||
|
18 | class PythonQtShell_ElfFile : public ElfFile | |||
|
19 | { | |||
|
20 | public: | |||
|
21 | PythonQtShell_ElfFile():ElfFile(),_wrapper(NULL) {}; | |||
|
22 | PythonQtShell_ElfFile(const QString& File):ElfFile(File),_wrapper(NULL) {}; | |||
|
23 | ||||
|
24 | ~PythonQtShell_ElfFile(); | |||
|
25 | ||||
|
26 | virtual int closeFile(); | |||
|
27 | virtual QList<codeFragment* > getFragments(); | |||
|
28 | virtual bool isopened(); | |||
|
29 | virtual bool openFile(const QString& File); | |||
|
30 | ||||
|
31 | PythonQtInstanceWrapper* _wrapper; | |||
|
32 | }; | |||
|
33 | ||||
|
34 | class PythonQtPublicPromoter_ElfFile : public ElfFile | |||
|
35 | { public: | |||
|
36 | inline int promoted_closeFile() { return ElfFile::closeFile(); } | |||
|
37 | inline QList<codeFragment* > promoted_getFragments() { return ElfFile::getFragments(); } | |||
|
38 | inline bool promoted_isopened() { return ElfFile::isopened(); } | |||
|
39 | inline bool promoted_openFile(const QString& File) { return ElfFile::openFile(File); } | |||
|
40 | }; | |||
|
41 | ||||
16 | class PythonQtWrapper_ElfFile : public QObject |
|
42 | class PythonQtWrapper_ElfFile : public QObject | |
17 | { Q_OBJECT |
|
43 | { Q_OBJECT | |
18 | public: |
|
44 | public: | |
19 | public slots: |
|
45 | public slots: | |
20 |
ElfFile* new_ElfFile( |
|
46 | ElfFile* new_ElfFile(); | |
21 |
ElfFile* new_ElfFile(const QString& File |
|
47 | ElfFile* new_ElfFile(const QString& File); | |
22 | void delete_ElfFile(ElfFile* obj) { delete obj; } |
|
48 | void delete_ElfFile(ElfFile* obj) { delete obj; } | |
23 | int closeFile(ElfFile* theWrappedObject); |
|
49 | int closeFile(ElfFile* theWrappedObject); | |
|
50 | QString getABI(ElfFile* theWrappedObject); | |||
|
51 | QString getArchitecture(ElfFile* theWrappedObject); | |||
|
52 | QString getClass(ElfFile* theWrappedObject); | |||
|
53 | QString getEndianness(ElfFile* theWrappedObject); | |||
|
54 | qint64 getEntryPointAddress(ElfFile* theWrappedObject); | |||
|
55 | QList<codeFragment* > getFragments(ElfFile* theWrappedObject); | |||
|
56 | QList<codeFragment* > getFragments(ElfFile* theWrappedObject, QStringList fragmentList); | |||
|
57 | bool getSectionData(ElfFile* theWrappedObject, int index, char** buffer); | |||
|
58 | qint64 getSectionDatasz(ElfFile* theWrappedObject, int index); | |||
|
59 | qint64 getSectionMemsz(ElfFile* theWrappedObject, int index); | |||
|
60 | QString getSectionName(ElfFile* theWrappedObject, int index); | |||
|
61 | qint64 getSectionPaddr(ElfFile* theWrappedObject, int index); | |||
|
62 | QString getSectionType(ElfFile* theWrappedObject, int index); | |||
|
63 | int getSectioncount(ElfFile* theWrappedObject); | |||
|
64 | qint64 getSegmentFilesz(ElfFile* theWrappedObject, int index); | |||
|
65 | QString getSegmentFlags(ElfFile* theWrappedObject, int index); | |||
|
66 | qint64 getSegmentMemsz(ElfFile* theWrappedObject, int index); | |||
|
67 | qint64 getSegmentOffset(ElfFile* theWrappedObject, int index); | |||
|
68 | qint64 getSegmentPaddr(ElfFile* theWrappedObject, int index); | |||
|
69 | QString getSegmentType(ElfFile* theWrappedObject, int index); | |||
|
70 | qint64 getSegmentVaddr(ElfFile* theWrappedObject, int index); | |||
|
71 | int getSegmentcount(ElfFile* theWrappedObject); | |||
|
72 | QString getType(ElfFile* theWrappedObject); | |||
|
73 | qint64 getVersion(ElfFile* theWrappedObject); | |||
|
74 | bool static_ElfFile_isElf(const QString& File); | |||
|
75 | bool iself(ElfFile* theWrappedObject); | |||
24 | bool isopened(ElfFile* theWrappedObject); |
|
76 | bool isopened(ElfFile* theWrappedObject); | |
25 | bool openFile(ElfFile* theWrappedObject, const QString& File); |
|
77 | bool openFile(ElfFile* theWrappedObject, const QString& File); | |
26 | }; |
|
78 | }; | |
@@ -203,6 +255,58 void delete_XByteArray(XByteArray* obj) | |||||
203 |
|
255 | |||
204 |
|
256 | |||
205 |
|
257 | |||
|
258 | class PythonQtShell_abstractExecFile : public abstractExecFile | |||
|
259 | { | |||
|
260 | public: | |||
|
261 | PythonQtShell_abstractExecFile():abstractExecFile(),_wrapper(NULL) {}; | |||
|
262 | ||||
|
263 | ~PythonQtShell_abstractExecFile(); | |||
|
264 | ||||
|
265 | virtual int closeFile(); | |||
|
266 | virtual QList<codeFragment* > getFragments(); | |||
|
267 | virtual bool isopened(); | |||
|
268 | virtual bool openFile(const QString& File); | |||
|
269 | ||||
|
270 | PythonQtInstanceWrapper* _wrapper; | |||
|
271 | }; | |||
|
272 | ||||
|
273 | class PythonQtWrapper_abstractExecFile : public QObject | |||
|
274 | { Q_OBJECT | |||
|
275 | public: | |||
|
276 | public slots: | |||
|
277 | abstractExecFile* new_abstractExecFile(); | |||
|
278 | void delete_abstractExecFile(abstractExecFile* obj) { delete obj; } | |||
|
279 | }; | |||
|
280 | ||||
|
281 | ||||
|
282 | ||||
|
283 | ||||
|
284 | ||||
|
285 | class PythonQtShell_codeFragment : public codeFragment | |||
|
286 | { | |||
|
287 | public: | |||
|
288 | PythonQtShell_codeFragment():codeFragment(),_wrapper(NULL) {}; | |||
|
289 | ||||
|
290 | ~PythonQtShell_codeFragment(); | |||
|
291 | ||||
|
292 | ||||
|
293 | PythonQtInstanceWrapper* _wrapper; | |||
|
294 | }; | |||
|
295 | ||||
|
296 | class PythonQtWrapper_codeFragment : public QObject | |||
|
297 | { Q_OBJECT | |||
|
298 | public: | |||
|
299 | public slots: | |||
|
300 | codeFragment* new_codeFragment(); | |||
|
301 | void delete_codeFragment(codeFragment* obj) { delete obj; } | |||
|
302 | void py_set_data(codeFragment* theWrappedObject, char* data){ theWrappedObject->data = data; } | |||
|
303 | char* py_get_data(codeFragment* theWrappedObject){ return theWrappedObject->data; } | |||
|
304 | }; | |||
|
305 | ||||
|
306 | ||||
|
307 | ||||
|
308 | ||||
|
309 | ||||
206 | class PythonQtWrapper_elfFileWidget : public QObject |
|
310 | class PythonQtWrapper_elfFileWidget : public QObject | |
207 | { Q_OBJECT |
|
311 | { Q_OBJECT | |
208 | public: |
|
312 | public: | |
@@ -215,6 +319,18 void delete_elfFileWidget(elfFileWidget* | |||||
215 |
|
319 | |||
216 |
|
320 | |||
217 |
|
321 | |||
|
322 | class PythonQtWrapper_elfInfoWdgt : public QObject | |||
|
323 | { Q_OBJECT | |||
|
324 | public: | |||
|
325 | public slots: | |||
|
326 | elfInfoWdgt* new_elfInfoWdgt(QWidget* parent = 0); | |||
|
327 | void delete_elfInfoWdgt(elfInfoWdgt* obj) { delete obj; } | |||
|
328 | }; | |||
|
329 | ||||
|
330 | ||||
|
331 | ||||
|
332 | ||||
|
333 | ||||
218 | class PythonQtWrapper_elfparser : public QObject |
|
334 | class PythonQtWrapper_elfparser : public QObject | |
219 | { Q_OBJECT |
|
335 | { Q_OBJECT | |
220 | public: |
|
336 | public: | |
@@ -226,14 +342,24 void delete_elfparser(elfparser* obj) { | |||||
226 | QString getArchitecture(elfparser* theWrappedObject); |
|
342 | QString getArchitecture(elfparser* theWrappedObject); | |
227 | QString getClass(elfparser* theWrappedObject); |
|
343 | QString getClass(elfparser* theWrappedObject); | |
228 | QString getEndianness(elfparser* theWrappedObject); |
|
344 | QString getEndianness(elfparser* theWrappedObject); | |
|
345 | qint64 getEntryPointAddress(elfparser* theWrappedObject); | |||
229 | bool getSectionData(elfparser* theWrappedObject, int index, char** buffer); |
|
346 | bool getSectionData(elfparser* theWrappedObject, int index, char** buffer); | |
|
347 | qint64 getSectionDatasz(elfparser* theWrappedObject, int index); | |||
|
348 | qint64 getSectionMemsz(elfparser* theWrappedObject, int index); | |||
230 | QString getSectionName(elfparser* theWrappedObject, int index); |
|
349 | QString getSectionName(elfparser* theWrappedObject, int index); | |
|
350 | qint64 getSectionPaddr(elfparser* theWrappedObject, int index); | |||
231 | QString getSectionType(elfparser* theWrappedObject, int index); |
|
351 | QString getSectionType(elfparser* theWrappedObject, int index); | |
232 | int getSectioncount(elfparser* theWrappedObject); |
|
352 | int getSectioncount(elfparser* theWrappedObject); | |
|
353 | qint64 getSegmentFilesz(elfparser* theWrappedObject, int index); | |||
233 | QString getSegmentFlags(elfparser* theWrappedObject, int index); |
|
354 | QString getSegmentFlags(elfparser* theWrappedObject, int index); | |
|
355 | qint64 getSegmentMemsz(elfparser* theWrappedObject, int index); | |||
|
356 | qint64 getSegmentOffset(elfparser* theWrappedObject, int index); | |||
|
357 | qint64 getSegmentPaddr(elfparser* theWrappedObject, int index); | |||
234 | QString getSegmentType(elfparser* theWrappedObject, int index); |
|
358 | QString getSegmentType(elfparser* theWrappedObject, int index); | |
|
359 | qint64 getSegmentVaddr(elfparser* theWrappedObject, int index); | |||
235 | int getSegmentcount(elfparser* theWrappedObject); |
|
360 | int getSegmentcount(elfparser* theWrappedObject); | |
236 | QString getType(elfparser* theWrappedObject); |
|
361 | QString getType(elfparser* theWrappedObject); | |
|
362 | qint64 getVersion(elfparser* theWrappedObject); | |||
237 | bool static_elfparser_isElf(const QString& File); |
|
363 | bool static_elfparser_isElf(const QString& File); | |
238 | bool iself(elfparser* theWrappedObject); |
|
364 | bool iself(elfparser* theWrappedObject); | |
239 | bool isopened(elfparser* theWrappedObject); |
|
365 | bool isopened(elfparser* theWrappedObject); |
@@ -3,14 +3,18 | |||||
3 |
|
3 | |||
4 |
|
4 | |||
5 | void PythonQt_init_PySocExplorer(PyObject* module) { |
|
5 | void PythonQt_init_PySocExplorer(PyObject* module) { | |
6 |
PythonQt::priv()->registerClass(&ElfFile::staticMetaObject, "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_ElfFile>, |
|
6 | PythonQt::priv()->registerClass(&ElfFile::staticMetaObject, "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_ElfFile>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_ElfFile>, module, 0); | |
|
7 | PythonQt::self()->addParentClass("ElfFile", "abstractExecFile",PythonQtUpcastingOffset<ElfFile,abstractExecFile>()); | |||
7 | PythonQt::priv()->registerCPPClass("MemSizeWdgt", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_MemSizeWdgt>, NULL, module, 0); |
|
8 | PythonQt::priv()->registerCPPClass("MemSizeWdgt", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_MemSizeWdgt>, NULL, module, 0); | |
8 | PythonQt::priv()->registerCPPClass("QHexEdit", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_QHexEdit>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_QHexEdit>, module, 0); |
|
9 | PythonQt::priv()->registerCPPClass("QHexEdit", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_QHexEdit>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_QHexEdit>, module, 0); | |
9 | PythonQt::priv()->registerCPPClass("QHexSpinBox", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_QHexSpinBox>, NULL, module, 0); |
|
10 | PythonQt::priv()->registerCPPClass("QHexSpinBox", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_QHexSpinBox>, NULL, module, 0); | |
10 | PythonQt::priv()->registerCPPClass("SocExplorerPlot", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_SocExplorerPlot>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_SocExplorerPlot>, module, 0); |
|
11 | PythonQt::priv()->registerCPPClass("SocExplorerPlot", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_SocExplorerPlot>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_SocExplorerPlot>, module, 0); | |
11 | PythonQt::priv()->registerClass(&TCP_Terminal_Client::staticMetaObject, "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_TCP_Terminal_Client>, NULL, module, 0); |
|
12 | PythonQt::priv()->registerClass(&TCP_Terminal_Client::staticMetaObject, "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_TCP_Terminal_Client>, NULL, module, 0); | |
12 | PythonQt::priv()->registerCPPClass("XByteArray", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_XByteArray>, NULL, module, 0); |
|
13 | PythonQt::priv()->registerCPPClass("XByteArray", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_XByteArray>, NULL, module, 0); | |
|
14 | PythonQt::priv()->registerClass(&abstractExecFile::staticMetaObject, "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_abstractExecFile>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_abstractExecFile>, module, 0); | |||
|
15 | PythonQt::priv()->registerCPPClass("codeFragment", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_codeFragment>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_codeFragment>, module, 0); | |||
13 | PythonQt::priv()->registerCPPClass("elfFileWidget", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_elfFileWidget>, NULL, module, 0); |
|
16 | PythonQt::priv()->registerCPPClass("elfFileWidget", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_elfFileWidget>, NULL, module, 0); | |
|
17 | PythonQt::priv()->registerCPPClass("elfInfoWdgt", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_elfInfoWdgt>, NULL, module, 0); | |||
14 | PythonQt::priv()->registerCPPClass("elfparser", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_elfparser>, NULL, module, 0); |
|
18 | PythonQt::priv()->registerCPPClass("elfparser", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_elfparser>, NULL, module, 0); | |
15 |
|
19 | |||
16 | } |
|
20 | } |
@@ -1,16 +1,8 | |||||
1 | <typesystem package="PySocExplorer" default-superclass="com.trolltech.qt.QtJambiObject"> |
|
1 | <typesystem package="PySocExplorer" default-superclass="com.trolltech.qt.QtJambiObject"> | |
2 |
<load-typesystem name=":/trolltech/generator/typesystem_core.txt" generate=" |
|
2 | <load-typesystem name=":/trolltech/generator/typesystem_core.txt" generate="no" /> | |
3 |
<load-typesystem name=":/trolltech/generator/typesystem_gui.txt" generate=" |
|
3 | <load-typesystem name=":/trolltech/generator/typesystem_gui.txt" generate="no" /> | |
4 | <load-typesystem name=":/trolltech/generator/typesystem_sql.txt" generate="no" /> |
|
|||
5 | <load-typesystem name=":/trolltech/generator/typesystem_opengl.txt" generate="no" /> |
|
|||
6 | <load-typesystem name=":/trolltech/generator/typesystem_svg.txt" generate="no" /> |
|
|||
7 | <load-typesystem name=":/trolltech/generator/typesystem_network.txt" generate="no" /> |
|
4 | <load-typesystem name=":/trolltech/generator/typesystem_network.txt" generate="no" /> | |
8 | <load-typesystem name=":/trolltech/generator/typesystem_xml.txt" generate="no" /> |
|
|||
9 | <load-typesystem name=":/trolltech/generator/typesystem_xmlpatterns.txt" generate="no" /> |
|
|||
10 | <load-typesystem name=":/trolltech/generator/typesystem_webkit.txt" generate="no" /> |
|
|||
11 | <load-typesystem name=":/trolltech/generator/typesystem_phonon.txt" generate="no" /> |
|
|||
12 |
|
5 | |||
13 | <rejection class="abstractExecFile" /> |
|
|||
14 |
|
6 | |||
15 | <object-type name="QHexSpinBox" /> |
|
7 | <object-type name="QHexSpinBox" /> | |
16 | <object-type name="MemSizeWdgt" /> |
|
8 | <object-type name="MemSizeWdgt" /> | |
@@ -18,10 +10,13 | |||||
18 | <object-type name="XByteArray" /> |
|
10 | <object-type name="XByteArray" /> | |
19 | <object-type name="SocExplorerPlot" /> |
|
11 | <object-type name="SocExplorerPlot" /> | |
20 | <object-type name="TCP_Terminal_Client" /> |
|
12 | <object-type name="TCP_Terminal_Client" /> | |
|
13 | <object-type name="codeFragment" /> | |||
|
14 | <rejection class="Elf_Section"/> | |||
21 | <object-type name="elfparser" /> |
|
15 | <object-type name="elfparser" /> | |
22 |
< |
|
16 | <interface-type name="abstractExecFile" /> | |
23 | <object-type name="ElfFile" /> |
|
17 | <object-type name="ElfFile" /> | |
24 |
<object-type name="elfFileWidget" /> |
|
18 | <object-type name="elfFileWidget" /> | |
|
19 | <object-type name="elfInfoWdgt" /> | |||
25 |
|
20 | |||
26 | </typesystem> |
|
21 | </typesystem> | |
27 |
|
22 |
@@ -1,6 +1,6 | |||||
1 | #!/bin/bash |
|
1 | #!/bin/bash | |
2 |
|
2 | |||
3 | #export QTDIR=/usr/include |
|
3 | #export QTDIR=/usr/include | |
4 | export QTDIR=/usr/include/qt5 |
|
4 | #export QTDIR=/usr/include/qt5 | |
5 |
|
5 | |||
6 |
pythonqt_generator |
|
6 | pythonqt_generator -include-paths="./elf /usr/include/qt5 /usr/include/qt5/QtWidgets" --output-directory=pythonQtOut PySocExplorer.h pythonQtgeneratorCfg.txt |
General Comments 0
You need to be logged in to leave comments.
Login now