mirror of
https://github.com/serge1/ELFIO.git
synced 2025-01-29 21:32:44 +00:00
Add dump function for .modinfo section
This commit is contained in:
parent
5cb9c18ef1
commit
761d70da2c
@ -671,6 +671,31 @@ class dump
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static void modinfo( std::ostream& out, const elfio& reader )
|
||||
{
|
||||
Elf_Half no = reader.sections.size();
|
||||
for ( Elf_Half i = 0; i < no; ++i ) { // For all sections
|
||||
section* sec = reader.sections[i];
|
||||
if ( ".modinfo" == sec->get_name() ) { // Look for the section
|
||||
out << "Section .modinfo" << std::endl;
|
||||
|
||||
const_modinfo_section_accessor modinfo( sec );
|
||||
for ( auto i = 0; i < modinfo.get_attribute_num(); i++ ) {
|
||||
std::string field;
|
||||
std::string value;
|
||||
if ( modinfo.get_attribute( i, field, value ) ) {
|
||||
out << " " << std::setw( 20 ) << field
|
||||
<< std::setw( 0 ) << " = " << value << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
out << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static void
|
||||
note( std::ostream& out, int no, Elf_Word type, const std::string& name )
|
||||
|
@ -51,6 +51,7 @@ int main( int argc, char** argv )
|
||||
dump::segment_headers( std::cout, reader );
|
||||
dump::symbol_tables( std::cout, reader );
|
||||
dump::notes( std::cout, reader );
|
||||
dump::modinfo( std::cout, reader );
|
||||
dump::dynamic_tags( std::cout, reader );
|
||||
dump::section_datas( std::cout, reader );
|
||||
dump::segment_datas( std::cout, reader );
|
||||
|
Loading…
x
Reference in New Issue
Block a user