print: show ellipses when addresses jump in output

This commit is contained in:
Lephenixnoir 2020-06-11 20:03:42 +02:00
parent 2e58a8850b
commit 772a67e35e
Signed by untrusted user: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 11 additions and 1 deletions

View File

@ -63,6 +63,9 @@ private:
/* OS for the target, to mark syscalls before instructions */
std::unique_ptr<OS> m_os;
/* Last printed address (for ellipses) */
uint32_t m_last_address;
/** Internal promotion tree printers **/
void queue(std::string, bool = false);

View File

@ -11,7 +11,8 @@ namespace FxOS {
PrintPass::PrintPass(Disassembly &disasm,
std::vector<SymbolTable> const &symtables):
InstructionDisassemblyPass(disasm, "print"), m_symtables(symtables)
InstructionDisassemblyPass(disasm, "print"), m_symtables(symtables),
m_last_address(0xffffffff)
{
/* Default parameters: all 0 */
@ -27,6 +28,11 @@ void PrintPass::analyze(uint32_t pc, ConcreteInstruction &ci)
{
Instruction const *i = ci.inst;
/* Ellipsis if there is a gap since last instruction */
if(m_last_address+1 != 0 && pc != m_last_address+2)
printf(" ...\n");
/* Preliminary syscall number */
int syscall_id;
@ -95,6 +101,7 @@ void PrintPass::analyze(uint32_t pc, ConcreteInstruction &ci)
}
printf("\n");
m_last_address = pc;
}
std::optional<std::string> PrintPass::symquery(Symbol::Type type,