Skip to content

Conversation

elicn
Copy link
Member

@elicn elicn commented Oct 2, 2022

Looking for feedback!

Though the outcome looks nice, I am not satisfied with current design. The code is not as elegant and the current design does not offer enough customization possibilities. After playing around with it for a while I couldn't get it look any better, so I'll appreciate any feedback and design suggestions.

The class will remain an extension until it qualifies for core.


Introducing a new crash dump class named StateView to replace the existing error dumps with a more human-readable format, standardized across different archtiectures.

The new format dumps key state data, including:

  • CPU state: in attempt to make it general enough to fit all architectures, regs and layout are configurable
  • Stack dump around arch_sp
  • Hex dump around arch_pc
  • Disassembly
  • Memory map

Example output, showing UEFI / x86-64:

from qiling.extensions.stateview import StateView

# OS emulation error method
def emu_error(self):
	sv = StateView(self.ql)

	sv.dump((
		((8, 'rax'), (8, 'r8 ')),
		((8, 'rbx'), (8, 'r9 ')),
		((8, 'rcx'), (8, 'r10')),
		((8, 'rdx'), (8, 'r11')),
		((8, 'rsi'), (8, 'r12')),
		((8, 'rdi'), (8, 'r13')),
		((8, 'rsp'), (8, 'r14')),
		((8, 'rbp'), (8, 'r15')),
		((8, 'rip'),),
		(),
		((4, 'cs'), (4, 'es'), (4, 'gs')),
		((4, 'ds'), (4, 'fs'), (4, 'ss')),
		(),
		((16, 'xmm0 '), (16, 'xmm8 ')),
		((16, 'xmm1 '), (16, 'xmm9 ')),
		((16, 'xmm2 '), (16, 'xmm10')),
		((16, 'xmm3 '), (16, 'xmm11')),
		((16, 'xmm4 '), (16, 'xmm12')),
		((16, 'xmm5 '), (16, 'xmm13')),
		((16, 'xmm6 '), (16, 'xmm14')),
		((16, 'xmm7 '), (16, 'xmm15')),
	))

will result in:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant