##// END OF EJS Templates
Some Python wrapping improvment.
Jeandet Alexis -
r39:95ec6cf42fc5 default
parent child
Show More
@@ -1,11 +1,12
1 #include <QObject>
2 #include <QWidget>
1 #include <QtCore/QObject>
2 #include <QtWidgets/QtWidgets>
3 3 #include "qhexspinbox.h"
4 4 #include "memsizewdgt.h"
5 5 #include "qhexedit/qhexedit.h"
6 6 #include "SocExplorerPlot.h"
7 7 #include "tcp_terminal_client.h"
8 8 #include "elf/elfparser.h"
9 #include "elf/abstractexecfile.h"
9 #include "abstractexecfile.h"
10 10 #include "elf/elffile.h"
11 11 #include "elf/elffilewidget.h"
12 #include "elf/elfinfowdgt.h"
@@ -1,37 +1,30
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 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 25 codeFragment::codeFragment()
35 26 {
36
27 data = NULL;
28 size = 0;
29 address = 0;
37 30 }
@@ -1,50 +1,51
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef ABSTRACTEXECFILE_H
23 23 #define ABSTRACTEXECFILE_H
24 24
25 #include <QObject>
25 #include <QtCore/QObject>
26 26
27 27 class codeFragment
28 28 {
29 29 public:
30 30 codeFragment();
31 codeFragment(char* data, quint32 size, quint32 address):data(data),size(size),address(address){}
31 32 char* data;
32 33 quint32 size;
33 34 quint32 address;
34 35 };
35 36
36 class abstractExecFile
37 class abstractExecFile : public QObject
37 38 {
39 Q_OBJECT
38 40 public:
39 abstractExecFile();
40 abstractExecFile(const QString& File);
41 // virtual abstractExecFile()=0;
41 42 virtual bool openFile(const QString& File)=0;
42 43 virtual bool isopened()=0;
43 44 virtual int closeFile()=0;
44 virtual QList<codeFragment> getFragments()=0;
45 virtual QList<codeFragment*> getFragments()=0;
45 46
46 47 protected:
47 48 QString p_fileName;
48 49 };
49 50
50 51 #endif // ABSTRACTEXECFILE_H
@@ -1,114 +1,117
1 1 SOCEXPLORER_ROOT = \"$${PWD}/../..\"
2 2 include($${PWD}/../../build_cfg/socexplorer.pri)
3 3 include($${PWD}/lppserial/lppserial.pri)
4 4
5 5 TEMPLATE = lib
6 6 TARGET = socexplorercommon$${DEBUG_EXT}
7 7
8 8 win32:CONFIG += dll
9 9 win32:CONFIG -= static
10 10
11 11 win32:INCLUDEPATH += $${PWD}/elf/libelfWin32/include
12 12 win32:INCLUDEPATH += $${PWD}/elf/libelfWin32/include/libelf
13 13 win32:DEFINES+=_ELF_WINDOWS_
14 14 DEFINES+=RS232_debug
15 15
16 16 win32:LIBS += $${PWD}/elf/libelfWin32/bin/libelf.a
17 17 unix:LIBS += -lelf
18 18
19 19 QMAKE_LFLAGS_RELEASE += --enable-auto-import
20 20 QMAKE_LFLAGS_DEBUG += --enable-auto-import
21 21
22 22 target.path = $$[QT_INSTALL_LIBS]
23 23 isEmpty(target.path) {
24 24 error(can\'t get QT_INSTALL_LIBS)
25 25 }
26 26
27 27 header.path = $$[QT_INSTALL_HEADERS]/SocExplorer/common
28 28 header.files = \
29 29 memsizewdgt.h \
30 30 qhexspinbox.h \
31 31 qsvgicon.h \
32 32 qhexedit/qhexedit_p.h \
33 33 qhexedit/qhexedit.h \
34 34 qhexedit/xbytearray.h \
35 35 QCustomPlot/qcustomplot.h \
36 36 SocExplorerPlot.h \
37 37 tcp_terminal_client.h \
38 38 elf/elfinfowdgt.h \
39 39 elf/elfparser.h \
40 40 elf/elffile.h \
41 41 elf/elffilewidget.h \
42 42 qipdialogbox.h \
43 43 lppserial/src/RS232.h
44 44
45 45 win32{
46 46 elfheader.path = $$[QT_INSTALL_HEADERS]/SocExplorer/common/libelf
47 47 elfheader.files += \
48 48 elf/libelfWin32/include/libelf/byteswap.h \
49 49 elf/libelfWin32/include/libelf/errors.h \
50 50 elf/libelfWin32/include/libelf/gelf.h \
51 51 elf/libelfWin32/include/libelf/nlist.h \
52 52 elf/libelfWin32/include/libelf/sys_elf.h \
53 53 elf/libelfWin32/include/libelf/verneed.h \
54 54 elf/libelfWin32/include/libelf/elf_repl.h \
55 55 elf/libelfWin32/include/libelf/ext_types.h \
56 56 elf/libelfWin32/include/libelf/libelf.h \
57 57 elf/libelfWin32/include/libelf/private.h \
58 58 elf/libelfWin32/include/libelf/verdef.h
59 59 INSTALLS += elfheader
60 60 }
61 61
62 62
63 63 isEmpty(header.path) {
64 64 error(can\'t get QT_INSTALL_HEADERS)
65 65 }
66 66
67 67 INSTALLS += target header
68 68
69 69 INCLUDEPATH += QCustomPlot qhexedit
70 70
71 71 HEADERS += \
72 72 memsizewdgt.h \
73 73 qhexspinbox.h \
74 74 qsvgicon.h \
75 75 qhexedit/qhexedit_p.h \
76 76 qhexedit/qhexedit.h \
77 77 qhexedit/xbytearray.h \
78 78 qhexedit/commands.h \
79 79 QCustomPlot/qcustomplot.h \
80 80 tcp_terminal_client.h \
81 81 elf/elfinfowdgt.h \
82 82 elf/elfparser.h \
83 83 abstractexecfile.h \
84 84 elf/elffile.h \
85 85 qipdialogbox.h \
86 86 PySocExplorer.h \
87 87 SocExplorerPlot.h \
88 88 elf/elffilewidget.h
89 89
90 90
91 91 SOURCES += \
92 92 memsizewdgt.cpp \
93 93 qhexspinbox.cpp \
94 94 qsvgicon.cpp \
95 95 qhexedit/qhexedit_p.cpp \
96 96 qhexedit/qhexedit.cpp \
97 97 qhexedit/xbytearray.cpp \
98 98 qhexedit/commands.cpp \
99 99 QCustomPlot/qcustomplot.cpp \
100 100 tcp_terminal_client.cpp \
101 101 elf/elfinfowdgt.cpp \
102 102 elf/elfparser.cpp \
103 103 abstractexecfile.cpp \
104 104 elf/elffile.cpp \
105 105 qipdialogbox.cpp \
106 106 SocExplorerPlot.cpp \
107 107 elf/elffilewidget.cpp
108 108
109 109 FORMS += \
110 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
@@ -1,101 +1,811
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author :
20 20 Alexis Jeandet
21 21 -- Mail :
22 22 alexis.jeandet@member.fsf.org
23 23 ----------------------------------------------------------------------------*/
24 24 #include "elffile.h"
25 25
26 ElfFile::ElfFile(QObject *parent)
27 :QObject(parent),abstractExecFile(),elfparser()
26 ElfFile::ElfFile()
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, QObject *parent)
32 :QObject(parent),abstractExecFile(),elfparser()
35 ElfFile::ElfFile(const QString &File)
36 :abstractExecFile()
33 37 {
38 this->opened = false;
39 this->type_elf = false;
40 this->elfFile = NULL;
41 this->e = NULL;
34 42 this->p_fileName = File;
35 setFilename(File);
43 openFile(File);
36 44 }
37 45
38 46 bool ElfFile::openFile(const QString &File)
39 47 {
40 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 67 bool ElfFile::isopened()
45 68 {
46 return elfparser::isopened();
69 return this->opened;
47 70 }
48 71
49 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 91 if (isopened())
59 92 {
60 93 for(int i =0;i<fragmentList.count();i++)
61 94 {
62 95 fragments.append(getFragment(fragmentList.at(i)));
63 96 }
64 97 }
65 98 return fragments;
66 99 }
67 100
68 QList<codeFragment> ElfFile::getFragments()
101 QList<codeFragment*> ElfFile::getFragments()
69 102 {
70 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 109 for(int i=0;i<getSectioncount();i++)
77 110 {
78 111 if(getSectionName(i) == name)
79 112 {
80 fragment.data =NULL;
81 fragment.size = getSectionDatasz(i);
82 fragment.address = getSectionPaddr(i);
83 getSectionData(i,&fragment.data);
113 fragment->data =NULL;
114 fragment->size = getSectionDatasz(i);
115 fragment->address = getSectionPaddr(i);
116 getSectionData(i,&fragment->data);
84 117 }
85 118 }
86 119
87 120 }
88 121
89 122
90 123
91 124
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 }
@@ -1,51 +1,102
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 22 #include <abstractexecfile.h>
23 #include <elf.h>
24 #include "elfparser.h"
25 #include <QStringList>
26
23 #include <QtCore/QObject>
24 #include <QtCore/QStringList>
25 #include <libelf.h>
26 #include <gelf.h>
27 #include <sys/types.h>
28 #include <sys/stat.h>
29 #include <fcntl.h>
30 #include <unistd.h>
27 31 #ifndef ELFFILE_H
28 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 36 public:
34 ElfFile(QObject *parent = 0);
35 ElfFile(const QString& File,QObject *parent = 0);
37 Elf_Section(){}
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 53 bool openFile(const QString& File);
37 54 bool isopened();
38 55 int closeFile();
39 QList<codeFragment> getFragments();
40 QList<codeFragment> getFragments(QStringList fragmentList);
41 // elfparser parser;
56 QList<codeFragment*> getFragments();
57 QList<codeFragment*> getFragments(QStringList fragmentList);
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 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
51 102 #endif // ELFFILE_H
@@ -1,26 +1,27
1 1 #ifndef ELFFILEWIDGET_H
2 2 #define ELFFILEWIDGET_H
3 3
4 #include <QWidget>
4 #include <QtWidgets/QWidget>
5 5 #include "elffile.h"
6 6
7 7 namespace Ui {
8 8 class elfFileWidget;
9 9 }
10 10
11 11 class elfFileWidget : public QWidget
12 12 {
13 13 Q_OBJECT
14 14
15 15 public:
16 explicit elfFileWidget(QWidget *parent = 0);
16 elfFileWidget(QWidget *parent = 0);
17 17 ~elfFileWidget();
18
18 19 public slots:
19 20 void updateElfFile(ElfFile* file);
20 21
21 22 private:
22 23 Ui::elfFileWidget *ui;
23 24 ElfFile* p_elf;
24 25 };
25 26
26 27 #endif // ELFFILEWIDGET_H
@@ -1,769 +1,521
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #include "elfparser.h"
23 23 #include <sys/types.h>
24 24 #include <sys/stat.h>
25 25 #include <fcntl.h>
26 26 #include <unistd.h>
27 27
28 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 }
28 extern QString elfresolveMachine(Elf64_Half e_machine);
277 29
278 30
279 31 elfparser::elfparser()
280 32 {
281 33 this->opened = false;
282 34 this->type_elf = false;
283 35 this->elfFile = NULL;
284 36 this->e = NULL;
285 37 }
286 38
287 39
288 40 int elfparser::setFilename(const QString &name)
289 41 {
290 42 this->closeFile();
291 43 if(elf_version(EV_CURRENT)==EV_NONE)return 0;
292 44 #ifdef _ELF_WINDOWS_
293 45 this->elfFile = open(name.toStdString().c_str(),O_RDONLY|O_BINARY ,0);
294 46 #else
295 47 this->elfFile = open(name.toStdString().c_str(),O_RDONLY ,0);
296 48 #endif
297 49 if(this->elfFile==NULL)return 0;
298 50 this->e = elf_begin(this->elfFile,ELF_C_READ,NULL);
299 51 if(this->e==NULL)return 0;
300 52 this->ek = elf_kind(this->e);
301 53 gelf_getehdr (this->e, &this->ehdr );
302 54 elf_getshdrstrndx (this->e, &this->shstrndx);
303 55 this->updateSegments();
304 56 this->updateSections();
305 57 return 1;
306 58 }
307 59
308 60
309 61 int elfparser::closeFile()
310 62 {
311 63 if(this->elfFile!=NULL)
312 64 {
313 65 if(this->e!=NULL)
314 66 {
315 67 elf_end(this->e);
316 68 this->e = NULL;
317 69 }
318 70 close(this->elfFile);
319 71 this->elfFile = NULL;
320 72 }
321 73 return 0;
322 74 }
323 75
324 76 QString elfparser::getClass()
325 77 {
326 78 if(this->e!=NULL)
327 79 {
328 80 int eclass = gelf_getclass(this->e);
329 81 if(eclass==ELFCLASS32)return "ELF32";
330 82 if(eclass==ELFCLASS64)return "ELF64";
331 83 }
332 84 return "none";
333 85 }
334 86
335 87
336 88 bool elfparser::isopened()
337 89 {
338 90 return this->opened;
339 91 }
340 92
341 93
342 94 bool elfparser::iself()
343 95 {
344 96 return this->type_elf;
345 97 }
346 98
347 99
348 100 QString elfparser::getArchitecture()
349 101 {
350 102 if(this->e!=NULL)
351 103 {
352 104 return elfresolveMachine(this->ehdr.e_machine);
353 105 }
354 106 return "";
355 107 }
356 108
357 109
358 110 QString elfparser::getType()
359 111 {
360 112 QString kind("");
361 113 if(this->e!=NULL)
362 114 {
363 115 switch(this->ek)
364 116 {
365 117 case ELF_K_AR:
366 118 kind = "Archive";
367 119 break;
368 120 case ELF_K_ELF:
369 121 kind = "Elf";
370 122 break;
371 123 case ELF_K_COFF:
372 124 kind = "COFF";
373 125 break;
374 126 case ELF_K_NUM:
375 127 kind = "NUM";
376 128 break;
377 129 case ELF_K_NONE:
378 130 kind = "Data";
379 131 break;
380 132 default:
381 133 kind = "Unknow";
382 134 break;
383 135 }
384 136 }
385 137 return kind;
386 138 }
387 139
388 140 QString elfparser::getEndianness()
389 141 {
390 142 if(this->e!=NULL)
391 143 {
392 144 if(this->ehdr.e_ident[EI_DATA]==ELFDATA2LSB)return "2's complement, little endian";
393 145 if(this->ehdr.e_ident[EI_DATA]==ELFDATA2MSB)return "2's complement, big endian";
394 146 }
395 147 return "none";
396 148 }
397 149
398 150 QString elfparser::getABI()
399 151 {
400 152 if(this->e!=NULL)
401 153 {
402 154 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_NONE)return "UNIX System V ABI";
403 155 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_SYSV)return "Alias";
404 156 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_HPUX)return "HP-UX";
405 157 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_NETBSD)return "NetBSD";
406 158 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_GNU)return "Object uses GNU ELF extensions";
407 159 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_LINUX)return "Compatibility alias";
408 160 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_SOLARIS)return "Sun Solaris";
409 161 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_AIX)return "IBM AIX";
410 162 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_IRIX)return "SGI Irix";
411 163 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_FREEBSD)return "FreeBSD";
412 164 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_TRU64)return "Compaq TRU64 UNIX";
413 165 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_MODESTO)return " Novell Modesto";
414 166 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_OPENBSD)return "OpenBSD";
415 167 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_ARM_AEABI)return "ARM EABI";
416 168 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_ARM)return "ARM";
417 169 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_STANDALONE)return "Standalone (embedded) application";
418 170 }
419 171 return "none";
420 172 }
421 173
422 174
423 qint32 elfparser::getVersion()
175 qint64 elfparser::getVersion()
424 176 {
425 177 if(this->e!=NULL)
426 178 {
427 179 return this->ehdr.e_version;
428 180 }
429 181 }
430 182
431 183 qint64 elfparser::getEntryPointAddress()
432 184 {
433 185 if(this->e!=NULL)
434 186 {
435 187 return this->ehdr.e_entry;
436 188 }
437 189 }
438 190
439 191
440 192 int elfparser::getSectioncount()
441 193 {
442 194 return (int)this->SectionCount;
443 195 }
444 196
445 197
446 198 int elfparser::getSegmentcount()
447 199 {
448 200 return (int)this->SegmentCount;
449 201 }
450 202
451 203
452 204 QString elfparser::getSegmentType(int index)
453 205 {
454 206 QString type("");
455 207 if(this->e!=NULL)
456 208 {
457 209 if(index < this->Segments.count())
458 210 {
459 211 switch(this->Segments.at(index)->p_type)
460 212 {
461 213 case PT_NULL:
462 214 type = "Program header table entry unused";
463 215 break;
464 216 case PT_LOAD:
465 217 type = "Loadable program segment";
466 218 break;
467 219 case PT_DYNAMIC :
468 220 type = "Dynamic linking information";
469 221 break;
470 222 case PT_INTERP:
471 223 type ="Program interpreter";
472 224 break;
473 225 case PT_NOTE:
474 226 type = "Auxiliary information";
475 227 break;
476 228 case PT_SHLIB:
477 229 type = "Reserved";
478 230 break;
479 231 case PT_PHDR:
480 232 type = "Entry for header table itself";
481 233 break;
482 234 case PT_TLS:
483 235 type = "Thread-local storage segment";
484 236 break;
485 237 case PT_NUM:
486 238 type = "Number of defined types";
487 239 break;
488 240 case PT_LOOS:
489 241 type = "Start of OS-specific";
490 242 break;
491 243 case PT_SUNWSTACK:
492 244 type = "Stack segment";
493 245 break;
494 246 case PT_LOPROC:
495 247 type = "Start of processor-specific";
496 248 break;
497 249 case PT_HIPROC:
498 250 type = "End of processor-specific";
499 251 break;
500 252 default:
501 253 type = "Unknow Section Type";
502 254 break;
503 255 }
504 256 }
505 257 }
506 258
507 259 return type;
508 260 }
509 261
510 262
511 263 qint64 elfparser::getSegmentOffset(int index)
512 264 {
513 265 int64_t Offset;
514 266 if(this->e!=NULL)
515 267 {
516 268 if(index < this->Segments.count())
517 269 {
518 270 Offset = (int64_t)this->Segments.at(index)->p_offset;
519 271 }
520 272 }
521 273 return Offset;
522 274 }
523 275
524 276
525 277 qint64 elfparser::getSegmentVaddr(int index)
526 278 {
527 279 int64_t Vaddr = 0;
528 280 if(this->e!=NULL)
529 281 {
530 282 if(index < this->Segments.count())
531 283 {
532 284 Vaddr = (int64_t)this->Segments.at(index)->p_vaddr;
533 285 }
534 286 }
535 287 return Vaddr;
536 288 }
537 289
538 290
539 291 qint64 elfparser::getSegmentPaddr(int index)
540 292 {
541 293 int64_t Paddr=0;
542 294 if(this->e!=NULL)
543 295 {
544 296 if(index < this->Segments.count())
545 297 {
546 298 Paddr = (int64_t)this->Segments.at(index)->p_paddr;
547 299 }
548 300 }
549 301 return Paddr;
550 302 }
551 303
552 304 qint64 elfparser::getSectionPaddr(int index)
553 305 {
554 306 int64_t Paddr=0;
555 307 if(this->e!=NULL)
556 308 {
557 309 if(index < this->sections.count())
558 310 {
559 311 Paddr = (int64_t)this->sections.at(index)->section_header->sh_addr;
560 312 }
561 313 }
562 314 return Paddr;
563 315 }
564 316
565 317
566 318 qint64 elfparser::getSegmentFilesz(int index)
567 319 {
568 320 int64_t FileSz=0;
569 321 if(this->e!=NULL)
570 322 {
571 323 if(index < this->Segments.count())
572 324 {
573 325 FileSz = (int64_t)this->Segments.at(index)->p_filesz;
574 326 }
575 327 }
576 328 return FileSz;
577 329 }
578 330
579 331 qint64 elfparser::getSectionDatasz(int index)
580 332 {
581 333 int64_t DataSz=0;
582 334 if(this->e!=NULL)
583 335 {
584 336 if(index < this->sections.count())
585 337 {
586 338 DataSz = (int64_t)this->sections.at(index)->data->d_size;
587 339 }
588 340 }
589 341 return DataSz;
590 342 }
591 343
592 344 bool elfparser::getSectionData(int index, char **buffer)
593 345 {
594 346 if(this->e!=NULL)
595 347 {
596 348 if(index < this->sections.count())
597 349 {
598 350 *buffer = (char *)this->sections.at(index)->data->d_buf;
599 351 return true;
600 352 }
601 353 }
602 354 return false;
603 355 }
604 356
605 357
606 358 qint64 elfparser::getSegmentMemsz(int index)
607 359 {
608 360 int64_t MemSz=0;
609 361 if(this->e!=NULL)
610 362 {
611 363 if(index < this->Segments.count())
612 364 {
613 365 MemSz = (int64_t)this->Segments.at(index)->p_memsz;
614 366 }
615 367 }
616 368 return MemSz;
617 369 }
618 370
619 371 qint64 elfparser::getSectionMemsz(int index)
620 372 {
621 373 int64_t MemSz=0;
622 374 if(this->e!=NULL)
623 375 {
624 376 if(index < this->sections.count())
625 377 {
626 378 MemSz = (int64_t)this->sections.at(index)->section_header->sh_size;
627 379 }
628 380 }
629 381 return MemSz;
630 382 }
631 383
632 384
633 385 QString elfparser::getSegmentFlags(int index)
634 386 {
635 387 QString flags("");
636 388 if(this->e!=NULL)
637 389 {
638 390 if(index < this->Segments.count())
639 391 {
640 392 if((this->Segments.at(index)->p_flags&PF_X) == PF_X)flags+="x";
641 393 if((this->Segments.at(index)->p_flags&PF_W) == PF_W)flags+="w";
642 394 if((this->Segments.at(index)->p_flags&PF_R) == PF_R)flags+="r";
643 395 if((this->Segments.at(index)->p_flags&PF_MASKOS) == PF_MASKOS)flags+=" OS-specific";
644 396 if((this->Segments.at(index)->p_flags&PF_MASKPROC) == PF_MASKPROC)flags+=" Processor-specific";
645 397 }
646 398 }
647 399 return flags;
648 400 }
649 401
650 402
651 403 QString elfparser::getSectionName(int index)
652 404 {
653 405 char* nameChr = elf_strptr(this->e , this->shstrndx , this->sections.at(index)->section_header->sh_name);
654 406 return QString(nameChr);
655 407 }
656 408
657 409
658 410 void elfparser::updateSections()
659 411 {
660 412 for(int i=0;i<this->sections.count();i++)
661 413 {
662 414 delete this->sections.at(i);
663 415 }
664 416 this->sections.clear();
665 417 this->scn = elf_nextscn (this->e , NULL );
666 418 this->SectionCount = 0;
667 419 while( this->scn != NULL )
668 420 {
669 421 GElf_Shdr* shdr = (GElf_Shdr*)malloc(sizeof(GElf_Shdr));
670 422 gelf_getshdr ( this->scn , shdr );
671 423 Elf_Data* data = elf_getdata(this->scn, NULL);
672 424 this->sections.append(new Elf_Section(data,shdr));
673 425 this->SectionCount+=1;
674 426 this->scn = elf_nextscn(e , scn);
675 427 }
676 428 }
677 429
678 430
679 431 void elfparser::updateSegments()
680 432 {
681 433 elf_getphdrnum (this->e , &this->SegmentCount);
682 434 for(int i=0;i<this->Segments.count();i++)
683 435 {
684 436 free(this->Segments.at(i));
685 437 }
686 438 this->Segments.clear();
687 439 for(int i=0;i<this->SegmentCount;i++)
688 440 {
689 441 GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr));
690 442 gelf_getphdr (this->e , i , header );
691 443 this->Segments.append(header);
692 444 }
693 445 }
694 446
695 447
696 448
697 449
698 450
699 451 QString elfparser::getSectionType(int index)
700 452 {
701 453 QString type("");
702 454 if(this->e!=NULL)
703 455 {
704 456 if(index < this->Segments.count())
705 457 {
706 458 switch(this->Segments.at(index)->p_type)
707 459 {
708 460 case SHT_NULL : type = "Section header table entry unused"; break;
709 461 case SHT_PROGBITS : type = "Program data"; break;
710 462 case SHT_SYMTAB : type = "Symbol table"; break;
711 463 case SHT_STRTAB : type = "String table"; break;
712 464 case SHT_RELA : type = "Relocation entries with addends"; break;
713 465 case SHT_HASH : type = "Symbol hash table"; break;
714 466 case SHT_DYNAMIC : type = "Dynamic linking information"; break;
715 467 case SHT_NOTE : type = "Notes"; break;
716 468 case SHT_NOBITS :type = "Program space with no data (bss)"; break;
717 469 case SHT_REL :type = "Relocation entries, no addends"; break;
718 470 case SHT_SHLIB : type = "Reserved"; break;
719 471 case SHT_DYNSYM : type = "Dynamic linker symbol table"; break;
720 472 case SHT_INIT_ARRAY : type = "Array of constructors"; break;
721 473 case SHT_FINI_ARRAY : type = "Array of destructors"; break;
722 474 case SHT_PREINIT_ARRAY : type = "Array of pre-constructors"; break;
723 475 case SHT_GROUP : type = "Section group"; break;
724 476 case SHT_SYMTAB_SHNDX : type = "Extended section indeces"; break;
725 477 case SHT_NUM : type = "Number of defined types. "; break;
726 478 case SHT_LOOS : type = "Start OS-specific. "; break;
727 479 case SHT_LOSUNW : type = "Sun-specific low bound. "; break;
728 480 case SHT_SUNW_COMDAT : type = " "; break;
729 481 case SHT_SUNW_syminfo : type = " "; break;
730 482 case SHT_GNU_verdef : type = "Version definition section. "; break;
731 483 case SHT_GNU_verneed : type = "Version needs section. "; break;
732 484 case SHT_GNU_versym : type = "Version symbol table. "; break;
733 485 case SHT_LOPROC : type = "Start of processor-specific"; break;
734 486 case SHT_HIPROC : type = "End of processor-specific"; break;
735 487 case SHT_HIUSER : type = "End of application-specific"; break;
736 488 }
737 489 }
738 490 }
739 491 return type;
740 492 }
741 493
742 494 bool elfparser::isElf(const QString &File)
743 495 {
744 496 int file =0;
745 497 #ifdef _ELF_WINDOWS_
746 498 file = open(File.toStdString().c_str(),O_RDONLY|O_BINARY ,0);
747 499 #else
748 500 file = open(File.toStdString().c_str(),O_RDONLY ,0);
749 501 #endif
750 502 char Magic[4];
751 503 if(file!=-1)
752 504 {
753 505 read(file,Magic,4);
754 506 close(file);
755 507 if(Magic[0]==0x7f && Magic[1]==0x45 && Magic[2]==0x4c && Magic[3]==0x46)
756 508 {
757 509 return true;
758 510 }
759 511 }
760 512 return false;
761 513 }
762 514
763 515
764 516
765 517
766 518
767 519
768 520
769 521
@@ -1,101 +1,89
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the SocExplorer Software
3 3 -- Copyright (C) 2013, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef ELFPARSER_H
23 23 #define ELFPARSER_H
24 24 #include <libelf.h>
25 25 #include <gelf.h>
26 26 #include <QString>
27 27 #include <stdio.h>
28 28 #include <QList>
29 29 #include <stdint.h>
30
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 };
30 #include "elffile.h"
43 31
44 32 class elfparser
45 33 {
46 34 public:
47 35 elfparser();
48 36 bool iself();
49 37 bool isopened();
50 38 int setFilename(const QString& name);
51 39 int closeFile();
52 40 QString getClass();
53 41 QString getArchitecture();
54 42 QString getType();
55 43 QString getEndianness();
56 44 QString getABI();
57 qint32 getVersion();
45 qint64 getVersion();
58 46 qint64 getEntryPointAddress();
59 47 int getSectioncount();
60 48 int getSegmentcount();
61 49 QString getSegmentType(int index);
62 50 qint64 getSegmentOffset(int index);
63 51 qint64 getSegmentVaddr(int index);
64 52 qint64 getSegmentPaddr(int index);
65 53 qint64 getSectionPaddr(int index);
66 54 qint64 getSegmentFilesz(int index);
67 55 qint64 getSectionDatasz(int index);
68 56 bool getSectionData(int index, char **buffer);
69 57 qint64 getSegmentMemsz(int index);
70 58 qint64 getSectionMemsz(int index);
71 59 QString getSegmentFlags(int index);
72 60 QString getSectionName(int index);
73 61 QString getSectionType(int index);
74 62 static bool isElf(const QString& File);
75 63
76 64 private:
77 65 void updateSections();
78 66 void updateSegments();
79 67 int elfFile;
80 68 bool opened;
81 69 bool type_elf;
82 70 Elf* e;
83 71 Elf_Kind ek;
84 72 GElf_Ehdr ehdr;
85 73 Elf_Scn * scn;
86 74 Elf_Data * data;
87 75 size_t SectionCount,SegmentCount, shstrndx;
88 76 QList<GElf_Phdr*> Segments;
89 77 QList<Elf_Section*> sections;
90 78
91 79 };
92 80
93 81 #endif // ELFPARSER_H
94 82
95 83
96 84
97 85
98 86
99 87
100 88
101 89
@@ -1,571 +1,1007
1 1 #include "PySocExplorer0.h"
2 2 #include <PythonQtConversion.h>
3 3 #include <PythonQtMethodInfo.h>
4 4 #include <PythonQtSignalReceiver.h>
5 5 #include <QVariant>
6 #include <abstractexecfile.h>
6 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(parent); }
128 return new PythonQtShell_ElfFile(); }
11 129
12 ElfFile* PythonQtWrapper_ElfFile::new_ElfFile(const QString& File, QObject* parent)
130 ElfFile* PythonQtWrapper_ElfFile::new_ElfFile(const QString& File)
13 131 {
14 return new ElfFile(File, parent); }
132 return new PythonQtShell_ElfFile(File); }
15 133
16 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 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 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
32 280
33 281 MemSizeWdgt* PythonQtWrapper_MemSizeWdgt::new_MemSizeWdgt(QWidget* parent)
34 282 {
35 283 return new MemSizeWdgt(parent); }
36 284
37 285 MemSizeWdgt* PythonQtWrapper_MemSizeWdgt::new_MemSizeWdgt(int defaultSize, QWidget* parent)
38 286 {
39 287 return new MemSizeWdgt(defaultSize, parent); }
40 288
41 289 int PythonQtWrapper_MemSizeWdgt::getsize(MemSizeWdgt* theWrappedObject)
42 290 {
43 291 return ( theWrappedObject->getsize());
44 292 }
45 293
46 294 void PythonQtWrapper_MemSizeWdgt::setMaximum(MemSizeWdgt* theWrappedObject, unsigned int max)
47 295 {
48 296 ( theWrappedObject->setMaximum(max));
49 297 }
50 298
51 299 void PythonQtWrapper_MemSizeWdgt::show(MemSizeWdgt* theWrappedObject)
52 300 {
53 301 ( theWrappedObject->show());
54 302 }
55 303
56 304 void PythonQtWrapper_MemSizeWdgt::updateSizeValue(MemSizeWdgt* theWrappedObject)
57 305 {
58 306 ( theWrappedObject->updateSizeValue());
59 307 }
60 308
61 309
62 310
63 311 PythonQtShell_QHexEdit::~PythonQtShell_QHexEdit() {
64 312 PythonQtPrivate* priv = PythonQt::priv();
65 313 if (priv) { priv->shellClassDeleted(this); }
66 314 }
67 315 QHexEdit* PythonQtWrapper_QHexEdit::new_QHexEdit(QWidget* parent)
68 316 {
69 317 return new PythonQtShell_QHexEdit(parent); }
70 318
71 319 QColor PythonQtWrapper_QHexEdit::addressAreaColor(QHexEdit* theWrappedObject)
72 320 {
73 321 return ( theWrappedObject->addressAreaColor());
74 322 }
75 323
76 324 int PythonQtWrapper_QHexEdit::addressOffset(QHexEdit* theWrappedObject)
77 325 {
78 326 return ( theWrappedObject->addressOffset());
79 327 }
80 328
81 329 int PythonQtWrapper_QHexEdit::cursorPosition(QHexEdit* theWrappedObject)
82 330 {
83 331 return ( theWrappedObject->cursorPosition());
84 332 }
85 333
86 334 QByteArray PythonQtWrapper_QHexEdit::data(QHexEdit* theWrappedObject)
87 335 {
88 336 return ( theWrappedObject->data());
89 337 }
90 338
91 339 const QFont* PythonQtWrapper_QHexEdit::font(QHexEdit* theWrappedObject) const
92 340 {
93 341 return &( theWrappedObject->font());
94 342 }
95 343
96 344 QColor PythonQtWrapper_QHexEdit::highlightingColor(QHexEdit* theWrappedObject)
97 345 {
98 346 return ( theWrappedObject->highlightingColor());
99 347 }
100 348
101 349 int PythonQtWrapper_QHexEdit::indexOf(QHexEdit* theWrappedObject, const QByteArray& ba, int from) const
102 350 {
103 351 return ( theWrappedObject->indexOf(ba, from));
104 352 }
105 353
106 354 void PythonQtWrapper_QHexEdit::insert(QHexEdit* theWrappedObject, int i, char ch)
107 355 {
108 356 ( theWrappedObject->insert(i, ch));
109 357 }
110 358
111 359 void PythonQtWrapper_QHexEdit::insert(QHexEdit* theWrappedObject, int i, const QByteArray& ba)
112 360 {
113 361 ( theWrappedObject->insert(i, ba));
114 362 }
115 363
116 364 bool PythonQtWrapper_QHexEdit::isReadOnly(QHexEdit* theWrappedObject)
117 365 {
118 366 return ( theWrappedObject->isReadOnly());
119 367 }
120 368
121 369 int PythonQtWrapper_QHexEdit::lastIndexOf(QHexEdit* theWrappedObject, const QByteArray& ba, int from) const
122 370 {
123 371 return ( theWrappedObject->lastIndexOf(ba, from));
124 372 }
125 373
126 374 bool PythonQtWrapper_QHexEdit::overwriteMode(QHexEdit* theWrappedObject)
127 375 {
128 376 return ( theWrappedObject->overwriteMode());
129 377 }
130 378
131 379 void PythonQtWrapper_QHexEdit::remove(QHexEdit* theWrappedObject, int pos, int len)
132 380 {
133 381 ( theWrappedObject->remove(pos, len));
134 382 }
135 383
136 384 void PythonQtWrapper_QHexEdit::replace(QHexEdit* theWrappedObject, int pos, int len, const QByteArray& after)
137 385 {
138 386 ( theWrappedObject->replace(pos, len, after));
139 387 }
140 388
141 389 QColor PythonQtWrapper_QHexEdit::selectionColor(QHexEdit* theWrappedObject)
142 390 {
143 391 return ( theWrappedObject->selectionColor());
144 392 }
145 393
146 394 QString PythonQtWrapper_QHexEdit::selectionToReadableString(QHexEdit* theWrappedObject)
147 395 {
148 396 return ( theWrappedObject->selectionToReadableString());
149 397 }
150 398
151 399 void PythonQtWrapper_QHexEdit::setAddressAreaColor(QHexEdit* theWrappedObject, const QColor& color)
152 400 {
153 401 ( theWrappedObject->setAddressAreaColor(color));
154 402 }
155 403
156 404 void PythonQtWrapper_QHexEdit::setAddressOffset(QHexEdit* theWrappedObject, int offset)
157 405 {
158 406 ( theWrappedObject->setAddressOffset(offset));
159 407 }
160 408
161 409 void PythonQtWrapper_QHexEdit::setCursorPosition(QHexEdit* theWrappedObject, int cusorPos)
162 410 {
163 411 ( theWrappedObject->setCursorPosition(cusorPos));
164 412 }
165 413
166 414 void PythonQtWrapper_QHexEdit::setData(QHexEdit* theWrappedObject, const QByteArray& data)
167 415 {
168 416 ( theWrappedObject->setData(data));
169 417 }
170 418
171 419 void PythonQtWrapper_QHexEdit::setFont(QHexEdit* theWrappedObject, const QFont& arg__1)
172 420 {
173 421 ( theWrappedObject->setFont(arg__1));
174 422 }
175 423
176 424 void PythonQtWrapper_QHexEdit::setHighlightingColor(QHexEdit* theWrappedObject, const QColor& color)
177 425 {
178 426 ( theWrappedObject->setHighlightingColor(color));
179 427 }
180 428
181 429 void PythonQtWrapper_QHexEdit::setOverwriteMode(QHexEdit* theWrappedObject, bool arg__1)
182 430 {
183 431 ( theWrappedObject->setOverwriteMode(arg__1));
184 432 }
185 433
186 434 void PythonQtWrapper_QHexEdit::setReadOnly(QHexEdit* theWrappedObject, bool arg__1)
187 435 {
188 436 ( theWrappedObject->setReadOnly(arg__1));
189 437 }
190 438
191 439 void PythonQtWrapper_QHexEdit::setSelectionColor(QHexEdit* theWrappedObject, const QColor& color)
192 440 {
193 441 ( theWrappedObject->setSelectionColor(color));
194 442 }
195 443
196 444 QString PythonQtWrapper_QHexEdit::toReadableString(QHexEdit* theWrappedObject)
197 445 {
198 446 return ( theWrappedObject->toReadableString());
199 447 }
200 448
201 449
202 450
203 451 QHexSpinBox* PythonQtWrapper_QHexSpinBox::new_QHexSpinBox(QWidget* parent)
204 452 {
205 453 return new QHexSpinBox(parent); }
206 454
207 455 void PythonQtWrapper_QHexSpinBox::show(QHexSpinBox* theWrappedObject)
208 456 {
209 457 ( theWrappedObject->show());
210 458 }
211 459
212 460 QString PythonQtWrapper_QHexSpinBox::textFromValue(QHexSpinBox* theWrappedObject, int value) const
213 461 {
214 462 return ( theWrappedObject->textFromValue(value));
215 463 }
216 464
217 465 QValidator::State PythonQtWrapper_QHexSpinBox::validate(QHexSpinBox* theWrappedObject, QString& input, int& pos) const
218 466 {
219 467 return ( theWrappedObject->validate(input, pos));
220 468 }
221 469
222 470 int PythonQtWrapper_QHexSpinBox::valueFromText(QHexSpinBox* theWrappedObject, const QString& text) const
223 471 {
224 472 return ( theWrappedObject->valueFromText(text));
225 473 }
226 474
227 475
228 476
229 477 PythonQtShell_SocExplorerPlot::~PythonQtShell_SocExplorerPlot() {
230 478 PythonQtPrivate* priv = PythonQt::priv();
231 479 if (priv) { priv->shellClassDeleted(this); }
232 480 }
233 481 SocExplorerPlot* PythonQtWrapper_SocExplorerPlot::new_SocExplorerPlot(QWidget* parent)
234 482 {
235 483 return new PythonQtShell_SocExplorerPlot(parent); }
236 484
237 485 int PythonQtWrapper_SocExplorerPlot::addGraph(SocExplorerPlot* theWrappedObject)
238 486 {
239 487 return ( theWrappedObject->addGraph());
240 488 }
241 489
242 490 void PythonQtWrapper_SocExplorerPlot::addGraphData(SocExplorerPlot* theWrappedObject, int graphIndex, QList<QVariant > x, QList<QVariant > y)
243 491 {
244 492 ( theWrappedObject->addGraphData(graphIndex, x, y));
245 493 }
246 494
247 495 void PythonQtWrapper_SocExplorerPlot::addGraphData(SocExplorerPlot* theWrappedObject, int graphIndex, QVariant x, QVariant y)
248 496 {
249 497 ( theWrappedObject->addGraphData(graphIndex, x, y));
250 498 }
251 499
252 500 QPen PythonQtWrapper_SocExplorerPlot::getGraphPen(SocExplorerPlot* theWrappedObject, int graphIndex)
253 501 {
254 502 return ( theWrappedObject->getGraphPen(graphIndex));
255 503 }
256 504
257 505 void PythonQtWrapper_SocExplorerPlot::rescaleAxis(SocExplorerPlot* theWrappedObject)
258 506 {
259 507 ( theWrappedObject->rescaleAxis());
260 508 }
261 509
262 510 void PythonQtWrapper_SocExplorerPlot::setAdaptativeSampling(SocExplorerPlot* theWrappedObject, int graphIndex, bool enable)
263 511 {
264 512 ( theWrappedObject->setAdaptativeSampling(graphIndex, enable));
265 513 }
266 514
267 515 void PythonQtWrapper_SocExplorerPlot::setGraphData(SocExplorerPlot* theWrappedObject, int graphIndex, QList<QVariant > x, QList<QVariant > y)
268 516 {
269 517 ( theWrappedObject->setGraphData(graphIndex, x, y));
270 518 }
271 519
272 520 void PythonQtWrapper_SocExplorerPlot::setGraphLineStyle(SocExplorerPlot* theWrappedObject, int graphIndex, QString lineStyle)
273 521 {
274 522 ( theWrappedObject->setGraphLineStyle(graphIndex, lineStyle));
275 523 }
276 524
277 525 void PythonQtWrapper_SocExplorerPlot::setGraphName(SocExplorerPlot* theWrappedObject, int graphIndex, QString name)
278 526 {
279 527 ( theWrappedObject->setGraphName(graphIndex, name));
280 528 }
281 529
282 530 void PythonQtWrapper_SocExplorerPlot::setGraphPen(SocExplorerPlot* theWrappedObject, int graphIndex, QPen pen)
283 531 {
284 532 ( theWrappedObject->setGraphPen(graphIndex, pen));
285 533 }
286 534
287 535 void PythonQtWrapper_SocExplorerPlot::setGraphScatterStyle(SocExplorerPlot* theWrappedObject, int graphIndex, QString scatterStyle)
288 536 {
289 537 ( theWrappedObject->setGraphScatterStyle(graphIndex, scatterStyle));
290 538 }
291 539
292 540 void PythonQtWrapper_SocExplorerPlot::setLegendFont(SocExplorerPlot* theWrappedObject, QFont font)
293 541 {
294 542 ( theWrappedObject->setLegendFont(font));
295 543 }
296 544
297 545 void PythonQtWrapper_SocExplorerPlot::setLegendSelectedFont(SocExplorerPlot* theWrappedObject, QFont font)
298 546 {
299 547 ( theWrappedObject->setLegendSelectedFont(font));
300 548 }
301 549
302 550 void PythonQtWrapper_SocExplorerPlot::setTitle(SocExplorerPlot* theWrappedObject, QString title)
303 551 {
304 552 ( theWrappedObject->setTitle(title));
305 553 }
306 554
307 555 void PythonQtWrapper_SocExplorerPlot::setXaxisLabel(SocExplorerPlot* theWrappedObject, QString label)
308 556 {
309 557 ( theWrappedObject->setXaxisLabel(label));
310 558 }
311 559
312 560 void PythonQtWrapper_SocExplorerPlot::setXaxisRange(SocExplorerPlot* theWrappedObject, double lower, double upper)
313 561 {
314 562 ( theWrappedObject->setXaxisRange(lower, upper));
315 563 }
316 564
317 565 void PythonQtWrapper_SocExplorerPlot::setYaxisLabel(SocExplorerPlot* theWrappedObject, QString label)
318 566 {
319 567 ( theWrappedObject->setYaxisLabel(label));
320 568 }
321 569
322 570 void PythonQtWrapper_SocExplorerPlot::setYaxisRange(SocExplorerPlot* theWrappedObject, double lower, double upper)
323 571 {
324 572 ( theWrappedObject->setYaxisRange(lower, upper));
325 573 }
326 574
327 575 void PythonQtWrapper_SocExplorerPlot::show(SocExplorerPlot* theWrappedObject)
328 576 {
329 577 ( theWrappedObject->show());
330 578 }
331 579
332 580
333 581
334 582 TCP_Terminal_Client* PythonQtWrapper_TCP_Terminal_Client::new_TCP_Terminal_Client(QObject* parent)
335 583 {
336 584 return new TCP_Terminal_Client(parent); }
337 585
338 586 void PythonQtWrapper_TCP_Terminal_Client::connectToServer(TCP_Terminal_Client* theWrappedObject)
339 587 {
340 588 ( theWrappedObject->connectToServer());
341 589 }
342 590
343 591 void PythonQtWrapper_TCP_Terminal_Client::connectToServer(TCP_Terminal_Client* theWrappedObject, const QString& IP, int port)
344 592 {
345 593 ( theWrappedObject->connectToServer(IP, port));
346 594 }
347 595
348 596 bool PythonQtWrapper_TCP_Terminal_Client::isConnected(TCP_Terminal_Client* theWrappedObject)
349 597 {
350 598 return ( theWrappedObject->isConnected());
351 599 }
352 600
353 601 void PythonQtWrapper_TCP_Terminal_Client::sendText(TCP_Terminal_Client* theWrappedObject, const QString& text)
354 602 {
355 603 ( theWrappedObject->sendText(text));
356 604 }
357 605
358 606 void PythonQtWrapper_TCP_Terminal_Client::startServer(TCP_Terminal_Client* theWrappedObject)
359 607 {
360 608 ( theWrappedObject->startServer());
361 609 }
362 610
363 611 void PythonQtWrapper_TCP_Terminal_Client::startServer(TCP_Terminal_Client* theWrappedObject, int port)
364 612 {
365 613 ( theWrappedObject->startServer(port));
366 614 }
367 615
368 616
369 617
370 618 XByteArray* PythonQtWrapper_XByteArray::new_XByteArray()
371 619 {
372 620 return new XByteArray(); }
373 621
374 622 int PythonQtWrapper_XByteArray::addressOffset(XByteArray* theWrappedObject)
375 623 {
376 624 return ( theWrappedObject->addressOffset());
377 625 }
378 626
379 627 int PythonQtWrapper_XByteArray::addressWidth(XByteArray* theWrappedObject)
380 628 {
381 629 return ( theWrappedObject->addressWidth());
382 630 }
383 631
384 632 QChar PythonQtWrapper_XByteArray::asciiChar(XByteArray* theWrappedObject, int index)
385 633 {
386 634 return ( theWrappedObject->asciiChar(index));
387 635 }
388 636
389 637 QByteArray* PythonQtWrapper_XByteArray::data(XByteArray* theWrappedObject)
390 638 {
391 639 return &( theWrappedObject->data());
392 640 }
393 641
394 642 bool PythonQtWrapper_XByteArray::dataChanged(XByteArray* theWrappedObject, int i)
395 643 {
396 644 return ( theWrappedObject->dataChanged(i));
397 645 }
398 646
399 647 QByteArray PythonQtWrapper_XByteArray::dataChanged(XByteArray* theWrappedObject, int i, int len)
400 648 {
401 649 return ( theWrappedObject->dataChanged(i, len));
402 650 }
403 651
404 652 QByteArray* PythonQtWrapper_XByteArray::insert(XByteArray* theWrappedObject, int i, char ch)
405 653 {
406 654 return &( theWrappedObject->insert(i, ch));
407 655 }
408 656
409 657 QByteArray* PythonQtWrapper_XByteArray::insert(XByteArray* theWrappedObject, int i, const QByteArray& ba)
410 658 {
411 659 return &( theWrappedObject->insert(i, ba));
412 660 }
413 661
414 662 int PythonQtWrapper_XByteArray::realAddressNumbers(XByteArray* theWrappedObject)
415 663 {
416 664 return ( theWrappedObject->realAddressNumbers());
417 665 }
418 666
419 667 QByteArray* PythonQtWrapper_XByteArray::remove(XByteArray* theWrappedObject, int pos, int len)
420 668 {
421 669 return &( theWrappedObject->remove(pos, len));
422 670 }
423 671
424 672 QByteArray* PythonQtWrapper_XByteArray::replace(XByteArray* theWrappedObject, int index, char ch)
425 673 {
426 674 return &( theWrappedObject->replace(index, ch));
427 675 }
428 676
429 677 QByteArray* PythonQtWrapper_XByteArray::replace(XByteArray* theWrappedObject, int index, const QByteArray& ba)
430 678 {
431 679 return &( theWrappedObject->replace(index, ba));
432 680 }
433 681
434 682 QByteArray* PythonQtWrapper_XByteArray::replace(XByteArray* theWrappedObject, int index, int length, const QByteArray& ba)
435 683 {
436 684 return &( theWrappedObject->replace(index, length, ba));
437 685 }
438 686
439 687 void PythonQtWrapper_XByteArray::setAddressOffset(XByteArray* theWrappedObject, int offset)
440 688 {
441 689 ( theWrappedObject->setAddressOffset(offset));
442 690 }
443 691
444 692 void PythonQtWrapper_XByteArray::setAddressWidth(XByteArray* theWrappedObject, int width)
445 693 {
446 694 ( theWrappedObject->setAddressWidth(width));
447 695 }
448 696
449 697 void PythonQtWrapper_XByteArray::setData(XByteArray* theWrappedObject, QByteArray data)
450 698 {
451 699 ( theWrappedObject->setData(data));
452 700 }
453 701
454 702 void PythonQtWrapper_XByteArray::setDataChanged(XByteArray* theWrappedObject, int i, bool state)
455 703 {
456 704 ( theWrappedObject->setDataChanged(i, state));
457 705 }
458 706
459 707 void PythonQtWrapper_XByteArray::setDataChanged(XByteArray* theWrappedObject, int i, const QByteArray& state)
460 708 {
461 709 ( theWrappedObject->setDataChanged(i, state));
462 710 }
463 711
464 712 int PythonQtWrapper_XByteArray::size(XByteArray* theWrappedObject)
465 713 {
466 714 return ( theWrappedObject->size());
467 715 }
468 716
469 717 QString PythonQtWrapper_XByteArray::toRedableString(XByteArray* theWrappedObject, int start, int end)
470 718 {
471 719 return ( theWrappedObject->toRedableString(start, end));
472 720 }
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 856 elfFileWidget* PythonQtWrapper_elfFileWidget::new_elfFileWidget(QWidget* parent)
477 857 {
478 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 868 elfparser* PythonQtWrapper_elfparser::new_elfparser()
483 869 {
484 870 return new elfparser(); }
485 871
486 872 int PythonQtWrapper_elfparser::closeFile(elfparser* theWrappedObject)
487 873 {
488 874 return ( theWrappedObject->closeFile());
489 875 }
490 876
491 877 QString PythonQtWrapper_elfparser::getABI(elfparser* theWrappedObject)
492 878 {
493 879 return ( theWrappedObject->getABI());
494 880 }
495 881
496 882 QString PythonQtWrapper_elfparser::getArchitecture(elfparser* theWrappedObject)
497 883 {
498 884 return ( theWrappedObject->getArchitecture());
499 885 }
500 886
501 887 QString PythonQtWrapper_elfparser::getClass(elfparser* theWrappedObject)
502 888 {
503 889 return ( theWrappedObject->getClass());
504 890 }
505 891
506 892 QString PythonQtWrapper_elfparser::getEndianness(elfparser* theWrappedObject)
507 893 {
508 894 return ( theWrappedObject->getEndianness());
509 895 }
510 896
897 qint64 PythonQtWrapper_elfparser::getEntryPointAddress(elfparser* theWrappedObject)
898 {
899 return ( theWrappedObject->getEntryPointAddress());
900 }
901
511 902 bool PythonQtWrapper_elfparser::getSectionData(elfparser* theWrappedObject, int index, char** buffer)
512 903 {
513 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 917 QString PythonQtWrapper_elfparser::getSectionName(elfparser* theWrappedObject, int index)
517 918 {
518 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 927 QString PythonQtWrapper_elfparser::getSectionType(elfparser* theWrappedObject, int index)
522 928 {
523 929 return ( theWrappedObject->getSectionType(index));
524 930 }
525 931
526 932 int PythonQtWrapper_elfparser::getSectioncount(elfparser* theWrappedObject)
527 933 {
528 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 942 QString PythonQtWrapper_elfparser::getSegmentFlags(elfparser* theWrappedObject, int index)
532 943 {
533 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 962 QString PythonQtWrapper_elfparser::getSegmentType(elfparser* theWrappedObject, int index)
537 963 {
538 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 972 int PythonQtWrapper_elfparser::getSegmentcount(elfparser* theWrappedObject)
542 973 {
543 974 return ( theWrappedObject->getSegmentcount());
544 975 }
545 976
546 977 QString PythonQtWrapper_elfparser::getType(elfparser* theWrappedObject)
547 978 {
548 979 return ( theWrappedObject->getType());
549 980 }
550 981
982 qint64 PythonQtWrapper_elfparser::getVersion(elfparser* theWrappedObject)
983 {
984 return ( theWrappedObject->getVersion());
985 }
986
551 987 bool PythonQtWrapper_elfparser::static_elfparser_isElf(const QString& File)
552 988 {
553 989 return (elfparser::isElf(File));
554 990 }
555 991
556 992 bool PythonQtWrapper_elfparser::iself(elfparser* theWrappedObject)
557 993 {
558 994 return ( theWrappedObject->iself());
559 995 }
560 996
561 997 bool PythonQtWrapper_elfparser::isopened(elfparser* theWrappedObject)
562 998 {
563 999 return ( theWrappedObject->isopened());
564 1000 }
565 1001
566 1002 int PythonQtWrapper_elfparser::setFilename(elfparser* theWrappedObject, const QString& name)
567 1003 {
568 1004 return ( theWrappedObject->setFilename(name));
569 1005 }
570 1006
571 1007
@@ -1,243 +1,369
1 1 #include <PythonQt.h>
2 2 #include <QObject>
3 3 #include <QVariant>
4 4 #include <SocExplorerPlot.h>
5 #include <abstractexecfile.h>
5 6 #include <elffile.h>
6 7 #include <elffilewidget.h>
8 #include <elfinfowdgt.h>
7 9 #include <elfparser.h>
8 10 #include <memsizewdgt.h>
9 11 #include <qhexedit.h>
10 12 #include <qhexspinbox.h>
11 13 #include <tcp_terminal_client.h>
12 14 #include <xbytearray.h>
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 42 class PythonQtWrapper_ElfFile : public QObject
17 43 { Q_OBJECT
18 44 public:
19 45 public slots:
20 ElfFile* new_ElfFile(QObject* parent = 0);
21 ElfFile* new_ElfFile(const QString& File, QObject* parent = 0);
46 ElfFile* new_ElfFile();
47 ElfFile* new_ElfFile(const QString& File);
22 48 void delete_ElfFile(ElfFile* obj) { delete obj; }
23 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 76 bool isopened(ElfFile* theWrappedObject);
25 77 bool openFile(ElfFile* theWrappedObject, const QString& File);
26 78 };
27 79
28 80
29 81
30 82
31 83
32 84 class PythonQtWrapper_MemSizeWdgt : public QObject
33 85 { Q_OBJECT
34 86 public:
35 87 public slots:
36 88 MemSizeWdgt* new_MemSizeWdgt(QWidget* parent = 0);
37 89 MemSizeWdgt* new_MemSizeWdgt(int defaultSize, QWidget* parent = 0);
38 90 void delete_MemSizeWdgt(MemSizeWdgt* obj) { delete obj; }
39 91 int getsize(MemSizeWdgt* theWrappedObject);
40 92 void setMaximum(MemSizeWdgt* theWrappedObject, unsigned int max);
41 93 void show(MemSizeWdgt* theWrappedObject);
42 94 void updateSizeValue(MemSizeWdgt* theWrappedObject);
43 95 };
44 96
45 97
46 98
47 99
48 100
49 101 class PythonQtShell_QHexEdit : public QHexEdit
50 102 {
51 103 public:
52 104 PythonQtShell_QHexEdit(QWidget* parent = 0):QHexEdit(parent),_wrapper(NULL) {};
53 105
54 106 ~PythonQtShell_QHexEdit();
55 107
56 108
57 109 PythonQtInstanceWrapper* _wrapper;
58 110 };
59 111
60 112 class PythonQtWrapper_QHexEdit : public QObject
61 113 { Q_OBJECT
62 114 public:
63 115 public slots:
64 116 QHexEdit* new_QHexEdit(QWidget* parent = 0);
65 117 void delete_QHexEdit(QHexEdit* obj) { delete obj; }
66 118 QColor addressAreaColor(QHexEdit* theWrappedObject);
67 119 int addressOffset(QHexEdit* theWrappedObject);
68 120 int cursorPosition(QHexEdit* theWrappedObject);
69 121 QByteArray data(QHexEdit* theWrappedObject);
70 122 const QFont* font(QHexEdit* theWrappedObject) const;
71 123 QColor highlightingColor(QHexEdit* theWrappedObject);
72 124 int indexOf(QHexEdit* theWrappedObject, const QByteArray& ba, int from = 0) const;
73 125 void insert(QHexEdit* theWrappedObject, int i, char ch);
74 126 void insert(QHexEdit* theWrappedObject, int i, const QByteArray& ba);
75 127 bool isReadOnly(QHexEdit* theWrappedObject);
76 128 int lastIndexOf(QHexEdit* theWrappedObject, const QByteArray& ba, int from = 0) const;
77 129 bool overwriteMode(QHexEdit* theWrappedObject);
78 130 void remove(QHexEdit* theWrappedObject, int pos, int len = 1);
79 131 void replace(QHexEdit* theWrappedObject, int pos, int len, const QByteArray& after);
80 132 QColor selectionColor(QHexEdit* theWrappedObject);
81 133 QString selectionToReadableString(QHexEdit* theWrappedObject);
82 134 void setAddressAreaColor(QHexEdit* theWrappedObject, const QColor& color);
83 135 void setAddressOffset(QHexEdit* theWrappedObject, int offset);
84 136 void setCursorPosition(QHexEdit* theWrappedObject, int cusorPos);
85 137 void setData(QHexEdit* theWrappedObject, const QByteArray& data);
86 138 void setFont(QHexEdit* theWrappedObject, const QFont& arg__1);
87 139 void setHighlightingColor(QHexEdit* theWrappedObject, const QColor& color);
88 140 void setOverwriteMode(QHexEdit* theWrappedObject, bool arg__1);
89 141 void setReadOnly(QHexEdit* theWrappedObject, bool arg__1);
90 142 void setSelectionColor(QHexEdit* theWrappedObject, const QColor& color);
91 143 QString toReadableString(QHexEdit* theWrappedObject);
92 144 };
93 145
94 146
95 147
96 148
97 149
98 150 class PythonQtWrapper_QHexSpinBox : public QObject
99 151 { Q_OBJECT
100 152 public:
101 153 public slots:
102 154 QHexSpinBox* new_QHexSpinBox(QWidget* parent = 0);
103 155 void delete_QHexSpinBox(QHexSpinBox* obj) { delete obj; }
104 156 void show(QHexSpinBox* theWrappedObject);
105 157 QString textFromValue(QHexSpinBox* theWrappedObject, int value) const;
106 158 QValidator::State validate(QHexSpinBox* theWrappedObject, QString& input, int& pos) const;
107 159 int valueFromText(QHexSpinBox* theWrappedObject, const QString& text) const;
108 160 };
109 161
110 162
111 163
112 164
113 165
114 166 class PythonQtShell_SocExplorerPlot : public SocExplorerPlot
115 167 {
116 168 public:
117 169 PythonQtShell_SocExplorerPlot(QWidget* parent = 0):SocExplorerPlot(parent),_wrapper(NULL) {};
118 170
119 171 ~PythonQtShell_SocExplorerPlot();
120 172
121 173
122 174 PythonQtInstanceWrapper* _wrapper;
123 175 };
124 176
125 177 class PythonQtWrapper_SocExplorerPlot : public QObject
126 178 { Q_OBJECT
127 179 public:
128 180 public slots:
129 181 SocExplorerPlot* new_SocExplorerPlot(QWidget* parent = 0);
130 182 void delete_SocExplorerPlot(SocExplorerPlot* obj) { delete obj; }
131 183 int addGraph(SocExplorerPlot* theWrappedObject);
132 184 void addGraphData(SocExplorerPlot* theWrappedObject, int graphIndex, QList<QVariant > x, QList<QVariant > y);
133 185 void addGraphData(SocExplorerPlot* theWrappedObject, int graphIndex, QVariant x, QVariant y);
134 186 QPen getGraphPen(SocExplorerPlot* theWrappedObject, int graphIndex);
135 187 void rescaleAxis(SocExplorerPlot* theWrappedObject);
136 188 void setAdaptativeSampling(SocExplorerPlot* theWrappedObject, int graphIndex, bool enable);
137 189 void setGraphData(SocExplorerPlot* theWrappedObject, int graphIndex, QList<QVariant > x, QList<QVariant > y);
138 190 void setGraphLineStyle(SocExplorerPlot* theWrappedObject, int graphIndex, QString lineStyle);
139 191 void setGraphName(SocExplorerPlot* theWrappedObject, int graphIndex, QString name);
140 192 void setGraphPen(SocExplorerPlot* theWrappedObject, int graphIndex, QPen pen);
141 193 void setGraphScatterStyle(SocExplorerPlot* theWrappedObject, int graphIndex, QString scatterStyle);
142 194 void setLegendFont(SocExplorerPlot* theWrappedObject, QFont font);
143 195 void setLegendSelectedFont(SocExplorerPlot* theWrappedObject, QFont font);
144 196 void setTitle(SocExplorerPlot* theWrappedObject, QString title);
145 197 void setXaxisLabel(SocExplorerPlot* theWrappedObject, QString label);
146 198 void setXaxisRange(SocExplorerPlot* theWrappedObject, double lower, double upper);
147 199 void setYaxisLabel(SocExplorerPlot* theWrappedObject, QString label);
148 200 void setYaxisRange(SocExplorerPlot* theWrappedObject, double lower, double upper);
149 201 void show(SocExplorerPlot* theWrappedObject);
150 202 };
151 203
152 204
153 205
154 206
155 207
156 208 class PythonQtWrapper_TCP_Terminal_Client : public QObject
157 209 { Q_OBJECT
158 210 public:
159 211 public slots:
160 212 TCP_Terminal_Client* new_TCP_Terminal_Client(QObject* parent = 0);
161 213 void delete_TCP_Terminal_Client(TCP_Terminal_Client* obj) { delete obj; }
162 214 void connectToServer(TCP_Terminal_Client* theWrappedObject);
163 215 void connectToServer(TCP_Terminal_Client* theWrappedObject, const QString& IP, int port);
164 216 bool isConnected(TCP_Terminal_Client* theWrappedObject);
165 217 void sendText(TCP_Terminal_Client* theWrappedObject, const QString& text);
166 218 void startServer(TCP_Terminal_Client* theWrappedObject);
167 219 void startServer(TCP_Terminal_Client* theWrappedObject, int port);
168 220 };
169 221
170 222
171 223
172 224
173 225
174 226 class PythonQtWrapper_XByteArray : public QObject
175 227 { Q_OBJECT
176 228 public:
177 229 public slots:
178 230 XByteArray* new_XByteArray();
179 231 void delete_XByteArray(XByteArray* obj) { delete obj; }
180 232 int addressOffset(XByteArray* theWrappedObject);
181 233 int addressWidth(XByteArray* theWrappedObject);
182 234 QChar asciiChar(XByteArray* theWrappedObject, int index);
183 235 QByteArray* data(XByteArray* theWrappedObject);
184 236 bool dataChanged(XByteArray* theWrappedObject, int i);
185 237 QByteArray dataChanged(XByteArray* theWrappedObject, int i, int len);
186 238 QByteArray* insert(XByteArray* theWrappedObject, int i, char ch);
187 239 QByteArray* insert(XByteArray* theWrappedObject, int i, const QByteArray& ba);
188 240 int realAddressNumbers(XByteArray* theWrappedObject);
189 241 QByteArray* remove(XByteArray* theWrappedObject, int pos, int len);
190 242 QByteArray* replace(XByteArray* theWrappedObject, int index, char ch);
191 243 QByteArray* replace(XByteArray* theWrappedObject, int index, const QByteArray& ba);
192 244 QByteArray* replace(XByteArray* theWrappedObject, int index, int length, const QByteArray& ba);
193 245 void setAddressOffset(XByteArray* theWrappedObject, int offset);
194 246 void setAddressWidth(XByteArray* theWrappedObject, int width);
195 247 void setData(XByteArray* theWrappedObject, QByteArray data);
196 248 void setDataChanged(XByteArray* theWrappedObject, int i, bool state);
197 249 void setDataChanged(XByteArray* theWrappedObject, int i, const QByteArray& state);
198 250 int size(XByteArray* theWrappedObject);
199 251 QString toRedableString(XByteArray* theWrappedObject, int start = 0, int end = -1);
200 252 };
201 253
202 254
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 310 class PythonQtWrapper_elfFileWidget : public QObject
207 311 { Q_OBJECT
208 312 public:
209 313 public slots:
210 314 elfFileWidget* new_elfFileWidget(QWidget* parent = 0);
211 315 void delete_elfFileWidget(elfFileWidget* obj) { delete obj; }
212 316 };
213 317
214 318
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 334 class PythonQtWrapper_elfparser : public QObject
219 335 { Q_OBJECT
220 336 public:
221 337 public slots:
222 338 elfparser* new_elfparser();
223 339 void delete_elfparser(elfparser* obj) { delete obj; }
224 340 int closeFile(elfparser* theWrappedObject);
225 341 QString getABI(elfparser* theWrappedObject);
226 342 QString getArchitecture(elfparser* theWrappedObject);
227 343 QString getClass(elfparser* theWrappedObject);
228 344 QString getEndianness(elfparser* theWrappedObject);
345 qint64 getEntryPointAddress(elfparser* theWrappedObject);
229 346 bool getSectionData(elfparser* theWrappedObject, int index, char** buffer);
347 qint64 getSectionDatasz(elfparser* theWrappedObject, int index);
348 qint64 getSectionMemsz(elfparser* theWrappedObject, int index);
230 349 QString getSectionName(elfparser* theWrappedObject, int index);
350 qint64 getSectionPaddr(elfparser* theWrappedObject, int index);
231 351 QString getSectionType(elfparser* theWrappedObject, int index);
232 352 int getSectioncount(elfparser* theWrappedObject);
353 qint64 getSegmentFilesz(elfparser* theWrappedObject, int index);
233 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 358 QString getSegmentType(elfparser* theWrappedObject, int index);
359 qint64 getSegmentVaddr(elfparser* theWrappedObject, int index);
235 360 int getSegmentcount(elfparser* theWrappedObject);
236 361 QString getType(elfparser* theWrappedObject);
362 qint64 getVersion(elfparser* theWrappedObject);
237 363 bool static_elfparser_isElf(const QString& File);
238 364 bool iself(elfparser* theWrappedObject);
239 365 bool isopened(elfparser* theWrappedObject);
240 366 int setFilename(elfparser* theWrappedObject, const QString& name);
241 367 };
242 368
243 369
@@ -1,16 +1,20
1 1 #include <PythonQt.h>
2 2 #include "PySocExplorer0.h"
3 3
4 4
5 5 void PythonQt_init_PySocExplorer(PyObject* module) {
6 PythonQt::priv()->registerClass(&ElfFile::staticMetaObject, "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_ElfFile>, NULL, module, 0);
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 8 PythonQt::priv()->registerCPPClass("MemSizeWdgt", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_MemSizeWdgt>, NULL, module, 0);
8 9 PythonQt::priv()->registerCPPClass("QHexEdit", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_QHexEdit>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_QHexEdit>, module, 0);
9 10 PythonQt::priv()->registerCPPClass("QHexSpinBox", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_QHexSpinBox>, NULL, module, 0);
10 11 PythonQt::priv()->registerCPPClass("SocExplorerPlot", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_SocExplorerPlot>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_SocExplorerPlot>, module, 0);
11 12 PythonQt::priv()->registerClass(&TCP_Terminal_Client::staticMetaObject, "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_TCP_Terminal_Client>, NULL, module, 0);
12 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 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 18 PythonQt::priv()->registerCPPClass("elfparser", "", "PySocExplorer", PythonQtCreateObject<PythonQtWrapper_elfparser>, NULL, module, 0);
15 19
16 20 }
@@ -1,34 +1,29
1 1 <typesystem package="PySocExplorer" default-superclass="com.trolltech.qt.QtJambiObject">
2 <load-typesystem name=":/trolltech/generator/typesystem_core.txt" generate="yes" />
3 <load-typesystem name=":/trolltech/generator/typesystem_gui.txt" generate="yes" />
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" />
2 <load-typesystem name=":/trolltech/generator/typesystem_core.txt" generate="no" />
3 <load-typesystem name=":/trolltech/generator/typesystem_gui.txt" generate="no" />
7 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 7 <object-type name="QHexSpinBox" />
16 8 <object-type name="MemSizeWdgt" />
17 9 <object-type name="QHexEdit" />
18 10 <object-type name="XByteArray" />
19 11 <object-type name="SocExplorerPlot" />
20 12 <object-type name="TCP_Terminal_Client" />
13 <object-type name="codeFragment" />
14 <rejection class="Elf_Section"/>
21 15 <object-type name="elfparser" />
22 <object-type name="abstractExecFile" />
16 <interface-type name="abstractExecFile" />
23 17 <object-type name="ElfFile" />
24 <object-type name="elfFileWidget" />
18 <object-type name="elfFileWidget" />
19 <object-type name="elfInfoWdgt" />
25 20
26 21 </typesystem>
27 22
28 23
29 24
30 25
31 26
32 27
33 28
34 29
@@ -1,6 +1,6
1 1 #!/bin/bash
2 2
3 3 #export QTDIR=/usr/include
4 export QTDIR=/usr/include/qt5
4 #export QTDIR=/usr/include/qt5
5 5
6 pythonqt_generator --dump-object-tree --output-directory=pythonQtOut PySocExplorer.h pythonQtgeneratorCfg.txt
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