Issue 160219
Summary [LLDB] `si` (step instruction) stops multiple times at the same PC starting from LLDB 21
Labels new issue
Assignees
Reporter patryk4815
    Starting with LLDB 21, the `si` (step instruction) command may stop multiple times at the same program counter (PC).
This behavior was not present in earlier releases (e.g. LLDB 16-20), where only a single stop event would occur.

### Compile bug binary
```console
cat << EOF > bug.S
.section .text
.global _start
_start:
mov x1, 1
foo:
mov x1, 2
bar:
mov x1, 3
EOF

zig cc -target aarch64-freestanding bug.S -o bug.elf
```

### Repro
```console
$ lldb ./bug.elf
(lldb) target create "./bug.elf"
Current executable set to '/Users/psondej/projekty/pwndbg/bug.elf' (aarch64).
(lldb) version
lldb version 21.1.1
(lldb) b foo
Breakpoint 1: where = bug.elf`foo, address = 0x0000000001010124
(lldb) b bar
Breakpoint 2: where = bug.elf`bar, address = 0x0000000001010128
(lldb) process launch -s
Process 353436 stopped
* thread #1, name = 'bug.elf', stop reason = signal SIGSTOP
    frame #0: 0x0000000001010120 bug.elf`_start at bug.S:4
   1   	.section .text
   2 	.global _start
   3   	_start:
-> 4   	mov x1, 1
   5   	foo:
   6 	mov x1, 2
   7   	bar:
Process 353436 launched: '/Users/psondej/projekty/pwndbg/bug.elf' (aarch64)
(lldb) si
Process 353436 stopped
* thread #1, name = 'bug.elf', stop reason = instruction step into
 frame #0: 0x0000000001010124 bug.elf`foo at bug.S:6
   3   	_start:
 4   	mov x1, 1
   5   	foo:
-> 6   	mov x1, 2
   7   	bar:
   8 	mov x1, 3
(lldb) si
Process 353436 stopped
* thread #1, name = 'bug.elf', stop reason = breakpoint 1.1
    frame #0: 0x0000000001010124 bug.elf`foo at bug.S:6
   3   	_start:
   4   	mov x1, 1
   5 	foo:
-> 6   	mov x1, 2
   7   	bar:
   8   	mov x1, 3
>>>
```

### Actual behavior:
The debugger stops multiple times at the same instruction:
- once due to the step
- once again due to the breakpoint at the same address


### Expected

`si` should trigger a stop only once per instruction, not multiple times at the same PC.



_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to