2012-07-27 16:54:26 +03:00
|
|
|
#include <iostream>
|
|
|
|
#include <elfio_dump.hpp>
|
|
|
|
|
|
|
|
using namespace ELFIO;
|
|
|
|
|
|
|
|
int main( int argc, char** argv )
|
|
|
|
{
|
|
|
|
if ( argc != 2 ) {
|
|
|
|
printf( "Usage: ELFDump <file_name>\n" );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Open ELF reader
|
|
|
|
elfio reader;
|
|
|
|
|
|
|
|
if ( !reader.load( argv[1] ) ) {
|
|
|
|
printf( "File %s is not found or it is not an ELF file\n", argv[1] );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Print ELF file header
|
2012-08-18 16:29:08 +03:00
|
|
|
dump::header ( std::cout, reader );
|
|
|
|
dump::section_headers( std::cout, reader );
|
2012-08-19 18:48:02 +03:00
|
|
|
dump::segment_headers( std::cout, reader );
|
2012-07-27 16:54:26 +03:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|