|
@@ -18,7 +18,7 @@
|
|
|
|
|
|
ErrorOr<int> serenity_main(Main::Arguments args)
|
|
|
{
|
|
|
- const char* path = nullptr;
|
|
|
+ char const* path = nullptr;
|
|
|
|
|
|
Core::ArgsParser args_parser;
|
|
|
args_parser.set_general_help(
|
|
@@ -41,28 +41,28 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|
|
};
|
|
|
Vector<Symbol> symbols;
|
|
|
|
|
|
- const u8* asm_data = (const u8*)file->data();
|
|
|
+ u8 const* asm_data = static_cast<u8 const*>(file->data());
|
|
|
size_t asm_size = file->size();
|
|
|
size_t file_offset = 0;
|
|
|
Vector<Symbol>::Iterator current_symbol = symbols.begin();
|
|
|
OwnPtr<X86::ELFSymbolProvider> symbol_provider; // nullptr for non-ELF disassembly.
|
|
|
OwnPtr<ELF::Image> elf;
|
|
|
- if (asm_size >= 4 && strncmp((const char*)asm_data, "\u007fELF", 4) == 0) {
|
|
|
+ if (asm_size >= 4 && strncmp(reinterpret_cast<char const*>(asm_data), "\u007fELF", 4) == 0) {
|
|
|
elf = make<ELF::Image>(asm_data, asm_size);
|
|
|
if (elf->is_valid()) {
|
|
|
symbol_provider = make<X86::ELFSymbolProvider>(*elf);
|
|
|
- elf->for_each_section_of_type(SHT_PROGBITS, [&](const ELF::Image::Section& section) {
|
|
|
+ elf->for_each_section_of_type(SHT_PROGBITS, [&](ELF::Image::Section const& section) {
|
|
|
// FIXME: Disassemble all SHT_PROGBITS sections, not just .text.
|
|
|
if (section.name() != ".text")
|
|
|
return IterationDecision::Continue;
|
|
|
- asm_data = (const u8*)section.raw_data();
|
|
|
+ asm_data = reinterpret_cast<u8 const*>(section.raw_data());
|
|
|
asm_size = section.size();
|
|
|
file_offset = section.address();
|
|
|
return IterationDecision::Break;
|
|
|
});
|
|
|
symbols.ensure_capacity(elf->symbol_count() + 1);
|
|
|
symbols.append({ 0, 0, StringView() }); // Sentinel.
|
|
|
- elf->for_each_symbol([&](const ELF::Image::Symbol& symbol) {
|
|
|
+ elf->for_each_symbol([&](ELF::Image::Symbol const& symbol) {
|
|
|
symbols.append({ symbol.value(), symbol.size(), symbol.name() });
|
|
|
return IterationDecision::Continue;
|
|
|
});
|