Enhance verbose output of section table
* Add more section types to prevent "unknown" from printing * Add alloc, exec, and write flags of sections to output table
This commit is contained in:
parent
933680c80d
commit
7e414f8576
@ -148,6 +148,14 @@ static const char *section_type_to_str(Elf64_Word type)
|
|||||||
return "INIT_ARRAY";
|
return "INIT_ARRAY";
|
||||||
case SHT_FINI_ARRAY:
|
case SHT_FINI_ARRAY:
|
||||||
return "FINI_ARRAY";
|
return "FINI_ARRAY";
|
||||||
|
case SHT_PREINIT_ARRAY:
|
||||||
|
return "PREINIT_ARRAY";
|
||||||
|
case SHT_DYNAMIC:
|
||||||
|
return "DYNAMIC";
|
||||||
|
case SHT_ARM_ATTRIBUTES:
|
||||||
|
return "ARM_ATTRIBUTES";
|
||||||
|
case SHT_ARM_PREEMPTMAP:
|
||||||
|
return "ARM_PREEMPTMAP";
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -159,6 +167,7 @@ static void print_sections(elfpatch_handle_t *ep)
|
|||||||
SlList *iter;
|
SlList *iter;
|
||||||
ft_table_t *table;
|
ft_table_t *table;
|
||||||
const struct elf_section *section;
|
const struct elf_section *section;
|
||||||
|
bool alloc, write, exec;
|
||||||
|
|
||||||
ret_if_ep_err(ep);
|
ret_if_ep_err(ep);
|
||||||
|
|
||||||
@ -174,15 +183,23 @@ static void print_sections(elfpatch_handle_t *ep)
|
|||||||
|
|
||||||
/* Write header */
|
/* Write header */
|
||||||
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
ft_set_cell_prop(table, 0, FT_ANY_COLUMN, FT_CPROP_ROW_TYPE, FT_ROW_HEADER);
|
||||||
ft_write_ln(table, "Section", "Type", "Size", "VMA", "LMA", "File Offset");
|
ft_write_ln(table, "Section", "Type", "ALLOC", "WRITE", "EXEC", "Size", "VMA", "LMA", "File Offset");
|
||||||
|
|
||||||
for (iter = ep->sections; iter; iter = sl_list_next(iter)) {
|
for (iter = ep->sections; iter; iter = sl_list_next(iter)) {
|
||||||
section = (const struct elf_section *)iter->data;
|
section = (const struct elf_section *)iter->data;
|
||||||
if (!section)
|
if (!section)
|
||||||
continue;
|
continue;
|
||||||
ft_printf_ln(table, "%s|%s|%lu|%p|%p|%p",
|
|
||||||
|
alloc = !!(section->section_header.sh_flags & SHF_ALLOC);
|
||||||
|
write = !!(section->section_header.sh_flags & SHF_WRITE);
|
||||||
|
exec = !!(section->section_header.sh_flags & SHF_EXECINSTR);
|
||||||
|
|
||||||
|
ft_printf_ln(table, "%s|%s|%s|%s|%s|%lu|%p|%p|%p",
|
||||||
section->name,
|
section->name,
|
||||||
section_type_to_str(section->section_header.sh_type),
|
section_type_to_str(section->section_header.sh_type),
|
||||||
|
alloc ? "x" : "",
|
||||||
|
write ? "x" : "",
|
||||||
|
exec ? "x" : "",
|
||||||
section->section_header.sh_size,
|
section->section_header.sh_size,
|
||||||
(void *)section->section_header.sh_addr,
|
(void *)section->section_header.sh_addr,
|
||||||
(void *)section->lma,
|
(void *)section->lma,
|
||||||
|
Loading…
Reference in New Issue
Block a user