summaryrefslogtreecommitdiff
path: root/plugins/readelf/header.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-12-13 11:40:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-12-13 11:40:53 (GMT)
commit73d58a38c5847f54aa9458b3612ffd35b7372dc9 (patch)
treeb1412630f4679cdf5c9e97943f0fb9645a426592 /plugins/readelf/header.c
parent3754a5e3edeea98ce426b65772708ae91b291c1f (diff)
Ensured all symbol comments match their symbol address.
Diffstat (limited to 'plugins/readelf/header.c')
-rw-r--r--plugins/readelf/header.c70
1 files changed, 23 insertions, 47 deletions
diff --git a/plugins/readelf/header.c b/plugins/readelf/header.c
index 8d9309e..4301cc2 100644
--- a/plugins/readelf/header.c
+++ b/plugins/readelf/header.c
@@ -48,7 +48,6 @@ bool annotate_elf_header(GElfFormat *format)
const elf_header *header; /* En-tête principale */
SourceEndian endian; /* Boutisme utilisé */
vmpa2t pos; /* Tête de lecture des symboles*/
- vmpa2t start; /* Localisation des symboles */
GArchInstruction *instr; /* Instruction décodée */
GArchOperand *operand; /* Opérande à venir modifier */
GDbComment *comment; /* Définition de commentaire */
@@ -65,14 +64,13 @@ bool annotate_elf_header(GElfFormat *format)
/* ELFMAG (0) */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_8_BITS, 4, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 1, IOD_CHAR);
SET_IMM_DISPLAY(instr, operand, 2, IOD_CHAR);
SET_IMM_DISPLAY(instr, operand, 3, IOD_CHAR);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("ELF magic number"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("ELF magic number"));
/* EI_CLASS (4) */
@@ -92,12 +90,11 @@ bool annotate_elf_header(GElfFormat *format)
break;
}
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_8_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, text);
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, text);
/* EI_DATA (5) */
@@ -117,12 +114,11 @@ bool annotate_elf_header(GElfFormat *format)
break;
}
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_8_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, text);
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, text);
/* EI_VERSION (6) */
@@ -139,12 +135,11 @@ bool annotate_elf_header(GElfFormat *format)
break;
}
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_8_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, text);
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, text);
/* EI_OSABI (7) */
@@ -197,30 +192,27 @@ bool annotate_elf_header(GElfFormat *format)
break;
}
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_8_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, text);
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, text);
/* EI_ABIVERSION (8) */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_8_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("ABI version"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("ABI version"));
/* Padding */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_8_BITS, 7, &pos, endian);
g_raw_instruction_mark_as_padding(G_RAW_INSTRUCTION(instr), true);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Padding"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Padding"));
/* Champ "e_type" */
@@ -252,12 +244,11 @@ bool annotate_elf_header(GElfFormat *format)
break;
}
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, text);
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, text);
/* Champ "e_machine" */
@@ -344,44 +335,39 @@ bool annotate_elf_header(GElfFormat *format)
default: text = _("Architecture: unknown"); break;
}
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, text);
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, text);
/* Champ "e_version" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Object file version"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Object file version"));
if (header->hdr32.e_ident[EI_CLASS] == ELFCLASS32)
{
/* Champ "e_entry" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, &pos, endian);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Entry point virtual address"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Entry point virtual address"));
/* Champ "e_phoff" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, &pos, endian);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Program header table file offset"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Program header table file offset"));
/* Champ "e_shoff" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, &pos, endian);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Section header table file offset"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Section header table file offset"));
}
@@ -389,24 +375,21 @@ bool annotate_elf_header(GElfFormat *format)
{
/* Champ "e_entry" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, &pos, endian);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Entry point virtual address"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Entry point virtual address"));
/* Champ "e_phoff" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, &pos, endian);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Program header table file offset"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Program header table file offset"));
/* Champ "e_shoff" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_64_BITS, 1, &pos, endian);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Section header table file offset"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Section header table file offset"));
}
@@ -414,66 +397,59 @@ bool annotate_elf_header(GElfFormat *format)
/* Champ "e_flags" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_32_BITS, 1, &pos, endian);
//SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Processor-specific flags"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Processor-specific flags"));
/* Champ "e_ehsize" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("ELF header size in bytes"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("ELF header size in bytes"));
/* Champ "e_phentsize" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Program header table entry size"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Program header table entry size"));
/* Champ "e_phnum" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Program header table entry count"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Program header table entry count"));
/* Champ "e_shentsize" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Section header table entry size"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Section header table entry size"));
/* Champ "e_shnum" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Section header table entry count"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Section header table entry count"));
/* Champ "e_shstrndx" */
- copy_vmpa(&start, &pos);
instr = g_raw_instruction_new_array(content, MDS_16_BITS, 1, &pos, endian);
SET_IMM_DISPLAY(instr, operand, 0, IOD_DEC);
- ADD_RAW_AS_SYM(format, symbol, &start, instr, comment, _("Section header string table index"));
+ ADD_RAW_AS_SYM(format, symbol, instr, comment, _("Section header string table index"));
g_object_unref(G_OBJECT(content));