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.