da-viper wrote:

> okay, so would something like this be sufficient to reproduce the issue (you 
> can put the functions in different files as needed):

This should be reproducable but I am not sure if it is the same problem, 
because it now skips `fn2` line completely regardless if it is complied with 
`-O1` or not.  as it never steps over to that address. full context

```sh
(lldb) target create "build/debug/main_c"
Current executable set to 
'/home/da-viper/Dev/projects/test_lldb/build/debug/main_c' (x86_64).
(lldb) b main
Breakpoint 1: where = main_c`main + 15 at main.c:5:3, address = 
0x000000000040045f
(lldb) r
Process 757816 launched: 
'/home/da-viper/Dev/projects/test_lldb/build/debug/main_c' (x86_64)
Process 757816 stopped
* thread #1, name = 'main_c', stop reason = breakpoint 1.1
    frame #0: 0x000000000040045f main_c`main at main.c:5:3
   2    #include "fn2.h"
   3   
   4    int main() {
-> 5      fn1();
   6      fn2();
   7      return 0;
   8    }
(lldb) dis
main_c`main:
    0x400450 <+0>:  push   rbp
    0x400451 <+1>:  mov    rbp, rsp
    0x400454 <+4>:  sub    rsp, 0x10
    0x400458 <+8>:  mov    dword ptr [rbp - 0x4], 0x0
->  0x40045f <+15>: mov    al, 0x0
    0x400461 <+17>: call   0x400480       ; fn1 at fn1.c:3
    0x400466 <+22>: mov    al, 0x0
    0x400468 <+24>: call   0x400480       ; fn1 at fn1.c:3
    0x40046d <+29>: xor    eax, eax
    0x40046f <+31>: add    rsp, 0x10
    0x400473 <+35>: pop    rbp
    0x400474 <+36>: ret    
(lldb) n
Process 757816 stopped
* thread #1, name = 'main_c', stop reason = step over
    frame #0: 0x000000000040046d main_c`main at main.c:7:3
   4    int main() {
   5      fn1();
   6      fn2();
-> 7      return 0;
   8    }
(lldb) dis   
main_c`main:
    0x400450 <+0>:  push   rbp
    0x400451 <+1>:  mov    rbp, rsp
    0x400454 <+4>:  sub    rsp, 0x10
    0x400458 <+8>:  mov    dword ptr [rbp - 0x4], 0x0
    0x40045f <+15>: mov    al, 0x0
    0x400461 <+17>: call   0x400480       ; fn1 at fn1.c:3
    0x400466 <+22>: mov    al, 0x0
    0x400468 <+24>: call   0x400480       ; fn1 at fn1.c:3
->  0x40046d <+29>: xor    eax, eax
    0x40046f <+31>: add    rsp, 0x10
    0x400473 <+35>: pop    rbp
    0x400474 <+36>: ret    
(lldb) 
```
This happens in both lldb-dap and lldb
[reproducer.zip](https://github.com/user-attachments/files/20725969/reproducer.zip)


https://github.com/llvm/llvm-project/pull/143644
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to