Added the "frame diagnose" command and use its output to make crash info better.


Added the "frame diagnose" command and use its output to make crash info better.

When a process stops due to a crash, we get the crashing instruction and the
crashing memory location (if there is one). From the user's perspective it is
often unclear what the reason for the crash is in a symbolic sense.

To address this, I have added new fuctionality to StackFrame to parse the
disassembly and reconstruct the sequence of dereferneces and offsets that were
applied to a known variable (or fuction retrn value) to obtain the invalid

This makes use of enhancements in the disassembler, as well as new information
provided by the DWARF expression infrastructure, and is exposed through a
"frame diagnose" command. It is also used to provide symbolic information, when
available, in the event of a crash.

The algorithm is very rudimentary, and it needs a bunch of work, including

  • better parsing for assembly, preferably with help from LLVM
  • support for non-Apple platforms
  • cleanup of the algorithm core, preferably to make it all work in terms of Operands instead of register/offset pairs
  • improvement of the GetExpressioPath() logic to make prettier expression paths, and
  • better handling of vtables.

I welcome all suggestios, improvements, and testcases.


spyffeSep 5 2016, 9:48 PM
rL280691: Revert "bugpoint: Stop threading errors through APIs that never fail"