mirror of
https://github.com/serge1/ELFIO.git
synced 2025-04-16 05:42:31 +00:00
Address more warnings reported by SonarLint
This commit is contained in:
parent
c546c16222
commit
766f5e4dda
@ -298,26 +298,26 @@ constexpr Elf_Half EM_GRAPHCORE_IPU = 248; // Graphcore Intelligent Processing
|
|||||||
constexpr Elf_Half EM_IMG1 = 249; // Imagination Technologies
|
constexpr Elf_Half EM_IMG1 = 249; // Imagination Technologies
|
||||||
constexpr Elf_Half EM_NFP = 250; // Netronome Flow Processor (P)
|
constexpr Elf_Half EM_NFP = 250; // Netronome Flow Processor (P)
|
||||||
constexpr Elf_Half EM_CSKY = 252; // C-SKY processor family
|
constexpr Elf_Half EM_CSKY = 252; // C-SKY processor family
|
||||||
constexpr Elf_Half EM_ARC_COMPACT3_64 = 253; // "Synopsys ARCv2.3 64-bit";
|
constexpr Elf_Half EM_ARC_COMPACT3_64 = 253; // Synopsys ARCv2.3 64-bit
|
||||||
constexpr Elf_Half EM_MCS6502 = 254; // "MOS Technology MCS 6502 processor";
|
constexpr Elf_Half EM_MCS6502 = 254; // MOS Technology MCS 6502 processor
|
||||||
constexpr Elf_Half EM_ARC_COMPACT3 = 255; // "Synopsys ARCv2.3 32-bit";
|
constexpr Elf_Half EM_ARC_COMPACT3 = 255; // Synopsys ARCv2.3 32-bit
|
||||||
constexpr Elf_Half EM_KVX = 256; // "Kalray VLIW core of the MPPA processor family";
|
constexpr Elf_Half EM_KVX = 256; // Kalray VLIW core of the MPPA processor family
|
||||||
constexpr Elf_Half EM_65816 = 257; // "WDC 65816/65C816";
|
constexpr Elf_Half EM_65816 = 257; // WDC 65816/65C816
|
||||||
constexpr Elf_Half EM_LOONGARCH = 258; // "Loongson Loongarch";
|
constexpr Elf_Half EM_LOONGARCH = 258; // Loongson Loongarch
|
||||||
constexpr Elf_Half EM_KF32 = 259; // "ChipON KungFu32";
|
constexpr Elf_Half EM_KF32 = 259; // ChipON KungFu32
|
||||||
|
|
||||||
constexpr Elf_Half EM_MT = 0x2530; // "Morpho Techologies MT processor";
|
constexpr Elf_Half EM_MT = 0x2530; // Morpho Techologies MT processor
|
||||||
constexpr Elf_Half EM_ALPHA = 0x9026; // "Alpha";
|
constexpr Elf_Half EM_ALPHA = 0x9026; // Alpha
|
||||||
constexpr Elf_Half EM_WEBASSEMBLY = 0x4157; // "Web Assembly";
|
constexpr Elf_Half EM_WEBASSEMBLY = 0x4157; // Web Assembly
|
||||||
constexpr Elf_Half EM_DLX = 0x5aa5; // "OpenDLX";
|
constexpr Elf_Half EM_DLX = 0x5aa5; // OpenDLX
|
||||||
constexpr Elf_Half EM_XSTORMY16 = 0xad45; // "Sanyo XStormy16 CPU core";
|
constexpr Elf_Half EM_XSTORMY16 = 0xad45; // Sanyo XStormy16 CPU core
|
||||||
constexpr Elf_Half EM_IQ2000 = 0xFEBA; // "Vitesse IQ2000";
|
constexpr Elf_Half EM_IQ2000 = 0xFEBA; // Vitesse IQ2000
|
||||||
constexpr Elf_Half EM_M32C_OLD = 0xFEB;
|
constexpr Elf_Half EM_M32C_OLD = 0xFEB;
|
||||||
constexpr Elf_Half EM_NIOS32 = 0xFEBB; // "Altera Nios";
|
constexpr Elf_Half EM_NIOS32 = 0xFEBB; // Altera Nios
|
||||||
constexpr Elf_Half EM_CYGNUS_MEP = 0xF00D; // "Toshiba MeP Media Engine";
|
constexpr Elf_Half EM_CYGNUS_MEP = 0xF00D; // Toshiba MeP Media Engine
|
||||||
constexpr Elf_Half EM_ADAPTEVA_EPIPHANY = 0x1223; // "Adapteva EPIPHANY";
|
constexpr Elf_Half EM_ADAPTEVA_EPIPHANY = 0x1223; // Adapteva EPIPHANY
|
||||||
constexpr Elf_Half EM_CYGNUS_FRV = 0x5441; // "Fujitsu FR-V";
|
constexpr Elf_Half EM_CYGNUS_FRV = 0x5441; // Fujitsu FR-V
|
||||||
constexpr Elf_Half EM_S12Z = 0x4DEF; // "Freescale S12Z";
|
constexpr Elf_Half EM_S12Z = 0x4DEF; // Freescale S12Z
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// File version
|
// File version
|
||||||
@ -580,7 +580,7 @@ constexpr Elf_Word NT_WIN32PSTATUS = 18; // Has a struct win32_pstatus
|
|||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
||||||
// Note name must be "LINUX"
|
// Note name must be "LINUX"
|
||||||
constexpr Elf_Word NT_PRXFPREG = 0x46e62b7f; // Contains a user_xfpregs_struct;
|
constexpr Elf_Word NT_PRXFPREG = 0x46e62b7f; // Contains a user_xfpregs_struct
|
||||||
constexpr Elf_Word NT_PPC_VMX = 0x100; // PowerPC Altivec/VMX registers
|
constexpr Elf_Word NT_PPC_VMX = 0x100; // PowerPC Altivec/VMX registers
|
||||||
constexpr Elf_Word NT_PPC_VSX = 0x102; // PowerPC VSX registers
|
constexpr Elf_Word NT_PPC_VSX = 0x102; // PowerPC VSX registers
|
||||||
constexpr Elf_Word NT_PPC_TAR = 0x103; // PowerPC Target Address Register
|
constexpr Elf_Word NT_PPC_TAR = 0x103; // PowerPC Target Address Register
|
||||||
|
@ -53,8 +53,8 @@ static const struct endian_table_t
|
|||||||
|
|
||||||
static const struct os_abi_table_t
|
static const struct os_abi_table_t
|
||||||
{
|
{
|
||||||
const unsigned char key;
|
const unsigned char key;
|
||||||
const char* str;
|
const char* str;
|
||||||
} os_abi_table[] = {
|
} os_abi_table[] = {
|
||||||
{ ELFOSABI_NONE, "UNIX System V" },
|
{ ELFOSABI_NONE, "UNIX System V" },
|
||||||
{ ELFOSABI_HPUX, "Hewlett-Packard HP-UX" },
|
{ ELFOSABI_HPUX, "Hewlett-Packard HP-UX" },
|
||||||
@ -517,8 +517,8 @@ static const struct dynamic_tag_t
|
|||||||
{ DT_SYMINFO, "SYMINFO" },
|
{ DT_SYMINFO, "SYMINFO" },
|
||||||
{ DT_ADDRRNGHI, "ADDRRNGHI" },
|
{ DT_ADDRRNGHI, "ADDRRNGHI" },
|
||||||
{ DT_VERSYM, "VERSYM" },
|
{ DT_VERSYM, "VERSYM" },
|
||||||
{ DT_RELACOUNT, "RELACOUNT"},
|
{ DT_RELACOUNT, "RELACOUNT" },
|
||||||
{ DT_RELCOUNT, "RELCOUNT"},
|
{ DT_RELCOUNT, "RELCOUNT" },
|
||||||
{ DT_FLAGS_1, "FLAGS_1" },
|
{ DT_FLAGS_1, "FLAGS_1" },
|
||||||
{ DT_VERDEF, "VERDEF" },
|
{ DT_VERDEF, "VERDEF" },
|
||||||
{ DT_VERDEFNUM, "VERDEFNUM" },
|
{ DT_VERDEFNUM, "VERDEFNUM" },
|
||||||
@ -669,9 +669,6 @@ static const struct note_tag_t
|
|||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#define NT_LARCH_LBT 0xa04 /* LoongArch Binary Translation registers */
|
|
||||||
/* note name must be "CORE". */
|
|
||||||
|
|
||||||
static const ELFIO::Elf_Xword MAX_DATA_ENTRIES = 64;
|
static const ELFIO::Elf_Xword MAX_DATA_ENTRIES = 64;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -700,7 +697,8 @@ class dump
|
|||||||
<< std::endl
|
<< std::endl
|
||||||
<< " ELFVersion: " << str_version( reader.get_elf_version() )
|
<< " ELFVersion: " << str_version( reader.get_elf_version() )
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< " OS/ABI: " << str_os_abi(reader.get_os_abi()) << std::endl
|
<< " OS/ABI: " << str_os_abi( reader.get_os_abi() )
|
||||||
|
<< std::endl
|
||||||
<< " ABI Version:" << (int)reader.get_abi_version() << std::endl
|
<< " ABI Version:" << (int)reader.get_abi_version() << std::endl
|
||||||
<< " Type: " << str_type( reader.get_type() ) << std::endl
|
<< " Type: " << str_type( reader.get_type() ) << std::endl
|
||||||
<< " Machine: " << str_machine( reader.get_machine() )
|
<< " Machine: " << str_machine( reader.get_machine() )
|
||||||
@ -737,7 +735,7 @@ class dump
|
|||||||
}
|
}
|
||||||
|
|
||||||
for ( Elf_Half i = 0; i < n; ++i ) { // For all sections
|
for ( Elf_Half i = 0; i < n; ++i ) { // For all sections
|
||||||
section* sec = reader.sections[i];
|
const section* sec = reader.sections[i];
|
||||||
section_header( out, i, sec, reader.get_class() );
|
section_header( out, i, sec, reader.get_class() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,7 +812,7 @@ class dump
|
|||||||
}
|
}
|
||||||
|
|
||||||
for ( Elf_Half i = 0; i < n; ++i ) {
|
for ( Elf_Half i = 0; i < n; ++i ) {
|
||||||
segment* seg = reader.segments[i];
|
const segment* seg = reader.segments[i];
|
||||||
segment_header( out, i, seg, reader.get_class() );
|
segment_header( out, i, seg, reader.get_class() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -862,59 +860,57 @@ class dump
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void symbol_tables( std::ostream& out, const elfio& reader )
|
static void symbol_tables( std::ostream& out, const elfio& reader )
|
||||||
{
|
{
|
||||||
Elf_Half n = reader.sections.size();
|
for ( const auto& sec : reader.sections ) { // For all sections
|
||||||
for ( Elf_Half i = 0; i < n; ++i ) { // For all sections
|
|
||||||
section* sec = reader.sections[i];
|
|
||||||
if ( SHT_SYMTAB == sec->get_type() ||
|
if ( SHT_SYMTAB == sec->get_type() ||
|
||||||
SHT_DYNSYM == sec->get_type() ) {
|
SHT_DYNSYM == sec->get_type() ) {
|
||||||
symbol_section_accessor symbols( reader, sec );
|
const_symbol_section_accessor symbols( reader, sec.get() );
|
||||||
|
|
||||||
Elf_Xword sym_no = symbols.get_symbols_num();
|
Elf_Xword sym_no = symbols.get_symbols_num();
|
||||||
if ( sym_no > 0 ) {
|
if ( sym_no == 0 ) {
|
||||||
out << "Symbol table (" << sec->get_name() << ")"
|
continue;
|
||||||
<< std::endl;
|
|
||||||
if ( reader.get_class() ==
|
|
||||||
ELFCLASS32 ) { // Output for 32-bit
|
|
||||||
out << "[ Nr ] Value Size Type Bind "
|
|
||||||
" Sect Name"
|
|
||||||
<< std::endl;
|
|
||||||
}
|
|
||||||
else { // Output for 64-bit
|
|
||||||
out << "[ Nr ] Value Size "
|
|
||||||
"Type Bind Sect"
|
|
||||||
<< std::endl
|
|
||||||
<< " Name" << std::endl;
|
|
||||||
}
|
|
||||||
for ( Elf_Xword i = 0; i < sym_no; ++i ) {
|
|
||||||
std::string name;
|
|
||||||
Elf64_Addr value = 0;
|
|
||||||
Elf_Xword size = 0;
|
|
||||||
unsigned char bind = 0;
|
|
||||||
unsigned char type = 0;
|
|
||||||
Elf_Half section = 0;
|
|
||||||
unsigned char other = 0;
|
|
||||||
symbols.get_symbol( i, name, value, size, bind, type,
|
|
||||||
section, other );
|
|
||||||
symbol_table( out, i, name, value, size, bind, type,
|
|
||||||
section, reader.get_class() );
|
|
||||||
}
|
|
||||||
|
|
||||||
out << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out << "Symbol table (" << sec->get_name() << ")" << std::endl;
|
||||||
|
if ( reader.get_class() == ELFCLASS32 ) { // Output for 32-bit
|
||||||
|
out << "[ Nr ] Value Size Type Bind "
|
||||||
|
" Sect Name"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
else { // Output for 64-bit
|
||||||
|
out << "[ Nr ] Value Size "
|
||||||
|
"Type Bind Sect"
|
||||||
|
<< std::endl
|
||||||
|
<< " Name" << std::endl;
|
||||||
|
}
|
||||||
|
for ( Elf_Xword i = 0; i < sym_no; ++i ) {
|
||||||
|
std::string name;
|
||||||
|
Elf64_Addr value = 0;
|
||||||
|
Elf_Xword size = 0;
|
||||||
|
unsigned char bind = 0;
|
||||||
|
unsigned char type = 0;
|
||||||
|
Elf_Half section = 0;
|
||||||
|
unsigned char other = 0;
|
||||||
|
symbols.get_symbol( i, name, value, size, bind, type,
|
||||||
|
section, other );
|
||||||
|
symbol_table( out, i, name, value, size, bind, type,
|
||||||
|
section, reader.get_class() );
|
||||||
|
}
|
||||||
|
|
||||||
|
out << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void symbol_table( std::ostream& out,
|
static void symbol_table( std::ostream& out,
|
||||||
Elf_Xword no,
|
Elf_Xword no,
|
||||||
std::string& name,
|
const std::string& name,
|
||||||
Elf64_Addr value,
|
Elf64_Addr value,
|
||||||
Elf_Xword size,
|
Elf_Xword size,
|
||||||
unsigned char bind,
|
unsigned char bind,
|
||||||
unsigned char type,
|
unsigned char type,
|
||||||
Elf_Half section,
|
Elf_Half section,
|
||||||
unsigned int elf_class )
|
unsigned int elf_class )
|
||||||
{
|
{
|
||||||
std::ios_base::fmtflags original_flags = out.flags();
|
std::ios_base::fmtflags original_flags = out.flags();
|
||||||
|
|
||||||
@ -944,62 +940,63 @@ class dump
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void notes( std::ostream& out, const elfio& reader )
|
static void notes( std::ostream& out, const elfio& reader )
|
||||||
{
|
{
|
||||||
Elf_Half no = reader.sections.size();
|
for ( const auto& sec : reader.sections ) { // For all sections
|
||||||
for ( Elf_Half i = 0; i < no; ++i ) { // For all sections
|
if ( SHT_NOTE == sec->get_type() ) { // Look at notes
|
||||||
section* sec = reader.sections[i];
|
note_section_accessor notes( reader, sec.get() );
|
||||||
if ( SHT_NOTE == sec->get_type() ) { // Look at notes
|
|
||||||
note_section_accessor notes( reader, sec );
|
|
||||||
Elf_Word no_notes = notes.get_notes_num();
|
Elf_Word no_notes = notes.get_notes_num();
|
||||||
if ( no > 0 ) {
|
|
||||||
out << "Note section (" << sec->get_name() << ")"
|
|
||||||
<< std::endl
|
|
||||||
<< " No Name Data size Description"
|
|
||||||
<< std::endl;
|
|
||||||
for ( Elf_Word j = 0; j < no_notes; ++j ) { // For all notes
|
|
||||||
Elf_Word type;
|
|
||||||
std::string name;
|
|
||||||
char* desc;
|
|
||||||
Elf_Word descsz;
|
|
||||||
|
|
||||||
if ( notes.get_note( j, type, name, desc, descsz ) ) {
|
if ( no_notes == 0 )
|
||||||
// 'name' usually contains \0 at the end. Remove it
|
continue;
|
||||||
name = name.c_str();
|
|
||||||
note( out, j, type, name, desc, descsz );
|
out << "Note section (" << sec->get_name() << ")" << std::endl
|
||||||
out << std::endl;
|
<< " No Name Data size Description"
|
||||||
}
|
<< std::endl;
|
||||||
|
for ( Elf_Word j = 0; j < no_notes; ++j ) { // For all notes
|
||||||
|
Elf_Word type;
|
||||||
|
std::string name;
|
||||||
|
char* desc;
|
||||||
|
Elf_Word descsz;
|
||||||
|
|
||||||
|
if ( notes.get_note( j, type, name, desc, descsz ) ) {
|
||||||
|
// 'name' usually contains \0 at the end. Remove it
|
||||||
|
name = name.c_str();
|
||||||
|
note( out, j, type, name, desc, descsz );
|
||||||
|
out << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
no = reader.segments.size();
|
Elf_Half no = reader.segments.size();
|
||||||
for ( Elf_Half i = 0; i < no; ++i ) { // For all segments
|
for ( Elf_Half i = 0; i < no; ++i ) { // For all segments
|
||||||
segment* seg = reader.segments[i];
|
segment* seg = reader.segments[i];
|
||||||
if ( PT_NOTE == seg->get_type() ) { // Look at notes
|
if ( PT_NOTE == seg->get_type() ) { // Look at notes
|
||||||
note_segment_accessor notes( reader, seg );
|
note_segment_accessor notes( reader, seg );
|
||||||
Elf_Word no_notes = notes.get_notes_num();
|
Elf_Word no_notes = notes.get_notes_num();
|
||||||
if ( no > 0 ) {
|
|
||||||
out << "Note segment (" << i << ")" << std::endl
|
|
||||||
<< " No Name Data size Description"
|
|
||||||
<< std::endl;
|
|
||||||
for ( Elf_Word j = 0; j < no_notes; ++j ) { // For all notes
|
|
||||||
Elf_Word type;
|
|
||||||
std::string name;
|
|
||||||
char* desc;
|
|
||||||
Elf_Word descsz;
|
|
||||||
|
|
||||||
if ( notes.get_note( j, type, name, desc, descsz ) ) {
|
if ( no_notes == 0 )
|
||||||
// 'name' usually contains \0 at the end. Remove it
|
continue;
|
||||||
name = name.c_str();
|
|
||||||
note( out, j, type, name, desc, descsz );
|
out << "Note segment (" << i << ")" << std::endl
|
||||||
out << std::endl;
|
<< " No Name Data size Description"
|
||||||
}
|
<< std::endl;
|
||||||
|
for ( Elf_Word j = 0; j < no_notes; ++j ) { // For all notes
|
||||||
|
Elf_Word type;
|
||||||
|
std::string name;
|
||||||
|
char* desc;
|
||||||
|
Elf_Word descsz;
|
||||||
|
|
||||||
|
if ( notes.get_note( j, type, name, desc, descsz ) ) {
|
||||||
|
// 'name' usually contains \0 at the end. Remove it
|
||||||
|
name = name.c_str();
|
||||||
|
note( out, j, type, name, desc, descsz );
|
||||||
|
out << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
out << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1014,7 +1011,7 @@ class dump
|
|||||||
{
|
{
|
||||||
out << " [" << DUMP_DEC_FORMAT( 2 ) << no << "] ";
|
out << " [" << DUMP_DEC_FORMAT( 2 ) << no << "] ";
|
||||||
|
|
||||||
const note_tag_t* name_group = std::find_if(
|
const auto name_group = std::find_if(
|
||||||
std::begin( note_tag_table ), std::end( note_tag_table ),
|
std::begin( note_tag_table ), std::end( note_tag_table ),
|
||||||
[&name]( const note_tag_t& entry ) { return entry.name == name; } );
|
[&name]( const note_tag_t& entry ) { return entry.name == name; } );
|
||||||
|
|
||||||
@ -1054,13 +1051,11 @@ class dump
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void modinfo( std::ostream& out, const elfio& reader )
|
static void modinfo( std::ostream& out, const elfio& reader )
|
||||||
{
|
{
|
||||||
Elf_Half no = reader.sections.size();
|
for ( const auto& sec : reader.sections ) { // For all sections
|
||||||
for ( Elf_Half i = 0; i < no; ++i ) { // For all sections
|
if ( ".modinfo" == sec->get_name() ) { // Look for the section
|
||||||
section* sec = reader.sections[i];
|
|
||||||
if ( ".modinfo" == sec->get_name() ) { // Look for the section
|
|
||||||
out << "Section .modinfo" << std::endl;
|
out << "Section .modinfo" << std::endl;
|
||||||
|
|
||||||
const_modinfo_section_accessor modinfo( sec );
|
const_modinfo_section_accessor modinfo( sec.get() );
|
||||||
for ( Elf_Word i = 0; i < modinfo.get_attribute_num(); i++ ) {
|
for ( Elf_Word i = 0; i < modinfo.get_attribute_num(); i++ ) {
|
||||||
std::string field;
|
std::string field;
|
||||||
std::string value;
|
std::string value;
|
||||||
@ -1079,41 +1074,39 @@ class dump
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void dynamic_tags( std::ostream& out, const elfio& reader )
|
static void dynamic_tags( std::ostream& out, const elfio& reader )
|
||||||
{
|
{
|
||||||
Elf_Half n = reader.sections.size();
|
for ( const auto& sec : reader.sections ) { // For all sections
|
||||||
for ( Elf_Half i = 0; i < n; ++i ) { // For all sections
|
|
||||||
section* sec = reader.sections[i];
|
|
||||||
if ( SHT_DYNAMIC == sec->get_type() ) {
|
if ( SHT_DYNAMIC == sec->get_type() ) {
|
||||||
dynamic_section_accessor dynamic( reader, sec );
|
dynamic_section_accessor dynamic( reader, sec.get() );
|
||||||
|
|
||||||
Elf_Xword dyn_no = dynamic.get_entries_num();
|
Elf_Xword dyn_no = dynamic.get_entries_num();
|
||||||
if ( dyn_no > 0 ) {
|
if ( dyn_no == 0 )
|
||||||
out << "Dynamic section (" << sec->get_name() << ")"
|
continue;
|
||||||
<< std::endl;
|
|
||||||
out << "[ Nr ] Tag Name/Value" << std::endl;
|
|
||||||
for ( Elf_Xword i = 0; i < dyn_no; ++i ) {
|
|
||||||
Elf_Xword tag = 0;
|
|
||||||
Elf_Xword value = 0;
|
|
||||||
std::string str;
|
|
||||||
dynamic.get_entry( i, tag, value, str );
|
|
||||||
dynamic_tag( out, i, tag, value, str,
|
|
||||||
reader.get_class() );
|
|
||||||
if ( DT_NULL == tag ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
out << std::endl;
|
out << "Dynamic section (" << sec->get_name() << ")"
|
||||||
|
<< std::endl;
|
||||||
|
out << "[ Nr ] Tag Name/Value" << std::endl;
|
||||||
|
for ( Elf_Xword i = 0; i < dyn_no; ++i ) {
|
||||||
|
Elf_Xword tag = 0;
|
||||||
|
Elf_Xword value = 0;
|
||||||
|
std::string str;
|
||||||
|
dynamic.get_entry( i, tag, value, str );
|
||||||
|
dynamic_tag( out, i, tag, value, str, reader.get_class() );
|
||||||
|
if ( DT_NULL == tag ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
static void dynamic_tag( std::ostream& out,
|
static void dynamic_tag( std::ostream& out,
|
||||||
Elf_Xword no,
|
Elf_Xword no,
|
||||||
Elf_Xword tag,
|
Elf_Xword tag,
|
||||||
Elf_Xword value,
|
Elf_Xword value,
|
||||||
std::string str,
|
const std::string& str,
|
||||||
unsigned int /*elf_class*/ )
|
unsigned int /*elf_class*/ )
|
||||||
{
|
{
|
||||||
out << "[" << DUMP_DEC_FORMAT( 5 ) << no << "] "
|
out << "[" << DUMP_DEC_FORMAT( 5 ) << no << "] "
|
||||||
@ -1171,7 +1164,7 @@ class dump
|
|||||||
out << "Section Data:" << std::endl;
|
out << "Section Data:" << std::endl;
|
||||||
|
|
||||||
for ( Elf_Half i = 1; i < n; ++i ) { // For all sections
|
for ( Elf_Half i = 1; i < n; ++i ) { // For all sections
|
||||||
section* sec = reader.sections[i];
|
const section* sec = reader.sections[i];
|
||||||
if ( sec->get_type() == SHT_NOBITS ) {
|
if ( sec->get_type() == SHT_NOBITS ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1226,7 +1219,7 @@ class dump
|
|||||||
out << "Segment Data:" << std::endl;
|
out << "Segment Data:" << std::endl;
|
||||||
|
|
||||||
for ( Elf_Half i = 0; i < n; ++i ) { // For all sections
|
for ( Elf_Half i = 0; i < n; ++i ) { // For all sections
|
||||||
segment* seg = reader.segments[i];
|
const segment* seg = reader.segments[i];
|
||||||
segment_data( out, i, seg );
|
segment_data( out, i, seg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,8 +34,6 @@ template <class S> class symbol_section_accessor_template
|
|||||||
S* symbol_section )
|
S* symbol_section )
|
||||||
: elf_file( elf_file ), symbol_section( symbol_section )
|
: elf_file( elf_file ), symbol_section( symbol_section )
|
||||||
{
|
{
|
||||||
hash_section = nullptr;
|
|
||||||
hash_section_index = 0;
|
|
||||||
find_hash_section();
|
find_hash_section();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user