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