Reading user input doesn't work in debug

I have this simple proc in Odin

 

repl :: proc() {
    buffer: [1024]u8
    reader: bufio.Reader
    bufio.reader_init_with_buf(&reader, io.to_reader(os.stream_from_handle(os.stdin)), buffer[:])
    for {
        fmt.print(">  ")

        buffer, err := bufio.reader_read_string(&reader, '\n')
        delete(buffer)
        if err != nil {
            fmt.println(err)
            break
        }
        
        if len(strings.trim_space(buffer[:])) == 0 do break
        
        interpret(buffer[:])
        free_all(context.temp_allocator)
    }
}

 

And this works perfectly fine on release, but when debugging, I get stuck at buffer, err := bufio.reader_read_string(&reader, '\n'), I write stuff, then press enter, nothing happens, but in release this works fine. Does anyone know what could be happening?

This works fine when running from vs code, but I would like to use Rider if possible as the experience is better.

0
5 comments

I tried also with RustRover, same issue, it seems to happen with every IntelliJ product

0

Hello Rioni,

Apologies for taking that long to respond. Do you by chance use the IdeaVim plugin? (If so, try disabling it to see if that helps)

Unfortunately, I couldn't reproduce the issue. If the issue is still relevant, I would appreciate it if you could share a recording that demonstrates the issue. Please upload it to the Upload Service and let me know the Upload ID.

Have a nice day!

0

Hello Dmitry, 

Thank you for taking a look to this! I checked and I don't have IdeaVim plugin installed. I've recorded a video:

Upload id: 2025_05_31_283vN9erDnrN2QfPGW2AAu (file: riderBug.mp4)

Here I use os.read instead of bufio, but it doesn't matter, this bug happens with any possible way of reading input from console

Let me know if you need more data! The repo that contains this code in case you want to run it yourself: https://github.com/Nrosa01/OdinLox

0

Hello,

Thank you for the clarification and for the project shared! Now I got it and I reproduced the same issue on Windows in Rider, RustRover, CLion, Idea. Meantime, the issue doesn't persist on MacOS (at least with latest Rider 2025.1.2).

The issue doesn't seem to be Rider-specific. I found the issue is not reproducible with Odin plugin of version 0.7.5. This plugin version can be installed to an earlier versions of IDE, for Rider, it is the 2024.2.9 version. So, as a temporary solution, you can try downgrading Rider and installing the Odin plugin from there.

As far as I understand, the debugger stuck on on `os.read(os.stdin, buffer[:])` upon receiving an input from a user. Note, the plugin uses a third-party debugger (not related to Rider distribution).

Since this issue only persists with Odin plugin while debugging .odin files in any JB IDE, the issue is decided to be reported to plugin vendor: [BUG] Debugging on Windows stuck on os.read(os.stdin, buffer[:]). Please follow it for further updates. Should you encounter any other issues with plugin, consider reporting it directly to plugin issue tracker (github).

The available options I can suggest:

  • Downgrade to Rider 2024.2.9;
  • Try other OS;

If there is anything else I can assist you with, please tell me.

Have a nice day!

1

I wasn't aware of it. I know this plugin uses third-party debuggers, I tried both Windbg and LLDB-DAP and both had the same issue so I thought it was a Rider thing and not the plugin.

I'll downgrade for now while I develop in Odin and I'll look at the plugin repo to see what happened from that previous version to the current one.

Thank you for your help and your time!

0

Please sign in to leave a comment.