OS: Linux CentOS 8
Slicer git tag: 80f7a47e343266b5ca7cca59a09816fbbdd6101a
Hi there, I’m working on a loadable extension with a custom Slicer build made using SlicerCAT. I’m able to debug my extension by using “./SlicerWithMyExtension --attach-process” in the terminal and then attaching gdb to the process in vscode. From here, I’m able to set and hit breakpoints as expected within the loadable module.
I would also like to be able to set breakpoints in the built in loadable module source files (the ones located here: path/to/slicersources-src/modules/loadable). However, when I set breakpoints in these files I get the message “Module containing this breakpoint has not yet loaded or the breakpoint address could not be obtained”. I’m wondering if I’ve missed something simple or if I’ve set something up incorrectly. I think I’ve followed the debugging wiki instructions correctly. Should it be possible to hit breakpoints in these files in this way from a loadable extension?
Shared libraries of modules are loaded during startup, so the message that you see is expected. You should still be able to set breakpoints in the modules.
Visual Studio on Windows indicates this during startup with a warning icon next to the breakpoint, but this goes away when shared library of the module is loaded. Maybe your debugger cannot do this automatic update and you can only set the breakpoint after shared library of your module is loaded.
When I attach the debugger, all breakpoints become deactivated and I get an “attempting to bind breakpoint” message on each of them, which (I think) is akin to that warning in Visual Studio on Windows. After some time though, the breakpoints in the custom module become activated but the breakpoints in other modules change to “module containing this breakpoint has not yet loaded or the breakpoint address could not be obtained” so you must be right that the debugger isn’t updated when these libraries are loaded.
I tried loading the reformat module in my project, attaching the debugger, waiting for the working breakpoints to bind, and then, after the breakpoints bind, setting new breakpoints in the reformat module source files but I still found that these new breakpoints are unable bind to these files.
(Sorry if it turns out that this was more of a VSCode setup issue than a Slicer issue)