Issue 144061
Summary [lldb] Step over can step too far
Labels lldb
Assignees
Reporter labath
    ```
$ cat a.cc
void f1() {}
void f2() {}
void __attribute__((always_inline)) f3() { f2(); }

int main() {
  f1();
  f3();
  return 0;
}
$ clang -g a.cc
$ ~/ll/build/opt/bin/lldb ./a.out 
(lldb) target create "./a.out"
Current executable set to '/tmp/R/a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 19 at a.cc:6:3, address = 0x00000000000011a3
(lldb) r
Process 8667 launched: '/tmp/R/a.out' (x86_64)
Process 8667 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x00005555555551a3 a.out`main at a.cc:6:3
   3 	void __attribute__((always_inline)) f3() { f2(); }
   4   	
   5 	int main() {
-> 6   	  f1();
   7   	  f3();
   8   	  return 0;
 9   	}
(lldb) disassemble 
a.out`main:
    0x555555555190 <+0>:  endbr64 
    0x555555555194 <+4>:  pushq  %rbp
    0x555555555195 <+5>:  movq %rsp, %rbp
    0x555555555198 <+8>:  subq   $0x10, %rsp
    0x55555555519c <+12>: movl   $0x0, -0x4(%rbp)
->  0x5555555551a3 <+19>: callq 0x555555555160 ; f1 at a.cc:1
    0x5555555551a8 <+24>: callq 0x555555555170 ; f2 at a.cc:2
    0x5555555551ad <+29>: xorl   %eax, %eax
 0x5555555551af <+31>: addq   $0x10, %rsp
    0x5555555551b3 <+35>: popq %rbp
    0x5555555551b4 <+36>: retq   
(lldb) next
Process 8667 stopped
* thread #1, name = 'a.out', stop reason = step over
    frame #0: 0x00005555555551ad a.out`main at a.cc:8:3
   5   	int main() {
   6   	 f1();
   7   	  f3();
-> 8   	  return 0;
   9   	}
```

The step operation should stop at 0x5555555551a8, and not 0x5555555551ad. I expect this happens because, after stepping out of `f1`, the code finds itself thinking it's in `f3` and decides it should step out of that.

This is a relatively recent regression as lldb-19 (at least) doesn't exhibit this behavior (it correctly stops at 0x5555555551a8).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to