You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is quite a specific one so there's also a video attached that should help understanding it.
Screen.Recording.2025-01-30.115109.mp4
When hitting an if branch with a false conditional expression while stepping through a for loop the breakpoint is shown inside last line of the if-scope.
This makes it hard to understand wether the code is actually executed or not.
Especially in single-line scopes it gets difficult as you won't notice a visual difference.
As suggested by laytan this is most likely related to Odin's generated debug information.
Details
The problem occurs on Windows with MSVC - I have also tested it on a Mac with LLDB where it works as expected.
It seems to only happen inside a foor loop and only for a conditional expression - for a boolean literal it works fine.
Operating System & Odin Version:
Odin: dev-2025-01:2aae4cfd4
OS: Windows 11 Professional (version: 24H2), build 26100.2894
CPU: AMD Ryzen 9 5950X 16-Core Processor
RAM: 65448 MiB
Backend: LLVM 18.1.8
Steps to Reproduce
Add a breakpoint to line 5
Start a debug session with MSVC (cppvsdbg)
Step through the for loop and notice how the breakpoint enters the last line of the if-branch - even though the print is obviously not actually executed.
Change line 6 to a bool literal: if false { and notice how the problem does not occur any more
package main
import "core:fmt"
main :: proc() {
for i in 0..<32 {
if i > 64 { // <- conditional expression seems to trigger the issue. Compare to false bool literal.
fmt.printf("This won't be printed!")
fmt.printf("Neither will this.")
// ^ Somehow the breakpoint exists the loop here
}
}
}
The text was updated successfully, but these errors were encountered:
Context
This is quite a specific one so there's also a video attached that should help understanding it.
Screen.Recording.2025-01-30.115109.mp4
When hitting an if branch with a false conditional expression while stepping through a for loop the breakpoint is shown inside last line of the if-scope.
This makes it hard to understand wether the code is actually executed or not.
Especially in single-line scopes it gets difficult as you won't notice a visual difference.
As suggested by laytan this is most likely related to Odin's generated debug information.
Details
The problem occurs on Windows with MSVC - I have also tested it on a Mac with LLDB where it works as expected.
It seems to only happen inside a foor loop and only for a conditional expression - for a boolean literal it works fine.
Operating System & Odin Version:
Odin: dev-2025-01:2aae4cfd4
OS: Windows 11 Professional (version: 24H2), build 26100.2894
CPU: AMD Ryzen 9 5950X 16-Core Processor
RAM: 65448 MiB
Backend: LLVM 18.1.8
Steps to Reproduce
if false {
and notice how the problem does not occur any moreThe text was updated successfully, but these errors were encountered: