[Lldb-commits] [PATCH] Initial Assembly profiler for mips64

Jason Molenda jmolenda at apple.com
Sat Feb 21 02:03:03 PST 2015

I don't want to necessarily disagree with Greg but his suggestion about implementing an instruction emulation approach is a pretty big change to this patch.  There are two approaches to creating an unwind plan based on an instruction stream:  Hard-code knowledge about a small set of instructions that appear in function epilogues/prologues and use a disassembler to step over the unknown instructions, or have an instruction emulator that knows the behavior of them (well enough) so it can model the relevant instructions.

For arm & arm64, lldb uses instruction emulation.  This was aided by the ARM instruction xml files which allow for much of the emulation code to be generated.

The emulation approach allows for great flexibility, but it is (obviously) a lot more work.  The emulation approach can win when unusual function prologue instructions appear -- with the hard-coded instruction analyzer you need to know all of the different instructions that the compiler or hand-written assembly may use to manipulate the stack pointer, frame pointer, the caller's instruction and any saved registers.

I don't think we should reject this patch in favor of writing this in the emulation style - that's likely to be a big ask.




More information about the lldb-commits mailing list