##// END OF EJS Templates
Elf Symbol enumeration working, elf update buggy!
jeandet -
r42:302baaf8abc1 default
parent child
Show More
@@ -1,846 +1,1006
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()
26 ElfFile::ElfFile()
27 :abstractExecFile()
27 :abstractExecFile()
28 {
28 {
29 this->opened = false;
29 this->opened = false;
30 this->type_elf = false;
30 this->type_elf = false;
31 this->elfFile = NULL;
31 this->elfFile = NULL;
32 this->e = NULL;
32 this->e = NULL;
33 }
33 }
34
34
35 ElfFile::ElfFile(const QString &File)
35 ElfFile::ElfFile(const QString &File)
36 :abstractExecFile()
36 :abstractExecFile()
37 {
37 {
38 this->opened = false;
38 this->opened = false;
39 this->type_elf = false;
39 this->type_elf = false;
40 this->elfFile = NULL;
40 this->elfFile = NULL;
41 this->e = NULL;
41 this->e = NULL;
42 this->p_fileName = File;
42 this->p_fileName = File;
43 openFile(File);
43 openFile(File);
44 }
44 }
45
45
46 bool ElfFile::openFile(const QString &File)
46 bool ElfFile::openFile(const QString &File)
47 {
47 {
48 this->p_fileName = File;
48 this->p_fileName = File;
49 this->closeFile();
49 this->closeFile();
50 if(elf_version(EV_CURRENT)==EV_NONE)return 0;
50 if(elf_version(EV_CURRENT)==EV_NONE)return 0;
51 #ifdef _ELF_WINDOWS_
51 #ifdef _ELF_WINDOWS_
52 this->elfFile = open(File.toStdString().c_str(),O_RDONLY|O_BINARY ,0);
52 this->elfFile = open(File.toStdString().c_str(),O_RDONLY|O_BINARY ,0);
53 #else
53 #else
54 this->elfFile = open(File.toStdString().c_str(),O_RDONLY ,0);
54 this->elfFile = open(File.toStdString().c_str(),O_RDONLY ,0);
55 #endif
55 #endif
56 if(this->elfFile==NULL)return 0;
56 if(this->elfFile==NULL)return 0;
57 this->e = elf_begin(this->elfFile,ELF_C_READ,NULL);
57 this->e = elf_begin(this->elfFile,ELF_C_READ,NULL);
58 if(this->e==NULL)return 0;
58 if(this->e==NULL)return 0;
59 this->ek = elf_kind(this->e);
59 this->ek = elf_kind(this->e);
60 gelf_getehdr (this->e, &this->ehdr );
60 gelf_getehdr (this->e, &this->ehdr );
61 elf_getshdrstrndx (this->e, &this->shstrndx);
61 elf_getshdrstrndx (this->e, &this->shstrndx);
62 this->updateSegments();
62 this->updateSegments();
63 this->updateSections();
63 this->updateSections();
64 this->updateSymbols();
64 this->updateSymbols();
65 this->opened = true;
65 this->opened = true;
66 return 1;
66 return 1;
67 }
67 }
68
68
69 bool ElfFile::isopened()
69 bool ElfFile::isopened()
70 {
70 {
71 return this->opened;
71 return this->opened;
72 }
72 }
73
73
74 int ElfFile::closeFile()
74 int ElfFile::closeFile()
75 {
75 {
76 if(this->elfFile!=NULL)
76 if(this->elfFile!=NULL)
77 {
77 {
78 if(this->e!=NULL)
78 if(this->e!=NULL)
79 {
79 {
80 elf_end(this->e);
80 elf_end(this->e);
81 this->e = NULL;
81 this->e = NULL;
82 }
82 }
83 close(this->elfFile);
83 close(this->elfFile);
84 this->elfFile = NULL;
84 this->elfFile = NULL;
85 }
85 }
86 this->opened = false;
86 this->opened = false;
87 return 0;
87 return 0;
88 }
88 }
89
89
90
90
91 QList<codeFragment*> ElfFile::getFragments(QStringList fragmentList)
91 QList<codeFragment*> ElfFile::getFragments(QStringList fragmentList)
92 {
92 {
93 QList<codeFragment*> fragments;
93 QList<codeFragment*> fragments;
94 if (isopened())
94 if (isopened())
95 {
95 {
96 for(int i =0;i<fragmentList.count();i++)
96 for(int i =0;i<fragmentList.count();i++)
97 {
97 {
98 fragments.append(getFragment(fragmentList.at(i)));
98 fragments.append(getFragment(fragmentList.at(i)));
99 }
99 }
100 }
100 }
101 return fragments;
101 return fragments;
102 }
102 }
103
103
104 QList<codeFragment*> ElfFile::getFragments()
104 QList<codeFragment*> ElfFile::getFragments()
105 {
105 {
106 return getFragments(QStringList()<<".data"<<".text");
106 return getFragments(QStringList()<<".data"<<".text");
107 }
107 }
108
108
109 codeFragment *ElfFile::getFragment(const QString &name)
109 codeFragment *ElfFile::getFragment(const QString &name)
110 {
110 {
111 codeFragment* fragment= new codeFragment();
111 codeFragment* fragment= new codeFragment();
112 for(int i=0;i<getSectionCount();i++)
112 for(int i=0;i<getSectionCount();i++)
113 {
113 {
114 if(getSectionName(i) == name)
114 if(getSectionName(i) == name)
115 {
115 {
116 fragment->data =NULL;
116 fragment->data =NULL;
117 fragment->size = getSectionDatasz(i);
117 fragment->size = getSectionDatasz(i);
118 fragment->address = getSectionPaddr(i);
118 fragment->address = getSectionPaddr(i);
119 getSectionData(i,&fragment->data);
119 getSectionData(i,&fragment->data);
120 }
120 }
121 }
121 }
122
122
123 }
123 }
124
124
125
125
126
126
127
127
128
128
129
129
130
130
131 QString elfresolveMachine(Elf64_Half e_machine)
131 QString elfresolveMachine(Elf64_Half e_machine)
132 {
132 {
133 QString machineName;
133 QString machineName;
134 //Update from with bash script don't write it by yourself!
134 //Update from with bash script don't write it by yourself!
135 switch(e_machine)
135 switch(e_machine)
136 {
136 {
137 case EM_NONE:
137 case EM_NONE:
138 machineName = " No machine ";
138 machineName = " No machine ";
139 break;
139 break;
140 case EM_M32:
140 case EM_M32:
141 machineName = " AT&T WE 32100 ";
141 machineName = " AT&T WE 32100 ";
142 break;
142 break;
143 case EM_SPARC:
143 case EM_SPARC:
144 machineName = " SUN SPARC ";
144 machineName = " SUN SPARC ";
145 break;
145 break;
146 case EM_386:
146 case EM_386:
147 machineName = " Intel 80386 ";
147 machineName = " Intel 80386 ";
148 break;
148 break;
149 case EM_68K:
149 case EM_68K:
150 machineName = " Motorola m68k family ";
150 machineName = " Motorola m68k family ";
151 break;
151 break;
152 case EM_88K:
152 case EM_88K:
153 machineName = " Motorola m88k family ";
153 machineName = " Motorola m88k family ";
154 break;
154 break;
155 case EM_860:
155 case EM_860:
156 machineName = " Intel 80860 ";
156 machineName = " Intel 80860 ";
157 break;
157 break;
158 case EM_MIPS:
158 case EM_MIPS:
159 machineName = " MIPS R3000 big-endian ";
159 machineName = " MIPS R3000 big-endian ";
160 break;
160 break;
161 case EM_S370:
161 case EM_S370:
162 machineName = " IBM System/370 ";
162 machineName = " IBM System/370 ";
163 break;
163 break;
164 case EM_MIPS_RS3_LE:
164 case EM_MIPS_RS3_LE:
165 machineName = " MIPS R3000 little-endian ";
165 machineName = " MIPS R3000 little-endian ";
166 break;
166 break;
167 case EM_PARISC:
167 case EM_PARISC:
168 machineName = " HPPA ";
168 machineName = " HPPA ";
169 break;
169 break;
170 case EM_VPP500:
170 case EM_VPP500:
171 machineName = " Fujitsu VPP500 ";
171 machineName = " Fujitsu VPP500 ";
172 break;
172 break;
173 case EM_SPARC32PLUS:
173 case EM_SPARC32PLUS:
174 machineName = " Sun's \"v8plus\" ";
174 machineName = " Sun's \"v8plus\" ";
175 break;
175 break;
176 case EM_960:
176 case EM_960:
177 machineName = " Intel 80960 ";
177 machineName = " Intel 80960 ";
178 break;
178 break;
179 case EM_PPC:
179 case EM_PPC:
180 machineName = " PowerPC ";
180 machineName = " PowerPC ";
181 break;
181 break;
182 case EM_PPC64:
182 case EM_PPC64:
183 machineName = " PowerPC 64-bit ";
183 machineName = " PowerPC 64-bit ";
184 break;
184 break;
185 case EM_S390:
185 case EM_S390:
186 machineName = " IBM S390 ";
186 machineName = " IBM S390 ";
187 break;
187 break;
188 case EM_V800:
188 case EM_V800:
189 machineName = " NEC V800 series ";
189 machineName = " NEC V800 series ";
190 break;
190 break;
191 case EM_FR20:
191 case EM_FR20:
192 machineName = " Fujitsu FR20 ";
192 machineName = " Fujitsu FR20 ";
193 break;
193 break;
194 case EM_RH32:
194 case EM_RH32:
195 machineName = " TRW RH-32 ";
195 machineName = " TRW RH-32 ";
196 break;
196 break;
197 case EM_RCE:
197 case EM_RCE:
198 machineName = " Motorola RCE ";
198 machineName = " Motorola RCE ";
199 break;
199 break;
200 case EM_ARM:
200 case EM_ARM:
201 machineName = " ARM ";
201 machineName = " ARM ";
202 break;
202 break;
203 case EM_FAKE_ALPHA:
203 case EM_FAKE_ALPHA:
204 machineName = " Digital Alpha ";
204 machineName = " Digital Alpha ";
205 break;
205 break;
206 case EM_SH:
206 case EM_SH:
207 machineName = " Hitachi SH ";
207 machineName = " Hitachi SH ";
208 break;
208 break;
209 case EM_SPARCV9:
209 case EM_SPARCV9:
210 machineName = " SPARC v9 64-bit ";
210 machineName = " SPARC v9 64-bit ";
211 break;
211 break;
212 case EM_TRICORE:
212 case EM_TRICORE:
213 machineName = " Siemens Tricore ";
213 machineName = " Siemens Tricore ";
214 break;
214 break;
215 case EM_ARC:
215 case EM_ARC:
216 machineName = " Argonaut RISC Core ";
216 machineName = " Argonaut RISC Core ";
217 break;
217 break;
218 case EM_H8_300:
218 case EM_H8_300:
219 machineName = " Hitachi H8/300 ";
219 machineName = " Hitachi H8/300 ";
220 break;
220 break;
221 case EM_H8_300H:
221 case EM_H8_300H:
222 machineName = " Hitachi H8/300H ";
222 machineName = " Hitachi H8/300H ";
223 break;
223 break;
224 case EM_H8S:
224 case EM_H8S:
225 machineName = " Hitachi H8S ";
225 machineName = " Hitachi H8S ";
226 break;
226 break;
227 case EM_H8_500:
227 case EM_H8_500:
228 machineName = " Hitachi H8/500 ";
228 machineName = " Hitachi H8/500 ";
229 break;
229 break;
230 case EM_IA_64:
230 case EM_IA_64:
231 machineName = " Intel Merced ";
231 machineName = " Intel Merced ";
232 break;
232 break;
233 case EM_MIPS_X:
233 case EM_MIPS_X:
234 machineName = " Stanford MIPS-X ";
234 machineName = " Stanford MIPS-X ";
235 break;
235 break;
236 case EM_COLDFIRE:
236 case EM_COLDFIRE:
237 machineName = " Motorola Coldfire ";
237 machineName = " Motorola Coldfire ";
238 break;
238 break;
239 case EM_68HC12:
239 case EM_68HC12:
240 machineName = " Motorola M68HC12 ";
240 machineName = " Motorola M68HC12 ";
241 break;
241 break;
242 case EM_MMA:
242 case EM_MMA:
243 machineName = " Fujitsu MMA Multimedia Accelerator";
243 machineName = " Fujitsu MMA Multimedia Accelerator";
244 break;
244 break;
245 case EM_PCP:
245 case EM_PCP:
246 machineName = " Siemens PCP ";
246 machineName = " Siemens PCP ";
247 break;
247 break;
248 case EM_NCPU:
248 case EM_NCPU:
249 machineName = " Sony nCPU embeeded RISC ";
249 machineName = " Sony nCPU embeeded RISC ";
250 break;
250 break;
251 case EM_NDR1:
251 case EM_NDR1:
252 machineName = " Denso NDR1 microprocessor ";
252 machineName = " Denso NDR1 microprocessor ";
253 break;
253 break;
254 case EM_STARCORE:
254 case EM_STARCORE:
255 machineName = " Motorola Start*Core processor ";
255 machineName = " Motorola Start*Core processor ";
256 break;
256 break;
257 case EM_ME16:
257 case EM_ME16:
258 machineName = " Toyota ME16 processor ";
258 machineName = " Toyota ME16 processor ";
259 break;
259 break;
260 case EM_ST100:
260 case EM_ST100:
261 machineName = " STMicroelectronic ST100 processor ";
261 machineName = " STMicroelectronic ST100 processor ";
262 break;
262 break;
263 case EM_TINYJ:
263 case EM_TINYJ:
264 machineName = " Advanced Logic Corp. Tinyj emb.fam";
264 machineName = " Advanced Logic Corp. Tinyj emb.fam";
265 break;
265 break;
266 case EM_X86_64:
266 case EM_X86_64:
267 machineName = " AMD x86-64 architecture ";
267 machineName = " AMD x86-64 architecture ";
268 break;
268 break;
269 case EM_PDSP:
269 case EM_PDSP:
270 machineName = " Sony DSP Processor ";
270 machineName = " Sony DSP Processor ";
271 break;
271 break;
272 case EM_FX66:
272 case EM_FX66:
273 machineName = " Siemens FX66 microcontroller ";
273 machineName = " Siemens FX66 microcontroller ";
274 break;
274 break;
275 case EM_ST9PLUS:
275 case EM_ST9PLUS:
276 machineName = " STMicroelectronics ST9+ 8/16 mc ";
276 machineName = " STMicroelectronics ST9+ 8/16 mc ";
277 break;
277 break;
278 case EM_ST7:
278 case EM_ST7:
279 machineName = " STmicroelectronics ST7 8 bit mc ";
279 machineName = " STmicroelectronics ST7 8 bit mc ";
280 break;
280 break;
281 case EM_68HC16:
281 case EM_68HC16:
282 machineName = " Motorola MC68HC16 microcontroller ";
282 machineName = " Motorola MC68HC16 microcontroller ";
283 break;
283 break;
284 case EM_68HC11:
284 case EM_68HC11:
285 machineName = " Motorola MC68HC11 microcontroller ";
285 machineName = " Motorola MC68HC11 microcontroller ";
286 break;
286 break;
287 case EM_68HC08:
287 case EM_68HC08:
288 machineName = " Motorola MC68HC08 microcontroller ";
288 machineName = " Motorola MC68HC08 microcontroller ";
289 break;
289 break;
290 case EM_68HC05:
290 case EM_68HC05:
291 machineName = " Motorola MC68HC05 microcontroller ";
291 machineName = " Motorola MC68HC05 microcontroller ";
292 break;
292 break;
293 case EM_SVX:
293 case EM_SVX:
294 machineName = " Silicon Graphics SVx ";
294 machineName = " Silicon Graphics SVx ";
295 break;
295 break;
296 case EM_ST19:
296 case EM_ST19:
297 machineName = " STMicroelectronics ST19 8 bit mc ";
297 machineName = " STMicroelectronics ST19 8 bit mc ";
298 break;
298 break;
299 case EM_VAX:
299 case EM_VAX:
300 machineName = " Digital VAX ";
300 machineName = " Digital VAX ";
301 break;
301 break;
302 case EM_CRIS:
302 case EM_CRIS:
303 machineName = " Axis Communications 32-bit embedded processor ";
303 machineName = " Axis Communications 32-bit embedded processor ";
304 break;
304 break;
305 case EM_JAVELIN:
305 case EM_JAVELIN:
306 machineName = " Infineon Technologies 32-bit embedded processor ";
306 machineName = " Infineon Technologies 32-bit embedded processor ";
307 break;
307 break;
308 case EM_FIREPATH:
308 case EM_FIREPATH:
309 machineName = " Element 14 64-bit DSP Processor ";
309 machineName = " Element 14 64-bit DSP Processor ";
310 break;
310 break;
311 case EM_ZSP:
311 case EM_ZSP:
312 machineName = " LSI Logic 16-bit DSP Processor ";
312 machineName = " LSI Logic 16-bit DSP Processor ";
313 break;
313 break;
314 case EM_MMIX:
314 case EM_MMIX:
315 machineName = " Donald Knuth's educational 64-bit processor ";
315 machineName = " Donald Knuth's educational 64-bit processor ";
316 break;
316 break;
317 case EM_HUANY:
317 case EM_HUANY:
318 machineName = " Harvard University machine-independent object files ";
318 machineName = " Harvard University machine-independent object files ";
319 break;
319 break;
320 case EM_PRISM:
320 case EM_PRISM:
321 machineName = " SiTera Prism ";
321 machineName = " SiTera Prism ";
322 break;
322 break;
323 case EM_AVR:
323 case EM_AVR:
324 machineName = " Atmel AVR 8-bit microcontroller ";
324 machineName = " Atmel AVR 8-bit microcontroller ";
325 break;
325 break;
326 case EM_FR30:
326 case EM_FR30:
327 machineName = " Fujitsu FR30 ";
327 machineName = " Fujitsu FR30 ";
328 break;
328 break;
329 case EM_D10V:
329 case EM_D10V:
330 machineName = " Mitsubishi D10V ";
330 machineName = " Mitsubishi D10V ";
331 break;
331 break;
332 case EM_D30V:
332 case EM_D30V:
333 machineName = " Mitsubishi D30V ";
333 machineName = " Mitsubishi D30V ";
334 break;
334 break;
335 case EM_V850:
335 case EM_V850:
336 machineName = " NEC v850 ";
336 machineName = " NEC v850 ";
337 break;
337 break;
338 case EM_M32R:
338 case EM_M32R:
339 machineName = " Mitsubishi M32R ";
339 machineName = " Mitsubishi M32R ";
340 break;
340 break;
341 case EM_MN10300:
341 case EM_MN10300:
342 machineName = " Matsushita MN10300 ";
342 machineName = " Matsushita MN10300 ";
343 break;
343 break;
344 case EM_MN10200:
344 case EM_MN10200:
345 machineName = " Matsushita MN10200 ";
345 machineName = " Matsushita MN10200 ";
346 break;
346 break;
347 case EM_PJ:
347 case EM_PJ:
348 machineName = " picoJava ";
348 machineName = " picoJava ";
349 break;
349 break;
350 case EM_OPENRISC:
350 case EM_OPENRISC:
351 machineName = " OpenRISC 32-bit embedded processor ";
351 machineName = " OpenRISC 32-bit embedded processor ";
352 break;
352 break;
353 case EM_ARC_A5:
353 case EM_ARC_A5:
354 machineName = " ARC Cores Tangent-A5 ";
354 machineName = " ARC Cores Tangent-A5 ";
355 break;
355 break;
356 case EM_XTENSA:
356 case EM_XTENSA:
357 machineName = " Tensilica Xtensa Architecture ";
357 machineName = " Tensilica Xtensa Architecture ";
358 break;
358 break;
359 case EM_AARCH64:
359 case EM_AARCH64:
360 machineName = " ARM AARCH64 ";
360 machineName = " ARM AARCH64 ";
361 break;
361 break;
362 case EM_TILEPRO:
362 case EM_TILEPRO:
363 machineName = " Tilera TILEPro ";
363 machineName = " Tilera TILEPro ";
364 break;
364 break;
365 case EM_MICROBLAZE:
365 case EM_MICROBLAZE:
366 machineName = " Xilinx MicroBlaze ";
366 machineName = " Xilinx MicroBlaze ";
367 break;
367 break;
368 case EM_TILEGX:
368 case EM_TILEGX:
369 machineName = " Tilera TILE-Gx ";
369 machineName = " Tilera TILE-Gx ";
370 break;
370 break;
371 case EM_NUM:
371 case EM_NUM:
372 machineName = "";
372 machineName = "";
373 break;
373 break;
374 default:
374 default:
375 machineName ="Unknow Machine";
375 machineName ="Unknow Machine";
376 break;
376 break;
377 }
377 }
378 return machineName;
378 return machineName;
379 }
379 }
380
380
381
381
382
382
383
383
384 QString ElfFile::getClass()
384 QString ElfFile::getClass()
385 {
385 {
386 if(this->e!=NULL)
386 if(this->e!=NULL)
387 {
387 {
388 int eclass = gelf_getclass(this->e);
388 int eclass = gelf_getclass(this->e);
389 if(eclass==ELFCLASS32)return "ELF32";
389 if(eclass==ELFCLASS32)return "ELF32";
390 if(eclass==ELFCLASS64)return "ELF64";
390 if(eclass==ELFCLASS64)return "ELF64";
391 }
391 }
392 return "none";
392 return "none";
393 }
393 }
394
394
395
395
396 bool ElfFile::iself()
396 bool ElfFile::iself()
397 {
397 {
398 return (this->getType()!="Unknow");
398 return (this->getType()!="Unknow");
399 }
399 }
400
400
401 QString ElfFile::getArchitecture()
401 QString ElfFile::getArchitecture()
402 {
402 {
403 if(this->e!=NULL)
403 if(this->e!=NULL)
404 {
404 {
405 return elfresolveMachine(this->ehdr.e_machine);
405 return elfresolveMachine(this->ehdr.e_machine);
406 }
406 }
407 return "";
407 return "";
408 }
408 }
409
409
410
410
411 QString ElfFile::getType()
411 QString ElfFile::getType()
412 {
412 {
413 QString kind("");
413 QString kind("");
414 if(this->e!=NULL)
414 if(this->e!=NULL)
415 {
415 {
416 switch(this->ek)
416 switch(this->ek)
417 {
417 {
418 case ELF_K_AR:
418 case ELF_K_AR:
419 kind = "Archive";
419 kind = "Archive";
420 break;
420 break;
421 case ELF_K_ELF:
421 case ELF_K_ELF:
422 kind = "Elf";
422 kind = "Elf";
423 break;
423 break;
424 case ELF_K_COFF:
424 case ELF_K_COFF:
425 kind = "COFF";
425 kind = "COFF";
426 break;
426 break;
427 case ELF_K_NUM:
427 case ELF_K_NUM:
428 kind = "NUM";
428 kind = "NUM";
429 break;
429 break;
430 case ELF_K_NONE:
430 case ELF_K_NONE:
431 kind = "Data";
431 kind = "Data";
432 break;
432 break;
433 default:
433 default:
434 kind = "Unknow";
434 kind = "Unknow";
435 break;
435 break;
436 }
436 }
437 }
437 }
438 return kind;
438 return kind;
439 }
439 }
440
440
441 QString ElfFile::getEndianness()
441 QString ElfFile::getEndianness()
442 {
442 {
443 if(this->e!=NULL)
443 if(this->e!=NULL)
444 {
444 {
445 if(this->ehdr.e_ident[EI_DATA]==ELFDATA2LSB)return "2's complement, little endian";
445 if(this->ehdr.e_ident[EI_DATA]==ELFDATA2LSB)return "2's complement, little endian";
446 if(this->ehdr.e_ident[EI_DATA]==ELFDATA2MSB)return "2's complement, big endian";
446 if(this->ehdr.e_ident[EI_DATA]==ELFDATA2MSB)return "2's complement, big endian";
447 }
447 }
448 return "none";
448 return "none";
449 }
449 }
450
450
451 QString ElfFile::getABI()
451 QString ElfFile::getABI()
452 {
452 {
453 if(this->e!=NULL)
453 if(this->e!=NULL)
454 {
454 {
455 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_NONE)return "UNIX System V ABI";
455 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_NONE)return "UNIX System V ABI";
456 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_SYSV)return "Alias";
456 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_SYSV)return "Alias";
457 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_HPUX)return "HP-UX";
457 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_HPUX)return "HP-UX";
458 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_NETBSD)return "NetBSD";
458 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_NETBSD)return "NetBSD";
459 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_GNU)return "Object uses GNU ELF extensions";
459 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_GNU)return "Object uses GNU ELF extensions";
460 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_LINUX)return "Compatibility alias";
460 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_LINUX)return "Compatibility alias";
461 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_SOLARIS)return "Sun Solaris";
461 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_SOLARIS)return "Sun Solaris";
462 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_AIX)return "IBM AIX";
462 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_AIX)return "IBM AIX";
463 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_IRIX)return "SGI Irix";
463 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_IRIX)return "SGI Irix";
464 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_FREEBSD)return "FreeBSD";
464 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_FREEBSD)return "FreeBSD";
465 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_TRU64)return "Compaq TRU64 UNIX";
465 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_TRU64)return "Compaq TRU64 UNIX";
466 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_MODESTO)return " Novell Modesto";
466 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_MODESTO)return " Novell Modesto";
467 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_OPENBSD)return "OpenBSD";
467 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_OPENBSD)return "OpenBSD";
468 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_ARM_AEABI)return "ARM EABI";
468 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_ARM_AEABI)return "ARM EABI";
469 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_ARM)return "ARM";
469 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_ARM)return "ARM";
470 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_STANDALONE)return "Standalone (embedded) application";
470 if(this->ehdr.e_ident[EI_OSABI]==ELFOSABI_STANDALONE)return "Standalone (embedded) application";
471 }
471 }
472 return "none";
472 return "none";
473 }
473 }
474
474
475
475
476 qint64 ElfFile::getVersion()
476 qint64 ElfFile::getVersion()
477 {
477 {
478 if(this->e!=NULL)
478 if(this->e!=NULL)
479 {
479 {
480 return this->ehdr.e_version;
480 return this->ehdr.e_version;
481 }
481 }
482 }
482 }
483
483
484 qint64 ElfFile::getEntryPointAddress()
484 qint64 ElfFile::getEntryPointAddress()
485 {
485 {
486 if(this->e!=NULL)
486 if(this->e!=NULL)
487 {
487 {
488 return this->ehdr.e_entry;
488 return this->ehdr.e_entry;
489 }
489 }
490 }
490 }
491
491
492
492
493 int ElfFile::getSectionCount()
493 int ElfFile::getSectionCount()
494 {
494 {
495 return (int)this->SectionCount;
495 return (int)this->SectionCount;
496 }
496 }
497
497
498 int ElfFile::getSymbolCount()
498 int ElfFile::getSymbolCount()
499 {
499 {
500 return (int)this->SymbolCount;
500 return (int)this->SymbolCount;
501 }
501 }
502
502
503
503
504 int ElfFile::getSegmentCount()
504 int ElfFile::getSegmentCount()
505 {
505 {
506 return (int)this->SegmentCount;
506 return (int)this->SegmentCount;
507 }
507 }
508
508
509
509
510 QString ElfFile::getSegmentType(int index)
510 QString ElfFile::getSegmentType(int index)
511 {
511 {
512 QString type("");
512 QString type("");
513 if(this->e!=NULL)
513 if(this->e!=NULL)
514 {
514 {
515 if(index < this->Segments.count())
515 if(index < this->Segments.count())
516 {
516 {
517 switch(this->Segments.at(index)->p_type)
517 switch(this->Segments.at(index)->p_type)
518 {
518 {
519 case PT_NULL:
519 case PT_NULL:
520 type = "Program header table entry unused";
520 type = "Program header table entry unused";
521 break;
521 break;
522 case PT_LOAD:
522 case PT_LOAD:
523 type = "Loadable program segment";
523 type = "Loadable program segment";
524 break;
524 break;
525 case PT_DYNAMIC :
525 case PT_DYNAMIC :
526 type = "Dynamic linking information";
526 type = "Dynamic linking information";
527 break;
527 break;
528 case PT_INTERP:
528 case PT_INTERP:
529 type ="Program interpreter";
529 type ="Program interpreter";
530 break;
530 break;
531 case PT_NOTE:
531 case PT_NOTE:
532 type = "Auxiliary information";
532 type = "Auxiliary information";
533 break;
533 break;
534 case PT_SHLIB:
534 case PT_SHLIB:
535 type = "Reserved";
535 type = "Reserved";
536 break;
536 break;
537 case PT_PHDR:
537 case PT_PHDR:
538 type = "Entry for header table itself";
538 type = "Entry for header table itself";
539 break;
539 break;
540 case PT_TLS:
540 case PT_TLS:
541 type = "Thread-local storage segment";
541 type = "Thread-local storage segment";
542 break;
542 break;
543 case PT_NUM:
543 case PT_NUM:
544 type = "Number of defined types";
544 type = "Number of defined types";
545 break;
545 break;
546 case PT_LOOS:
546 case PT_LOOS:
547 type = "Start of OS-specific";
547 type = "Start of OS-specific";
548 break;
548 break;
549 case PT_SUNWSTACK:
549 case PT_SUNWSTACK:
550 type = "Stack segment";
550 type = "Stack segment";
551 break;
551 break;
552 case PT_LOPROC:
552 case PT_LOPROC:
553 type = "Start of processor-specific";
553 type = "Start of processor-specific";
554 break;
554 break;
555 case PT_HIPROC:
555 case PT_HIPROC:
556 type = "End of processor-specific";
556 type = "End of processor-specific";
557 break;
557 break;
558 default:
558 default:
559 type = "Unknow Section Type";
559 type = "Unknow Section Type";
560 break;
560 break;
561 }
561 }
562 }
562 }
563 }
563 }
564
564
565 return type;
565 return type;
566 }
566 }
567
567
568
568
569 qint64 ElfFile::getSegmentOffset(int index)
569 qint64 ElfFile::getSegmentOffset(int index)
570 {
570 {
571 int64_t Offset;
571 int64_t Offset;
572 if(this->e!=NULL)
572 if(this->e!=NULL)
573 {
573 {
574 if(index < this->Segments.count())
574 if(index < this->Segments.count())
575 {
575 {
576 Offset = (int64_t)this->Segments.at(index)->p_offset;
576 Offset = (int64_t)this->Segments.at(index)->p_offset;
577 }
577 }
578 }
578 }
579 return Offset;
579 return Offset;
580 }
580 }
581
581
582
582
583 qint64 ElfFile::getSegmentVaddr(int index)
583 qint64 ElfFile::getSegmentVaddr(int index)
584 {
584 {
585 int64_t Vaddr = 0;
585 int64_t Vaddr = 0;
586 if(this->e!=NULL)
586 if(this->e!=NULL)
587 {
587 {
588 if(index < this->Segments.count())
588 if(index < this->Segments.count())
589 {
589 {
590 Vaddr = (int64_t)this->Segments.at(index)->p_vaddr;
590 Vaddr = (int64_t)this->Segments.at(index)->p_vaddr;
591 }
591 }
592 }
592 }
593 return Vaddr;
593 return Vaddr;
594 }
594 }
595
595
596
596
597 qint64 ElfFile::getSegmentPaddr(int index)
597 qint64 ElfFile::getSegmentPaddr(int index)
598 {
598 {
599 int64_t Paddr=0;
599 int64_t Paddr=0;
600 if(this->e!=NULL)
600 if(this->e!=NULL)
601 {
601 {
602 if(index < this->Segments.count())
602 if(index < this->Segments.count())
603 {
603 {
604 Paddr = (int64_t)this->Segments.at(index)->p_paddr;
604 Paddr = (int64_t)this->Segments.at(index)->p_paddr;
605 }
605 }
606 }
606 }
607 return Paddr;
607 return Paddr;
608 }
608 }
609
609
610 qint64 ElfFile::getSectionPaddr(int index)
610 qint64 ElfFile::getSectionPaddr(int index)
611 {
611 {
612 int64_t Paddr=0;
612 int64_t Paddr=0;
613 if(this->e!=NULL)
613 if(this->e!=NULL)
614 {
614 {
615 if(index < this->sections.count())
615 if(index < this->sections.count())
616 {
616 {
617 Paddr = (int64_t)this->sections.at(index)->section_header->sh_addr;
617 Paddr = (int64_t)this->sections.at(index)->section_header->sh_addr;
618 }
618 }
619 }
619 }
620 return Paddr;
620 return Paddr;
621 }
621 }
622
622
623
623
624 qint64 ElfFile::getSegmentFilesz(int index)
624 qint64 ElfFile::getSegmentFilesz(int index)
625 {
625 {
626 int64_t FileSz=0;
626 int64_t FileSz=0;
627 if(this->e!=NULL)
627 if(this->e!=NULL)
628 {
628 {
629 if(index < this->Segments.count())
629 if(index < this->Segments.count())
630 {
630 {
631 FileSz = (int64_t)this->Segments.at(index)->p_filesz;
631 FileSz = (int64_t)this->Segments.at(index)->p_filesz;
632 }
632 }
633 }
633 }
634 return FileSz;
634 return FileSz;
635 }
635 }
636
636
637 qint64 ElfFile::getSectionDatasz(int index)
637 qint64 ElfFile::getSectionDatasz(int index)
638 {
638 {
639 int64_t DataSz=0;
639 int64_t DataSz=0;
640 if(this->e!=NULL)
640 if(this->e!=NULL)
641 {
641 {
642 if(index < this->sections.count())
642 if(index < this->sections.count())
643 {
643 {
644 DataSz = (int64_t)this->sections.at(index)->data->d_size;
644 DataSz = (int64_t)this->sections.at(index)->data->d_size;
645 }
645 }
646 }
646 }
647 return DataSz;
647 return DataSz;
648 }
648 }
649
649
650 bool ElfFile::getSectionData(int index, char **buffer)
650 bool ElfFile::getSectionData(int index, char **buffer)
651 {
651 {
652 if(this->e!=NULL)
652 if(this->e!=NULL)
653 {
653 {
654 if(index < this->sections.count())
654 if(index < this->sections.count())
655 {
655 {
656 *buffer = (char *)this->sections.at(index)->data->d_buf;
656 *buffer = (char *)this->sections.at(index)->data->d_buf;
657 return true;
657 return true;
658 }
658 }
659 }
659 }
660 return false;
660 return false;
661 }
661 }
662
662
663
663
664 qint64 ElfFile::getSegmentMemsz(int index)
664 qint64 ElfFile::getSegmentMemsz(int index)
665 {
665 {
666 int64_t MemSz=0;
666 int64_t MemSz=0;
667 if(this->e!=NULL)
667 if(this->e!=NULL)
668 {
668 {
669 if(index < this->Segments.count())
669 if(index < this->Segments.count())
670 {
670 {
671 MemSz = (int64_t)this->Segments.at(index)->p_memsz;
671 MemSz = (int64_t)this->Segments.at(index)->p_memsz;
672 }
672 }
673 }
673 }
674 return MemSz;
674 return MemSz;
675 }
675 }
676
676
677 qint64 ElfFile::getSectionMemsz(int index)
677 qint64 ElfFile::getSectionMemsz(int index)
678 {
678 {
679 int64_t MemSz=0;
679 int64_t MemSz=0;
680 if(this->e!=NULL)
680 if(this->e!=NULL)
681 {
681 {
682 if(index < this->sections.count())
682 if(index < this->sections.count())
683 {
683 {
684 MemSz = (int64_t)this->sections.at(index)->section_header->sh_size;
684 MemSz = (int64_t)this->sections.at(index)->section_header->sh_size;
685 }
685 }
686 }
686 }
687 return MemSz;
687 return MemSz;
688 }
688 }
689
689
690
690
691 QString ElfFile::getSegmentFlags(int index)
691 QString ElfFile::getSegmentFlags(int index)
692 {
692 {
693 QString flags("");
693 QString flags("");
694 if(this->e!=NULL)
694 if(this->e!=NULL)
695 {
695 {
696 if(index < this->Segments.count())
696 if(index < this->Segments.count())
697 {
697 {
698 if((this->Segments.at(index)->p_flags&PF_X) == PF_X)flags+="x";
698 if((this->Segments.at(index)->p_flags&PF_X) == PF_X)flags+="x";
699 if((this->Segments.at(index)->p_flags&PF_W) == PF_W)flags+="w";
699 if((this->Segments.at(index)->p_flags&PF_W) == PF_W)flags+="w";
700 if((this->Segments.at(index)->p_flags&PF_R) == PF_R)flags+="r";
700 if((this->Segments.at(index)->p_flags&PF_R) == PF_R)flags+="r";
701 if((this->Segments.at(index)->p_flags&PF_MASKOS) == PF_MASKOS)flags+=" OS-specific";
701 if((this->Segments.at(index)->p_flags&PF_MASKOS) == PF_MASKOS)flags+=" OS-specific";
702 if((this->Segments.at(index)->p_flags&PF_MASKPROC) == PF_MASKPROC)flags+=" Processor-specific";
702 if((this->Segments.at(index)->p_flags&PF_MASKPROC) == PF_MASKPROC)flags+=" Processor-specific";
703 }
703 }
704 }
704 }
705 return flags;
705 return flags;
706 }
706 }
707
707
708
708
709 QString ElfFile::getSectionName(int index)
709 QString ElfFile::getSectionName(int index)
710 {
710 {
711 char* nameChr = elf_strptr(this->e , this->shstrndx , this->sections.at(index)->section_header->sh_name);
711 if((index<sections.count()) && (index>=0))
712 return QString(nameChr);
712 {
713 char* nameChr = elf_strptr(this->e , this->shstrndx , this->sections.at(index)->section_header->sh_name);
714 return QString(nameChr);
715 }
716 return "";
713 }
717 }
714
718
715
719
716 void ElfFile::updateSections()
720 void ElfFile::updateSections()
717 {
721 {
718 for(int i=0;i<this->sections.count();i++)
722 for(int i=0;i<this->sections.count();i++)
719 {
723 {
720 delete this->sections.at(i);
724 delete this->sections.at(i);
721 }
725 }
722 this->sections.clear();
726 this->sections.clear();
723 this->scn = elf_nextscn (this->e , NULL );
727 this->scn = elf_nextscn (this->e , NULL );
724 this->SectionCount = 0;
728 this->SectionCount = 0;
725 while( this->scn != NULL )
729 while( this->scn != NULL )
726 {
730 {
727 GElf_Shdr* shdr = (GElf_Shdr*)malloc(sizeof(GElf_Shdr));
731 GElf_Shdr* shdr = (GElf_Shdr*)malloc(sizeof(GElf_Shdr));
728 gelf_getshdr ( this->scn , shdr );
732 gelf_getshdr ( this->scn , shdr );
729 Elf_Data* data = elf_getdata(this->scn, NULL);
733 Elf_Data* data = elf_getdata(this->scn, NULL);
730 this->sections.append(new Elf_Section(data,shdr));
734 this->sections.append(new Elf_Section(data,shdr));
731 this->SectionCount+=1;
735 this->SectionCount+=1;
732 this->scn = elf_nextscn(e , scn);
736 this->scn = elf_nextscn(e , scn);
733 }
737 }
734 }
738 }
735
739
736
740
737 void ElfFile::updateSegments()
741 void ElfFile::updateSegments()
738 {
742 {
739 elf_getphdrnum (this->e , &this->SegmentCount);
743 elf_getphdrnum (this->e , &this->SegmentCount);
740 for(int i=0;i<this->Segments.count();i++)
744 for(int i=0;i<this->Segments.count();i++)
741 {
745 {
742 free(this->Segments.at(i));
746 free(this->Segments.at(i));
743 }
747 }
744 this->Segments.clear();
748 this->Segments.clear();
745 for(int i=0;i<this->SegmentCount;i++)
749 for(int i=0;i<this->SegmentCount;i++)
746 {
750 {
747 GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr));
751 GElf_Phdr* header=(GElf_Phdr*)malloc(sizeof(GElf_Phdr));
748 gelf_getphdr (this->e , i , header );
752 gelf_getphdr (this->e , i , header );
749 this->Segments.append(header);
753 this->Segments.append(header);
750 }
754 }
751 }
755 }
752
756
753 void ElfFile::updateSymbols()
757 void ElfFile::updateSymbols()
754 {
758 {
755 for(int i=0;i<symbols.count();i++)
759 for(int i=0;i<symbols.count();i++)
756 {
760 {
757 delete this->symbols.at(i);
761 delete this->symbols.at(i);
758 }
762 }
759 this->symbols.clear();
763 this->symbols.clear();
760 updateSections(); //Useless in most case but safer to do it
764 updateSections(); //Useless in most case but safer to do it
761 for(int i=0;i<SectionCount;i++)
765 for(int i=0;i<SectionCount;i++)
762 {
766 {
763 //First find Symbol table
767 //First find Symbol table
764 if(this->getSectionName(i)==".symtab")
768 if(this->getSectionName(i)==".symtab")
765 {
769 {
766 Elf_Section* sec = sections.at(i);
770 Elf_Section* sec = sections.at(i);
767 this->SymbolCount = sec->section_header->sh_size / sec->section_header->sh_entsize;
771 this->SymbolCount = sec->section_header->sh_size / sec->section_header->sh_entsize;
768 //Then list all symbols
772 //Then list all symbols
769 for(int j=0;j<this->SymbolCount;j++)
773 for(int j=0;j<this->SymbolCount;j++)
770 {
774 {
771 GElf_Sym* esym = (GElf_Sym*)malloc(sizeof(GElf_Sym));
775 GElf_Sym* esym = (GElf_Sym*)malloc(sizeof(GElf_Sym));
772 gelf_getsym(sec->data, j, esym);
776 gelf_getsym(sec->data, j, esym);
773 QString name = elf_strptr(this->e,sec->section_header->sh_link,esym->st_name);
777 QString name = elf_strptr(this->e,sec->section_header->sh_link,esym->st_name);
774 Elf_Symbol* sym = new Elf_Symbol(name,esym);
778 Elf_Symbol* sym = new Elf_Symbol(name,esym);
775 symbols.append(sym);
779 symbols.append(sym);
776 }
780 }
777 }
781 }
778 }
782 }
779
783
780 }
784 }
781
785
782
786
783
787
784 QString ElfFile::getSectionType(int index)
788 QString ElfFile::getSectionType(int index)
785 {
789 {
786 QString type("");
790 QString type("");
787 if(this->e!=NULL)
791 if(this->e!=NULL)
788 {
792 {
789 if(index < this->Segments.count())
793 if(index < this->Segments.count())
790 {
794 {
791 switch(this->Segments.at(index)->p_type)
795 switch(this->Segments.at(index)->p_type)
792 {
796 {
793 case SHT_NULL : type = "Section header table entry unused"; break;
797 case SHT_NULL : type = "Section header table entry unused"; break;
794 case SHT_PROGBITS : type = "Program data"; break;
798 case SHT_PROGBITS : type = "Program data"; break;
795 case SHT_SYMTAB : type = "Symbol table"; break;
799 case SHT_SYMTAB : type = "Symbol table"; break;
796 case SHT_STRTAB : type = "String table"; break;
800 case SHT_STRTAB : type = "String table"; break;
797 case SHT_RELA : type = "Relocation entries with addends"; break;
801 case SHT_RELA : type = "Relocation entries with addends"; break;
798 case SHT_HASH : type = "Symbol hash table"; break;
802 case SHT_HASH : type = "Symbol hash table"; break;
799 case SHT_DYNAMIC : type = "Dynamic linking information"; break;
803 case SHT_DYNAMIC : type = "Dynamic linking information"; break;
800 case SHT_NOTE : type = "Notes"; break;
804 case SHT_NOTE : type = "Notes"; break;
801 case SHT_NOBITS :type = "Program space with no data (bss)"; break;
805 case SHT_NOBITS :type = "Program space with no data (bss)"; break;
802 case SHT_REL :type = "Relocation entries, no addends"; break;
806 case SHT_REL :type = "Relocation entries, no addends"; break;
803 case SHT_SHLIB : type = "Reserved"; break;
807 case SHT_SHLIB : type = "Reserved"; break;
804 case SHT_DYNSYM : type = "Dynamic linker symbol table"; break;
808 case SHT_DYNSYM : type = "Dynamic linker symbol table"; break;
805 case SHT_INIT_ARRAY : type = "Array of constructors"; break;
809 case SHT_INIT_ARRAY : type = "Array of constructors"; break;
806 case SHT_FINI_ARRAY : type = "Array of destructors"; break;
810 case SHT_FINI_ARRAY : type = "Array of destructors"; break;
807 case SHT_PREINIT_ARRAY : type = "Array of pre-constructors"; break;
811 case SHT_PREINIT_ARRAY : type = "Array of pre-constructors"; break;
808 case SHT_GROUP : type = "Section group"; break;
812 case SHT_GROUP : type = "Section group"; break;
809 case SHT_SYMTAB_SHNDX : type = "Extended section indeces"; break;
813 case SHT_SYMTAB_SHNDX : type = "Extended section indeces"; break;
810 case SHT_NUM : type = "Number of defined types. "; break;
814 case SHT_NUM : type = "Number of defined types. "; break;
811 case SHT_LOOS : type = "Start OS-specific. "; break;
815 case SHT_LOOS : type = "Start OS-specific. "; break;
812 case SHT_LOSUNW : type = "Sun-specific low bound. "; break;
816 case SHT_LOSUNW : type = "Sun-specific low bound. "; break;
813 case SHT_SUNW_COMDAT : type = " "; break;
817 case SHT_SUNW_COMDAT : type = " "; break;
814 case SHT_SUNW_syminfo : type = " "; break;
818 case SHT_SUNW_syminfo : type = " "; break;
815 case SHT_GNU_verdef : type = "Version definition section. "; break;
819 case SHT_GNU_verdef : type = "Version definition section. "; break;
816 case SHT_GNU_verneed : type = "Version needs section. "; break;
820 case SHT_GNU_verneed : type = "Version needs section. "; break;
817 case SHT_GNU_versym : type = "Version symbol table. "; break;
821 case SHT_GNU_versym : type = "Version symbol table. "; break;
818 case SHT_LOPROC : type = "Start of processor-specific"; break;
822 case SHT_LOPROC : type = "Start of processor-specific"; break;
819 case SHT_HIPROC : type = "End of processor-specific"; break;
823 case SHT_HIPROC : type = "End of processor-specific"; break;
820 case SHT_HIUSER : type = "End of application-specific"; break;
824 case SHT_HIUSER : type = "End of application-specific"; break;
821 }
825 }
822 }
826 }
823 }
827 }
824 return type;
828 return type;
825 }
829 }
826
830
831 QString ElfFile::getSymbolName(int index)
832 {
833 if(this->e!=NULL)
834 {
835 if(index < this->symbols.count())
836 {
837 return symbols.at(index)->name;
838 }
839 }
840 return "";
841 }
842
843 QString ElfFile::getSymbolType(int index)
844 {
845 if(this->e!=NULL)
846 {
847 if(index < this->symbols.count())
848 {
849 int type = GELF_ST_TYPE(symbols.at(index)->sym->st_info);
850 switch(type)
851 {
852 case STT_NOTYPE:
853 return "No Type";
854 break;
855 case STT_OBJECT:
856 return "Object";
857 break;
858 case STT_FUNC:
859 return "Function";
860 break;
861 case STT_SECTION:
862 return "Section";
863 break;
864 case STT_FILE:
865 return "File";
866 break;
867 case STT_COMMON:
868 return "Common data object";
869 break;
870 case STT_TLS:
871 return "Thread-local data object";
872 break;
873 case STT_NUM:
874 return "Number of defined types";
875 break;
876 case STT_LOOS:
877 return "Start of OS-specific";
878 break;
879 case STT_HIOS:
880 return "End of OS-specific";
881 break;
882 case STT_LOPROC:
883 return "Start of processor-specific";
884 break;
885 case STT_HIPROC:
886 return "End of processor-specific";
887 break;
888 default:
889 return "none";
890 break;
891 }
892 }
893 }
894 return "none";
895 }
896
897 quint64 ElfFile::getSymbolSize(int index)
898 {
899 if(this->e!=NULL)
900 {
901 if((index < this->symbols.count()) && (index>=0))
902 {
903 return symbols.at(index)->sym->st_size;
904 }
905 }
906 return 0;
907 }
908
909 QString ElfFile::getSymbolSectionName(int index)
910 {
911 if(this->e!=NULL)
912 {
913 if((index < this->symbols.count()) && (index>=0))
914 {
915 return getSectionName(symbols.at(index)->sym->st_shndx-1);
916 }
917 }
918 return "none";
919 }
920
921 int ElfFile::getSymbolSectionIndex(int index)
922 {
923 if(this->e!=NULL)
924 {
925 if((index < this->symbols.count()) && (index>=0))
926 {
927 return symbols.at(index)->sym->st_shndx;
928 }
929 }
930 return 0;
931 }
932
933 quint64 ElfFile::getSymbolAddress(int index)
934 {
935 if(this->e!=NULL)
936 {
937 if((index < this->symbols.count()) && (index>=0))
938 {
939 return symbols.at(index)->sym->st_value;
940 }
941 }
942 return 0;
943 }
944
945 QString ElfFile::getSymbolLinkType(int index)
946 {
947 if(this->e!=NULL)
948 {
949 if(index < this->symbols.count())
950 {
951 int btype = GELF_ST_BIND(symbols.at(index)->sym->st_info);
952 switch(btype)
953 {
954 case STB_LOCAL:
955 return "Local";
956 break;
957 case STB_GLOBAL:
958 return "Global";
959 break;
960 case STB_WEAK:
961 return "Weak";
962 break;
963 case STB_NUM:
964 return "Number of defined types";
965 break;
966 case STB_LOOS:
967 return "Start of OS-specific";
968 break;
969 case STB_HIOS:
970 return "End of OS-specific";
971 break;
972 case STB_LOPROC:
973 return "Start of processor-specific";
974 break;
975 case STB_HIPROC:
976 return "End of processor-specific";
977 break;
978 default:
979 return "none";
980 break;
981 }
982 }
983 }
984 return "none";
985 }
986
827 bool ElfFile::isElf(const QString &File)
987 bool ElfFile::isElf(const QString &File)
828 {
988 {
829 int file =0;
989 int file =0;
830 #ifdef _ELF_WINDOWS_
990 #ifdef _ELF_WINDOWS_
831 file = open(File.toStdString().c_str(),O_RDONLY|O_BINARY ,0);
991 file = open(File.toStdString().c_str(),O_RDONLY|O_BINARY ,0);
832 #else
992 #else
833 file = open(File.toStdString().c_str(),O_RDONLY ,0);
993 file = open(File.toStdString().c_str(),O_RDONLY ,0);
834 #endif
994 #endif
835 char Magic[4];
995 char Magic[4];
836 if(file!=-1)
996 if(file!=-1)
837 {
997 {
838 read(file,Magic,4);
998 read(file,Magic,4);
839 close(file);
999 close(file);
840 if(Magic[0]==0x7f && Magic[1]==0x45 && Magic[2]==0x4c && Magic[3]==0x46)
1000 if(Magic[0]==0x7f && Magic[1]==0x45 && Magic[2]==0x4c && Magic[3]==0x46)
841 {
1001 {
842 return true;
1002 return true;
843 }
1003 }
844 }
1004 }
845 return false;
1005 return false;
846 }
1006 }
@@ -1,119 +1,130
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 <QtCore/QObject>
23 #include <QtCore/QObject>
24 #include <QtCore/QStringList>
24 #include <QtCore/QStringList>
25 #include <libelf.h>
25 #include <libelf.h>
26 #include <gelf.h>
26 #include <gelf.h>
27 #include <sys/types.h>
27 #include <sys/types.h>
28 #include <sys/stat.h>
28 #include <sys/stat.h>
29 #include <fcntl.h>
29 #include <fcntl.h>
30 #include <unistd.h>
30 #include <unistd.h>
31 #ifndef ELFFILE_H
31 #ifndef ELFFILE_H
32 #define ELFFILE_H
32 #define ELFFILE_H
33
33
34 class Elf_Section
34 class Elf_Section
35 {
35 {
36 public:
36 public:
37 Elf_Section(){}
37 Elf_Section(){}
38 Elf_Section(Elf_Data* data,GElf_Shdr* section_header)
38 Elf_Section(Elf_Data* data,GElf_Shdr* section_header)
39 {
39 {
40 this->data = data;
40 this->data = data;
41 this->section_header = section_header;
41 this->section_header = section_header;
42 }
42 }
43 ~Elf_Section()
43 ~Elf_Section()
44 {
44 {
45 free(section_header);
45 free(section_header);
46 }
46 }
47 Elf_Data* data;
47 Elf_Data* data;
48 GElf_Shdr* section_header;
48 GElf_Shdr* section_header;
49 };
49 };
50
50
51 class Elf_Symbol
51 class Elf_Symbol
52 {
52 {
53 public:
53 public:
54 Elf_Symbol(){}
54 Elf_Symbol(){}
55 Elf_Symbol(const QString& name,GElf_Sym* sym):name(name),sym(sym){}
55 Elf_Symbol(const QString& name,GElf_Sym* sym):name(name),sym(sym){}
56 ~Elf_Symbol(){free(sym);}
56 ~Elf_Symbol(){free(sym);}
57 QString name;
57 QString name;
58 GElf_Sym* sym;
58 GElf_Sym* sym;
59 };
59 };
60
60
61 class ElfFile : public abstractExecFile
61 class ElfFile : public abstractExecFile
62 {
62 {
63 Q_OBJECT
63 Q_OBJECT
64 public:
64 public:
65 ElfFile();
65 ElfFile();
66 ElfFile(const QString& File);
66 ElfFile(const QString& File);
67 bool openFile(const QString& File);
67 bool openFile(const QString& File);
68 bool isopened();
68 bool isopened();
69 int closeFile();
69 int closeFile();
70 QList<codeFragment*> getFragments();
70 QList<codeFragment*> getFragments();
71 QList<codeFragment*> getFragments(QStringList fragmentList);
71 QList<codeFragment*> getFragments(QStringList fragmentList);
72
72
73 QString getClass();
73 QString getClass();
74 QString getArchitecture();
74 QString getArchitecture();
75 QString getType();
75 QString getType();
76 QString getEndianness();
76 QString getEndianness();
77 QString getABI();
77 QString getABI();
78 qint64 getVersion();
78 qint64 getVersion();
79 qint64 getEntryPointAddress();
79 qint64 getEntryPointAddress();
80
80 int getSectionCount();
81 int getSectionCount();
81 int getSymbolCount();
82 int getSymbolCount();
82 int getSegmentCount();
83 int getSegmentCount();
84
83 QString getSegmentType(int index);
85 QString getSegmentType(int index);
84 qint64 getSegmentOffset(int index);
86 qint64 getSegmentOffset(int index);
85 qint64 getSegmentVaddr(int index);
87 qint64 getSegmentVaddr(int index);
86 qint64 getSegmentPaddr(int index);
88 qint64 getSegmentPaddr(int index);
87 qint64 getSectionPaddr(int index);
88 qint64 getSegmentFilesz(int index);
89 qint64 getSegmentFilesz(int index);
89 qint64 getSectionDatasz(int index);
90 qint64 getSectionDatasz(int index);
91 qint64 getSegmentMemsz(int index);
92 QString getSegmentFlags(int index);
93
90 bool getSectionData(int index, char **buffer);
94 bool getSectionData(int index, char **buffer);
91 qint64 getSegmentMemsz(int index);
95 qint64 getSectionPaddr(int index);
92 qint64 getSectionMemsz(int index);
96 qint64 getSectionMemsz(int index);
93 QString getSegmentFlags(int index);
94 QString getSectionName(int index);
97 QString getSectionName(int index);
95 QString getSectionType(int index);
98 QString getSectionType(int index);
99
100 QString getSymbolName(int index);
101 QString getSymbolType(int index);
102 quint64 getSymbolSize(int index);
103 QString getSymbolSectionName(int index);
104 int getSymbolSectionIndex(int index);
105 quint64 getSymbolAddress(int index);
106 QString getSymbolLinkType(int index);
96 bool iself();
107 bool iself();
97 static bool isElf(const QString& File);
108 static bool isElf(const QString& File);
98
109
99 private:
110 private:
100 codeFragment* getFragment(const QString& name);
111 codeFragment* getFragment(const QString& name);
101 void updateSections();
112 void updateSections();
102 void updateSegments();
113 void updateSegments();
103 void updateSymbols();
114 void updateSymbols();
104 int elfFile;
115 int elfFile;
105 bool opened;
116 bool opened;
106 bool type_elf;
117 bool type_elf;
107 Elf* e;
118 Elf* e;
108 Elf_Kind ek;
119 Elf_Kind ek;
109 GElf_Ehdr ehdr;
120 GElf_Ehdr ehdr;
110 Elf_Scn * scn;
121 Elf_Scn * scn;
111 Elf_Data * data;
122 Elf_Data * data;
112 size_t SymbolCount,SectionCount,SegmentCount, shstrndx;
123 size_t SymbolCount,SectionCount,SegmentCount, shstrndx;
113 QList<GElf_Phdr*> Segments;
124 QList<GElf_Phdr*> Segments;
114 QList<Elf_Section*> sections;
125 QList<Elf_Section*> sections;
115 QList<Elf_Symbol*> symbols;
126 QList<Elf_Symbol*> symbols;
116
127
117 };
128 };
118
129
119 #endif // ELFFILE_H
130 #endif // ELFFILE_H
@@ -1,46 +1,81
1 #include "elffilewidget.h"
1 #include "elffilewidget.h"
2 #include "ui_elffilewidget.h"
2 #include "ui_elffilewidget.h"
3 #include <QtWidgets/QTableWidgetItem>
3
4
4 elfFileWidget::elfFileWidget(QWidget *parent) :
5 elfFileWidget::elfFileWidget(QWidget *parent) :
5 QWidget(parent),
6 QWidget(parent),
6 ui(new Ui::elfFileWidget)
7 ui(new Ui::elfFileWidget)
7 {
8 {
8 ui->setupUi(this);
9 ui->setupUi(this);
9 }
10 }
10
11
11 elfFileWidget::~elfFileWidget()
12 elfFileWidget::~elfFileWidget()
12 {
13 {
13 delete ui;
14 delete ui;
14 }
15 }
15
16
16 void elfFileWidget::updateElfFile(ElfFile *file)
17 void elfFileWidget::updateElfFile(ElfFile *file)
17 {
18 {
18 this->p_elf = file;
19 this->p_elf = file;
19 if(p_elf->isopened() && p_elf->iself())
20 if(p_elf->isopened() && p_elf->iself())
20 {
21 {
21 this->ui->classLabel->setText(p_elf->getClass());
22 this->ui->classLabel->setText(p_elf->getClass());
22 this->ui->VersionLabel->setText(QString::number(p_elf->getVersion()));
23 this->ui->VersionLabel->setText(QString::number(p_elf->getVersion()));
23 this->ui->machineLabel->setText(p_elf->getArchitecture());
24 this->ui->machineLabel->setText(p_elf->getArchitecture());
24 this->ui->endiannesLabel->setText(p_elf->getEndianness());
25 this->ui->endiannesLabel->setText(p_elf->getEndianness());
25 this->ui->abiLabel->setText(p_elf->getABI());
26 this->ui->abiLabel->setText(p_elf->getABI());
26 this->ui->entryPointLabel->setText(QString("0x%1").arg((uint)p_elf->getEntryPointAddress(),8,16));
27 this->ui->entryPointLabel->setText(QString("0x%1").arg((uint)p_elf->getEntryPointAddress(),8,16));
27 this->ui->typeLabel->setText(p_elf->getType());
28 this->ui->typeLabel->setText(p_elf->getType());
28 this->ui->sectionCountLabel->setText(QString::number(p_elf->getSectionCount()));
29 this->ui->sectionCountLabel->setText(QString::number(p_elf->getSectionCount()));
29 this->ui->symbolCountLabel->setText(QString::number(p_elf->getSymbolCount()));
30 this->ui->symbolCountLabel->setText(QString::number(p_elf->getSymbolCount()));
30 }
31 }
32 updateSymbols();
33 }
34
35 void elfFileWidget::updateSymbols()
36 {
37 this->ui->symbolsList->clear();
38 this->ui->symbolsList->setRowCount(p_elf->getSymbolCount());
39 this->ui->symbolsList->setHorizontalHeaderLabels(QStringList()<<"Value"<<"Size"<<"Type"<<"Link"<<"Section"<<"Name");
40 for(int i=0;i<p_elf->getSymbolCount();i++)
41 {
42 QTableWidgetItem *newItem = new QTableWidgetItem(QString("0x%1").arg(p_elf->getSymbolAddress(i),8,16));
43 newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
44 this->ui->symbolsList->setItem(i, 0, newItem);
45
46 newItem = new QTableWidgetItem(QString("0x%1").arg(p_elf->getSymbolSize(i),8,16));
47 newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
48 this->ui->symbolsList->setItem(i, 1, newItem);
49
50 newItem = new QTableWidgetItem(p_elf->getSymbolType(i));
51 newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
52 this->ui->symbolsList->setItem(i, 2, newItem);
53
54 newItem = new QTableWidgetItem(p_elf->getSymbolLinkType(i));
55 newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
56 this->ui->symbolsList->setItem(i, 3, newItem);
57
58 newItem = new QTableWidgetItem(p_elf->getSymbolSectionName(i));
59 newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
60 this->ui->symbolsList->setItem(i, 4, newItem);
61
62 newItem = new QTableWidgetItem(p_elf->getSymbolName(i));
63 newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
64 this->ui->symbolsList->setItem(i, 5, newItem);
65 }
66 this->ui->symbolsList->resizeColumnsToContents();
31 }
67 }
32
68
33
69
34
70
35
71
36
72
37
73
38
74
39
75
40
76
41
77
42
78
43
79
44
80
45
81
46
@@ -1,27 +1,28
1 #ifndef ELFFILEWIDGET_H
1 #ifndef ELFFILEWIDGET_H
2 #define ELFFILEWIDGET_H
2 #define ELFFILEWIDGET_H
3
3
4 #include <QtWidgets/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 elfFileWidget(QWidget *parent = 0);
16 elfFileWidget(QWidget *parent = 0);
17 ~elfFileWidget();
17 ~elfFileWidget();
18
18
19 public slots:
19 public slots:
20 void updateElfFile(ElfFile* file);
20 void updateElfFile(ElfFile* file);
21 void updateSymbols();
21
22
22 private:
23 private:
23 Ui::elfFileWidget *ui;
24 Ui::elfFileWidget *ui;
24 ElfFile* p_elf;
25 ElfFile* p_elf;
25 };
26 };
26
27
27 #endif // ELFFILEWIDGET_H
28 #endif // ELFFILEWIDGET_H
@@ -1,226 +1,260
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ui version="4.0">
2 <ui version="4.0">
3 <class>elfFileWidget</class>
3 <class>elfFileWidget</class>
4 <widget class="QWidget" name="elfFileWidget">
4 <widget class="QWidget" name="elfFileWidget">
5 <property name="geometry">
5 <property name="geometry">
6 <rect>
6 <rect>
7 <x>0</x>
7 <x>0</x>
8 <y>0</y>
8 <y>0</y>
9 <width>622</width>
9 <width>786</width>
10 <height>398</height>
10 <height>387</height>
11 </rect>
11 </rect>
12 </property>
12 </property>
13 <property name="minimumSize">
13 <property name="minimumSize">
14 <size>
14 <size>
15 <width>0</width>
15 <width>0</width>
16 <height>0</height>
16 <height>0</height>
17 </size>
17 </size>
18 </property>
18 </property>
19 <property name="focusPolicy">
19 <property name="focusPolicy">
20 <enum>Qt::NoFocus</enum>
20 <enum>Qt::NoFocus</enum>
21 </property>
21 </property>
22 <property name="windowTitle">
22 <property name="windowTitle">
23 <string>Form</string>
23 <string>Form</string>
24 </property>
24 </property>
25 <layout class="QGridLayout" name="gridLayout">
25 <layout class="QGridLayout" name="gridLayout">
26 <item row="0" column="0">
26 <item row="0" column="0">
27 <widget class="QTabWidget" name="tabWidget">
27 <widget class="QTabWidget" name="tabWidget">
28 <property name="currentIndex">
28 <property name="currentIndex">
29 <number>0</number>
29 <number>1</number>
30 </property>
30 </property>
31 <widget class="QWidget" name="generalInfoTab">
31 <widget class="QWidget" name="generalInfoTab">
32 <attribute name="title">
32 <attribute name="title">
33 <string>File Informations</string>
33 <string>File Informations</string>
34 </attribute>
34 </attribute>
35 <layout class="QGridLayout" name="gridLayout_4">
35 <layout class="QGridLayout" name="gridLayout_4">
36 <item row="0" column="0">
36 <item row="0" column="0">
37 <widget class="QGroupBox" name="groupBox">
37 <widget class="QGroupBox" name="groupBox">
38 <property name="title">
38 <property name="title">
39 <string>Elf header</string>
39 <string>Elf header</string>
40 </property>
40 </property>
41 <layout class="QFormLayout" name="formLayout">
41 <layout class="QFormLayout" name="formLayout">
42 <item row="0" column="0">
42 <item row="0" column="0">
43 <widget class="QLabel" name="label">
43 <widget class="QLabel" name="label">
44 <property name="text">
44 <property name="text">
45 <string>Class:</string>
45 <string>Class:</string>
46 </property>
46 </property>
47 </widget>
47 </widget>
48 </item>
48 </item>
49 <item row="0" column="1">
49 <item row="0" column="1">
50 <widget class="QLabel" name="classLabel">
50 <widget class="QLabel" name="classLabel">
51 <property name="text">
51 <property name="text">
52 <string>none</string>
52 <string>none</string>
53 </property>
53 </property>
54 </widget>
54 </widget>
55 </item>
55 </item>
56 <item row="1" column="0">
56 <item row="1" column="0">
57 <widget class="QLabel" name="label_3">
57 <widget class="QLabel" name="label_3">
58 <property name="text">
58 <property name="text">
59 <string>Endianness:</string>
59 <string>Endianness:</string>
60 </property>
60 </property>
61 </widget>
61 </widget>
62 </item>
62 </item>
63 <item row="1" column="1">
63 <item row="1" column="1">
64 <widget class="QLabel" name="endiannesLabel">
64 <widget class="QLabel" name="endiannesLabel">
65 <property name="text">
65 <property name="text">
66 <string>none</string>
66 <string>none</string>
67 </property>
67 </property>
68 </widget>
68 </widget>
69 </item>
69 </item>
70 <item row="2" column="0">
70 <item row="2" column="0">
71 <widget class="QLabel" name="label_5">
71 <widget class="QLabel" name="label_5">
72 <property name="text">
72 <property name="text">
73 <string>Version:</string>
73 <string>Version:</string>
74 </property>
74 </property>
75 </widget>
75 </widget>
76 </item>
76 </item>
77 <item row="3" column="0">
77 <item row="3" column="0">
78 <widget class="QLabel" name="label_6">
78 <widget class="QLabel" name="label_6">
79 <property name="text">
79 <property name="text">
80 <string>Type:</string>
80 <string>Type:</string>
81 </property>
81 </property>
82 </widget>
82 </widget>
83 </item>
83 </item>
84 <item row="4" column="0">
84 <item row="4" column="0">
85 <widget class="QLabel" name="label_7">
85 <widget class="QLabel" name="label_7">
86 <property name="text">
86 <property name="text">
87 <string>Machine:</string>
87 <string>Machine:</string>
88 </property>
88 </property>
89 </widget>
89 </widget>
90 </item>
90 </item>
91 <item row="6" column="0">
91 <item row="6" column="0">
92 <widget class="QLabel" name="label_8">
92 <widget class="QLabel" name="label_8">
93 <property name="text">
93 <property name="text">
94 <string>Entry point address:</string>
94 <string>Entry point address:</string>
95 </property>
95 </property>
96 </widget>
96 </widget>
97 </item>
97 </item>
98 <item row="2" column="1">
98 <item row="2" column="1">
99 <widget class="QLabel" name="VersionLabel">
99 <widget class="QLabel" name="VersionLabel">
100 <property name="text">
100 <property name="text">
101 <string>none</string>
101 <string>none</string>
102 </property>
102 </property>
103 </widget>
103 </widget>
104 </item>
104 </item>
105 <item row="3" column="1">
105 <item row="3" column="1">
106 <widget class="QLabel" name="typeLabel">
106 <widget class="QLabel" name="typeLabel">
107 <property name="text">
107 <property name="text">
108 <string>none</string>
108 <string>none</string>
109 </property>
109 </property>
110 </widget>
110 </widget>
111 </item>
111 </item>
112 <item row="4" column="1">
112 <item row="4" column="1">
113 <widget class="QLabel" name="machineLabel">
113 <widget class="QLabel" name="machineLabel">
114 <property name="text">
114 <property name="text">
115 <string>none</string>
115 <string>none</string>
116 </property>
116 </property>
117 </widget>
117 </widget>
118 </item>
118 </item>
119 <item row="6" column="1">
119 <item row="6" column="1">
120 <widget class="QLabel" name="entryPointLabel">
120 <widget class="QLabel" name="entryPointLabel">
121 <property name="text">
121 <property name="text">
122 <string>none</string>
122 <string>none</string>
123 </property>
123 </property>
124 </widget>
124 </widget>
125 </item>
125 </item>
126 <item row="5" column="0">
126 <item row="5" column="0">
127 <widget class="QLabel" name="label_17">
127 <widget class="QLabel" name="label_17">
128 <property name="text">
128 <property name="text">
129 <string>OS/ABI:</string>
129 <string>OS/ABI:</string>
130 </property>
130 </property>
131 </widget>
131 </widget>
132 </item>
132 </item>
133 <item row="5" column="1">
133 <item row="5" column="1">
134 <widget class="QLabel" name="abiLabel">
134 <widget class="QLabel" name="abiLabel">
135 <property name="text">
135 <property name="text">
136 <string>none</string>
136 <string>none</string>
137 </property>
137 </property>
138 </widget>
138 </widget>
139 </item>
139 </item>
140 </layout>
140 </layout>
141 </widget>
141 </widget>
142 </item>
142 </item>
143 <item row="1" column="0">
143 <item row="1" column="0">
144 <widget class="QGroupBox" name="groupBox_2">
144 <widget class="QGroupBox" name="groupBox_2">
145 <property name="title">
145 <property name="title">
146 <string>Sections &amp; Symbols</string>
146 <string>Sections &amp; Symbols</string>
147 </property>
147 </property>
148 <layout class="QFormLayout" name="formLayout_2">
148 <layout class="QFormLayout" name="formLayout_2">
149 <item row="0" column="0">
149 <item row="0" column="0">
150 <widget class="QLabel" name="label_9">
150 <widget class="QLabel" name="label_9">
151 <property name="text">
151 <property name="text">
152 <string>Section count:</string>
152 <string>Section count:</string>
153 </property>
153 </property>
154 </widget>
154 </widget>
155 </item>
155 </item>
156 <item row="1" column="0">
156 <item row="1" column="0">
157 <widget class="QLabel" name="label_10">
157 <widget class="QLabel" name="label_10">
158 <property name="text">
158 <property name="text">
159 <string>Symbols count:</string>
159 <string>Symbols count:</string>
160 </property>
160 </property>
161 </widget>
161 </widget>
162 </item>
162 </item>
163 <item row="0" column="1">
163 <item row="0" column="1">
164 <widget class="QLabel" name="sectionCountLabel">
164 <widget class="QLabel" name="sectionCountLabel">
165 <property name="text">
165 <property name="text">
166 <string>none</string>
166 <string>none</string>
167 </property>
167 </property>
168 </widget>
168 </widget>
169 </item>
169 </item>
170 <item row="1" column="1">
170 <item row="1" column="1">
171 <widget class="QLabel" name="symbolCountLabel">
171 <widget class="QLabel" name="symbolCountLabel">
172 <property name="text">
172 <property name="text">
173 <string>none</string>
173 <string>none</string>
174 </property>
174 </property>
175 </widget>
175 </widget>
176 </item>
176 </item>
177 </layout>
177 </layout>
178 </widget>
178 </widget>
179 </item>
179 </item>
180 </layout>
180 </layout>
181 </widget>
181 </widget>
182 <widget class="QWidget" name="symbolsTab">
182 <widget class="QWidget" name="symbolsTab">
183 <attribute name="title">
183 <attribute name="title">
184 <string>Symbols</string>
184 <string>Symbols</string>
185 </attribute>
185 </attribute>
186 <layout class="QGridLayout" name="gridLayout_2">
186 <layout class="QGridLayout" name="gridLayout_2">
187 <item row="0" column="0">
187 <item row="0" column="0">
188 <widget class="QTableWidget" name="symbolsList"/>
188 <widget class="QTableWidget" name="symbolsList">
189 <property name="sortingEnabled">
190 <bool>true</bool>
191 </property>
192 <column>
193 <property name="text">
194 <string>Value</string>
195 </property>
196 </column>
197 <column>
198 <property name="text">
199 <string>Size</string>
200 </property>
201 </column>
202 <column>
203 <property name="text">
204 <string>Type</string>
205 </property>
206 </column>
207 <column>
208 <property name="text">
209 <string>Link</string>
210 </property>
211 </column>
212 <column>
213 <property name="text">
214 <string>Section</string>
215 </property>
216 </column>
217 <column>
218 <property name="text">
219 <string>Name</string>
220 </property>
221 </column>
222 </widget>
189 </item>
223 </item>
190 </layout>
224 </layout>
191 </widget>
225 </widget>
192 <widget class="QWidget" name="sectionsTab">
226 <widget class="QWidget" name="sectionsTab">
193 <attribute name="title">
227 <attribute name="title">
194 <string>Sections</string>
228 <string>Sections</string>
195 </attribute>
229 </attribute>
196 <layout class="QGridLayout" name="gridLayout_3">
230 <layout class="QGridLayout" name="gridLayout_3">
197 <item row="0" column="0">
231 <item row="0" column="0">
198 <widget class="QHexEdit" name="sectionsHexView" native="true">
232 <widget class="QHexEdit" name="sectionsHexView" native="true">
199 <property name="minimumSize">
233 <property name="minimumSize">
200 <size>
234 <size>
201 <width>100</width>
235 <width>100</width>
202 <height>0</height>
236 <height>0</height>
203 </size>
237 </size>
204 </property>
238 </property>
205 </widget>
239 </widget>
206 </item>
240 </item>
207 <item row="0" column="1">
241 <item row="0" column="1">
208 <widget class="QTableWidget" name="sectionsList"/>
242 <widget class="QTableWidget" name="sectionsList"/>
209 </item>
243 </item>
210 </layout>
244 </layout>
211 </widget>
245 </widget>
212 </widget>
246 </widget>
213 </item>
247 </item>
214 </layout>
248 </layout>
215 </widget>
249 </widget>
216 <customwidgets>
250 <customwidgets>
217 <customwidget>
251 <customwidget>
218 <class>QHexEdit</class>
252 <class>QHexEdit</class>
219 <extends>QWidget</extends>
253 <extends>QWidget</extends>
220 <header location="global">qhexedit.h</header>
254 <header location="global">qhexedit.h</header>
221 <container>1</container>
255 <container>1</container>
222 </customwidget>
256 </customwidget>
223 </customwidgets>
257 </customwidgets>
224 <resources/>
258 <resources/>
225 <connections/>
259 <connections/>
226 </ui>
260 </ui>
General Comments 0
You need to be logged in to leave comments. Login now