Closed nd closed 20 hours ago
@llvm/issue-subscribers-debuginfo
Author: None (nd)
cc @jmorse
This looks to be a result of LLVM's fairly primitive handling of is_stmt; right now, we essentially decide to emit is_stmt only if emitting a non-0 line number that differs from the previous non-0 line number. The fix for this would presumably be to also emit is_stmt for the first non-line-0 instruction in a basic block; the actual solution might want to be a little more sophisticated, but it's probably a low-risk change because not many tools rely on is_stmt flags produced by LLVM.
The fix for this would presumably be to also emit is_stmt for the first non-line-0 instruction in a basic block
SGTM
The fix for this would presumably be to also emit is_stmt for the first non-line-0 instruction in a basic block
SGTM
+1
@SLTozer It looks like the fix for this issue was reverted. Should the issue be reopened, or should I file a new one?
I think this issue could be reopened; for full context, the fix was reverted for causing a large growth in .debug_line size; there's an alternative version that doesn't cause the same regression open at https://github.com/llvm/llvm-project/pull/108251, meaning this will be completed again once that passes review and is merged.
Sorry for the long wait, but this is fixed again in https://github.com/llvm/llvm-project/commit/fe18ab983d08b9e1726314009d677517d9cd5935.
Originally from https://sourceware.org/bugzilla/show_bug.cgi?id=31896.
Sometimes if conditions don't get is_stmt flag and gdb skips them during stepping.
To reproduce, compile test.cpp:
> clang++-18 -g -O0 test.cpp
Try stepping in gdb:
Notice that gdb didn't stop at the last branch condition on line 13.
For the branch on the line 11 both closing
}
of the previous block on line 10 and theelse if
get is_stmt flag.The branch on the line 13 has only one instruction marked with the is_stmt flag. Gdb treats it as the last instruction of the previous block and doesn't stop there.