<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/136410>136410</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LLDB] An inconsistency between step-by-step debugging and breakpoint debugging at O2
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Apochens
</td>
</tr>
</table>
<pre>
Clang version:
```
Ubuntu clang version 21.0.0 (++20250415033808+d0e4af8a88dc-1~exp1~20250415153924.2354)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-21/bin
```
LLDB version: `lldb version 21.0.0`
Inconsistency-triggering program `test.c`:
```c
int printf(const char *, ...);
int a[2][9] = {
{0, 1, 2, 3, 4, 5, 6, 7, 8},
{0, 1, 2, 3, 4, 5, 6, 7, 8}
};
int main(int argc, char* argv[]) {
int b, c, d = 0;
if (argc == 0)
d = 1;
for (b = 0; b < 2; b++) {
for (c = 0; c < 9; c++) {
printf("%d\n", a[b][c]); // set breakpoint at this line
if (d)
printf("index\n");
}
}
}
```
Compilation command: `clang -g -O2 test.c -o test`
When debugging the program step-by-step (i.e., `s`), the debugger could stop at the specified line, while the debugger cannot stop at the line when directly setting the breakpoint (i.e., `b 12`).
@jimingham Apologies for bothering you again. Would the root cause of this inconsistency be identical to #136089 ?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVU2PozgQ_TXOpRRkbCBw4EASRRpppLnsao4rYzvgWWMj2_THZX77qiCdpHv3tFJUGFyvXK_quSJiNIPTuiXlkZTnnVjS6EPbzV6O2sVd79V7e7LCDfCiQzTeEd4Ruv4qevvR7s9-cWkB-ewILM9oRoGwmrAjYUdGWUmLvKSc1xS_KaoLca1FXSu5z3_rtzn__eGUl7xhRcZ4WRDWENr9IcKgE-EdvNXVX1Wxn-XeGre87Qe34P4YtFAweaUtes0-mjdCu28uJm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