CarlosAlbertoEnciso added a comment. Hi Tamas,
What I have done is to use the original code (original.cpp), modified code (calling.cpp), created ELFs for both test cases before and after the compiler change and debug them using LLDB, in order to show the issue while debugging at instruction level. I have used the -m32 option while compiling, in 'main' step into the second call to 'caller_trivial_1' and then disassembly the function, to show the location of the PC. 1. Original test case before the compiler change: (lldb) s Process 9816 stopped * thread #1, name = 'original_before', stop reason = step in frame #0: 0x08048843 original_before.out`caller_trivial_1() at original.cpp:71 68 void 69 caller_trivial_1 () 70 { -> 71 caller_trivial_2(); // In caller_trivial_1. 72 inline_value += 1; 73 } 74 (lldb) di -f original_before.out`caller_trivial_1: 0x8048840 <+0>: pushl %ebp 0x8048841 <+1>: movl %esp, %ebp -> 0x8048843 <+3>: subl $0x8, %esp 0x8048846 <+6>: calll 0x8048860 ; caller_trivial_2 at original.cpp:77 0x804884b <+11>: movl 0x804a03c, %eax 0x8048850 <+16>: addl $0x1, %eax 0x8048853 <+19>: movl %eax, 0x804a03c 0x8048858 <+24>: addl $0x8, %esp 0x804885b <+27>: popl %ebp 0x804885c <+28>: retl (lldb) The disassembly shows the PC (0x8048843) pointing to the instructions that are part of the frame setup code. 2. Original test case after the compiler change: (lldb) s Process 9876 stopped * thread #1, name = 'original_after.', stop reason = step in frame #0: 0x08048846 original_after.out`caller_trivial_1() at original.cpp:71 68 void 69 caller_trivial_1 () 70 { -> 71 caller_trivial_2(); // In caller_trivial_1. 72 inline_value += 1; 73 } 74 (lldb) di -f original_after.out`caller_trivial_1: 0x8048840 <+0>: pushl %ebp 0x8048841 <+1>: movl %esp, %ebp 0x8048843 <+3>: subl $0x8, %esp -> 0x8048846 <+6>: calll 0x8048860 ; caller_trivial_2 at original.cpp:77 0x804884b <+11>: movl 0x804a03c, %eax 0x8048850 <+16>: addl $0x1, %eax 0x8048853 <+19>: movl %eax, 0x804a03c 0x8048858 <+24>: addl $0x8, %esp 0x804885b <+27>: popl %ebp 0x804885c <+28>: retl (lldb) The disassembly shows the PC (0x8048846) pointing to the instructions that corresponds to the 'caller_trivial_2()' statement, which should be the correct location and matches the source level and instruction level debugging. 3. Modified test case before the compiler change: (lldb) s Process 10390 stopped * thread #1, name = 'calling_before.', stop reason = step in frame #0: 0x08048843 calling_before.out`caller_trivial_1() at calling.cpp:71 68 void 69 caller_trivial_1 () 70 { -> 71 inline_value += 1; // At first increment in caller_trivial_1. 72 caller_trivial_2(); // In caller_trivial_1. 73 inline_value += 1; 74 } 75 (lldb) di -f calling_before.out`caller_trivial_1: 0x8048840 <+0>: pushl %ebp 0x8048841 <+1>: movl %esp, %ebp -> 0x8048843 <+3>: subl $0x8, %esp 0x8048846 <+6>: movl 0x804b03c, %eax 0x804884b <+11>: addl $0x1, %eax 0x804884e <+14>: movl %eax, 0x804b03c 0x8048853 <+19>: calll 0x8048870 ; caller_trivial_2 at calling.cpp:78 0x8048858 <+24>: movl 0x804b03c, %eax 0x804885d <+29>: addl $0x1, %eax 0x8048860 <+32>: movl %eax, 0x804b03c 0x8048865 <+37>: addl $0x8, %esp 0x8048868 <+40>: popl %ebp 0x8048869 <+41>: retl (lldb) The disassembly shows the PC (0x8048843) pointing to the instructions that are part of the frame setup code. 4. Modified test case after the compiler change: (lldb) s Process 10496 stopped * thread #1, name = 'calling_after.o', stop reason = step in frame #0: 0x08048846 calling_after.out`caller_trivial_1() at calling.cpp:71 68 void 69 caller_trivial_1 () 70 { -> 71 inline_value += 1; // At first increment in caller_trivial_1. 72 caller_trivial_2(); // In caller_trivial_1. 73 inline_value += 1; 74 } 75 (lldb) di -f calling_after.out`caller_trivial_1: 0x8048840 <+0>: pushl %ebp 0x8048841 <+1>: movl %esp, %ebp 0x8048843 <+3>: subl $0x8, %esp -> 0x8048846 <+6>: movl 0x804b03c, %eax 0x804884b <+11>: addl $0x1, %eax 0x804884e <+14>: movl %eax, 0x804b03c 0x8048853 <+19>: calll 0x8048870 ; caller_trivial_2 at calling.cpp:78 0x8048858 <+24>: movl 0x804b03c, %eax 0x804885d <+29>: addl $0x1, %eax 0x8048860 <+32>: movl %eax, 0x804b03c 0x8048865 <+37>: addl $0x8, %esp 0x8048868 <+40>: popl %ebp 0x8048869 <+41>: retl (lldb) The disassembly shows the PC (0x8048846) pointing to the instructions that corresponds to the 'inline_value += 1', statement, which should be the correct location and matches the source level and instruction level debugging. For both cases (2) and (4), the test case behavior is the same, as LLDB stops at the instructions that mark the beginning of the function, as indicated by the prologue_end line records. I hope this gives more clarification to the intended changes (compiler and LLDB test cases). https://reviews.llvm.org/D39283 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits