1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

LibJS/JIT: Avoid crashing while disassembling empty functions

This commit is contained in:
Simon Wanner 2023-11-01 00:41:15 +01:00 committed by Andreas Kling
parent 68f4d21de2
commit e73a1803ac

View file

@ -79,9 +79,13 @@ void NativeExecutable::dump_disassembly([[maybe_unused]] Bytecode::Executable co
auto symbol_provider = JITSymbolProvider(*this);
auto mapping = m_mapping.begin();
auto first_instruction = Bytecode::InstructionStreamIterator { executable.basic_blocks[0]->instruction_stream(), &executable };
auto source_range = first_instruction.source_range().realize();
dbgln("Disassembly of '{}' ({}:{}:{}):", executable.name, source_range.filename(), source_range.start.line, source_range.start.column);
if (!executable.basic_blocks.is_empty() && executable.basic_blocks[0]->size() != 0) {
auto first_instruction = Bytecode::InstructionStreamIterator { executable.basic_blocks[0]->instruction_stream(), &executable };
auto source_range = first_instruction.source_range().realize();
dbgln("Disassembly of '{}' ({}:{}:{}):", executable.name, source_range.filename(), source_range.start.line, source_range.start.column);
} else {
dbgln("Disassembly of '{}':", executable.name);
}
while (true) {
auto offset = stream.offset();