diff options
author | Sean Callanan <scallanan@apple.com> | 2016-09-06 04:48:36 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2016-09-06 04:48:36 +0000 |
commit | 4740a734bb4a4f20ae4895ded32585e54bb87afb (patch) | |
tree | 9884944c80582b90d8ff4fdbf64fd8716766f8e2 /lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py | |
parent | 24dac6afe29ccbd4455dc44d6d6bc85b04bfbc31 (diff) | |
download | bcm5719-llvm-4740a734bb4a4f20ae4895ded32585e54bb87afb.tar.gz bcm5719-llvm-4740a734bb4a4f20ae4895ded32585e54bb87afb.zip |
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
pointer.
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.
llvm-svn: 280692
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py new file mode 100644 index 00000000000..0f1c109676c --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/frame-diagnose/array/TestArray.py @@ -0,0 +1,25 @@ +""" +Test the output of `frame diagnose` for an array access +""" + +from __future__ import print_function + +import os +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + +class TestArray(TestBase): + mydir = TestBase.compute_mydir(__file__) + + @skipUnlessDarwin + def test_array(self): + TestBase.setUp(self) + self.build() + exe = os.path.join(os.getcwd(), "a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + self.runCmd("run", RUN_SUCCEEDED) + self.expect("thread list", "Thread should be stopped", + substrs = ['stopped']) + self.expect("frame diagnose", "Crash diagnosis was accurate", substrs=["a[10]"]) |