[Lldb-commits] [PATCH] D39283: [lldb-dev] Update LLDB test cases for 'inlineStepping'
Carlos Alberto Enciso via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 25 03:48:52 PDT 2017
CarlosAlbertoEnciso created this revision.
Herald added a subscriber: eraman.
A patch to correct the compiler issue, where instructions associated to
the function prolog are assigned line information, causing the debugger
to show incorrectly the beginning of the function body, caused some tests
in the LLDB suite to fail.
For a full description, please see:
https://reviews.llvm.org/rL313047
https://reviews.llvm.org/D37625
This patch include the required changes to the failing tests.
For example, using 'caller_trivial_1' from the test case:
void
caller_trivial_1 ()
{
caller_trivial_2(); // In caller_trivial_1.
inline_value += 1;
}
The "sub $0x8,%esp" instruction, which is frame setup code is printed as
being part of the statement 'inline_value += 1
void
caller_trivial_1 ()
{
c0: 55 push %ebp
c1: 89 e5 mov %esp,%ebp
inline_value += 1; // At first increment in caller_trivial_1.
c3: 83 ec 08 sub $0x8,%esp
c6: a1 00 00 00 00 mov 0x0,%eax
cb: 83 c0 01 add $0x1,%eax
ce: a3 00 00 00 00 mov %eax,0x0
caller_trivial_2(); // In caller_trivial_1.
d3: e8 18 00 00 00 call f0 <_Z16caller_trivial_2v>
inline_value += 1;
d8: a1 00 00 00 00 mov 0x0,%eax
dd: 83 c0 01 add $0x1,%eax
e0: a3 00 00 00 00 mov %eax,0x0
}
e5: 83 c4 08 add $0x8,%esp
e8: 5d pop %ebp
e9: c3 ret
ea: 66 0f 1f 44 00 00 nopw 0x0(%eax,%eax,1)
But the instructions associated with the statement
inline_value += 1;
which start at 0xc6, are showing as starting at 0xc3, which is frame
setup code.
With the compiler patch, the prologue record is associated to the first
instruction that is not part of the frame setup code.
void
caller_trivial_1 ()
{
c0: 55 push %ebp
c1: 89 e5 mov %esp,%ebp
c3: 83 ec 08 sub $0x8,%esp
inline_value += 1; // At first increment in caller_trivial_1.
c6: a1 00 00 00 00 mov 0x0,%eax
cb: 83 c0 01 add $0x1,%eax
ce: a3 00 00 00 00 mov %eax,0x0
caller_trivial_2(); // In caller_trivial_1.
d3: e8 18 00 00 00 call f0 <_Z16caller_trivial_2v>
inline_value += 1;
d8: a1 00 00 00 00 mov 0x0,%eax
dd: 83 c0 01 add $0x1,%eax
e0: a3 00 00 00 00 mov %eax,0x0
}
e5: 83 c4 08 add $0x8,%esp
e8: 5d pop %ebp
e9: c3 ret
ea: 66 0f 1f 44 00 00 nopw 0x0(%eax,%eax,1)
Now the instructions associated with 'inline_value += 1;' are correctly
identified and are the same in 0xc6 and 0xd8.
https://reviews.llvm.org/D39283
Files:
packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
packages/Python/lldbsuite/test/functionalities/inline-stepping/calling.cpp
Index: packages/Python/lldbsuite/test/functionalities/inline-stepping/calling.cpp
===================================================================
--- packages/Python/lldbsuite/test/functionalities/inline-stepping/calling.cpp
+++ packages/Python/lldbsuite/test/functionalities/inline-stepping/calling.cpp
@@ -68,6 +68,7 @@
void
caller_trivial_1 ()
{
+ inline_value += 1; // At first increment in caller_trivial_1.
caller_trivial_2(); // In caller_trivial_1.
inline_value += 1;
}
@@ -75,8 +76,9 @@
void
caller_trivial_2 ()
{
+ inline_value += 1; // At first increment in caller_trivial_2.
inline_trivial_1 (); // In caller_trivial_2.
- inline_value += 1; // At increment in caller_trivial_2.
+ inline_value += 1; // At second increment in caller_trivial_2.
}
void
@@ -88,8 +90,9 @@
void
inline_trivial_1 ()
{
+ inline_value += 1; // At first increment in inline_trivial_1.
inline_trivial_2(); // In inline_trivial_1.
- inline_value += 1; // At increment in inline_trivial_1.
+ inline_value += 1; // At second increment in inline_trivial_1.
}
void
Index: packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
===================================================================
--- packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
+++ packages/Python/lldbsuite/test/functionalities/inline-stepping/TestInlineStepping.py
@@ -183,9 +183,12 @@
# Now step from caller_ref_1 all the way into called_by_inline_trivial
- step_sequence = [["// In caller_trivial_1.", "into"],
- ["// In caller_trivial_2.", "into"],
- ["// In inline_trivial_1.", "into"],
+ step_sequence = [["// At first increment in caller_trivial_1.", "into"],
+ ["// In caller_trivial_1.", "over"],
+ ["// At first increment in caller_trivial_2.", "into"],
+ ["// In caller_trivial_2.", "over"],
+ ["// At first increment in inline_trivial_1.", "into"],
+ ["// In inline_trivial_1.", "over"],
["// In inline_trivial_2.", "into"],
["// At caller_by_inline_trivial in inline_trivial_2.", "over"],
["// In called_by_inline_trivial.", "into"]]
@@ -205,9 +208,12 @@
"Successfully ran to call site of second caller_trivial_1 call.")
self.thread = threads[0]
- step_sequence = [["// In caller_trivial_1.", "into"],
- ["// In caller_trivial_2.", "into"],
- ["// In inline_trivial_1.", "into"]]
+ step_sequence = [["// At first increment in caller_trivial_1.", "into"],
+ ["// In caller_trivial_1.", "over"],
+ ["// At first increment in caller_trivial_2.", "into"],
+ ["// In caller_trivial_2.", "over"],
+ ["// At first increment in inline_trivial_1.", "into"],
+ ["// In inline_trivial_1.", "over"]]
self.run_step_sequence(step_sequence)
# Then call some trivial function, and make sure we end up back where
@@ -225,8 +231,8 @@
# Now make sure stepping OVER in the middle of the stack works, and
# then check finish from the inlined frame:
- step_sequence = [["// At increment in inline_trivial_1.", "over"],
- ["// At increment in caller_trivial_2.", "out"]]
+ step_sequence = [["// At second increment in inline_trivial_1.", "over"],
+ ["// At second increment in caller_trivial_2.", "out"]]
self.run_step_sequence(step_sequence)
# Now run to the place in main just before the first call to
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39283.120204.patch
Type: text/x-patch
Size: 3883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171025/e108fd0c/attachment.bin>
More information about the lldb-commits
mailing list