Include info in section.

This commit is contained in:
Christian Speckner 2024-07-05 23:00:33 +02:00
parent 9cc43a80e5
commit 5fd00ec763
3 changed files with 7 additions and 2 deletions

View File

@ -85,8 +85,10 @@ CartridgeELF::CartridgeELF(const ByteBuffer& image, size_t size, string_view md5
cout << "ELF sections:" << std::endl << std::endl; cout << "ELF sections:" << std::endl << std::endl;
size_t i = 0; size_t i = 0;
for (auto& section: elfParser.getSections()) for (auto& section: elfParser.getSections()) {
if (section.type != 0x00) cout << (i++) << " " << section << std::endl; if (section.type != 0x00) cout << i << " " << section << std::endl;
i++;
}
auto symbols = elfParser.getSymbols(); auto symbols = elfParser.getSymbols();
cout << std::endl << "ELF symbols:" << std::endl << std::endl; cout << std::endl << "ELF symbols:" << std::endl << std::endl;

View File

@ -119,6 +119,7 @@ ElfParser::Section ElfParser::readSection(uInt32 offset) const {
section.virtualAddress = read32(offset + 0x0c); section.virtualAddress = read32(offset + 0x0c);
section.offset = read32(offset + 0x10); section.offset = read32(offset + 0x10);
section.size = read32(offset + 0x14); section.size = read32(offset + 0x14);
section.info = read32(offset + 0x1c);
section.align = read32(offset + 0x20); section.align = read32(offset + 0x20);
if (section.offset + section.size >= size) if (section.offset + section.size >= size)
@ -207,6 +208,7 @@ ostream& operator<<(ostream& os, const ElfParser::Section& section)
os os
<< " size=" << section.size << " size=" << section.size
<< " info=" << section.info
<< " align=" << section.align; << " align=" << section.align;
return os; return os;

View File

@ -61,6 +61,7 @@ class ElfParser {
uInt32 offset; uInt32 offset;
uInt32 size; uInt32 size;
uInt32 info;
uInt32 align; uInt32 align;
}; };