From 5dd192cce6fb9434dbef6ebfbb4c509afd422170 Mon Sep 17 00:00:00 2001 From: Serge Lamikhov-Center Date: Fri, 14 Jun 2024 19:53:10 +0300 Subject: [PATCH] Output Section to Segment mapping --- elfio/elfio_dump.hpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/elfio/elfio_dump.hpp b/elfio/elfio_dump.hpp index 33105116..1b4aa753 100644 --- a/elfio/elfio_dump.hpp +++ b/elfio/elfio_dump.hpp @@ -705,10 +705,10 @@ class dump << std::endl << " Version: " << str_version( reader.get_version() ) << std::endl - << " Entry: " - << "0x" << std::hex << reader.get_entry() << std::endl - << " Flags: " - << "0x" << std::hex << reader.get_flags() << std::endl + << " Entry: " << "0x" << std::hex << reader.get_entry() + << std::endl + << " Flags: " << "0x" << std::hex << reader.get_flags() + << std::endl << std::endl; } @@ -820,6 +820,18 @@ class dump segment_header( out, i, seg, reader.get_class() ); } + out << std::endl; + for ( Elf_Half i = 0; i < n; ++i ) { + out << "[" << i << "]" << " "; + const segment* seg = reader.segments[i]; + for ( Elf_Half j = 0; j < seg->get_sections_num(); j++ ) { + const section* sec = + reader.sections[seg->get_section_index_at( j )]; + out << sec->get_name() << " "; + } + out << std::endl; + } + out << std::endl; }