GDB timeout after cont or fg on commands section

Answered

I need to set a breakpoint from the gdbinit, with a command to auto load a library and then continue with the execution so I don't have to press F9 every time I debug my code, but as it is right now, when the breakpoint is hit, after running the command to continue with the execution, whether it is fg or cont, the program continues the execution, but clion thinks that gdb is still on the breakpoint, and after sometime it stops the application with timeout error from the debugger.

If I remove the fg(or cont) from the commands section, and go to the clion gdb terminal and execute it manually, then the IDE will recognize that gdb has left the breakpoint and everything works right after that.

Am I doing something wrong here? Why doesn't clion recognizes that gdb has left the breakpoint, when I run any of the continue commands from the commands section?

You can reproduce this by putting the code bellow on you gebinit. There's no need to execute the sharedlibrary command. the only thing that matters here is the ability to breakpoint and then continue inside the commands block.

I set gdbinit with the following commands:

 

set breakpoint pending on

break <file_name:line_number>

commands

    sharedlibrary <some_lib>

    fg

end

set auto-solib-add off

3

Please sign in to leave a comment.