I am Looking for a way to simultaneously debug the slicer itself along with its Slicer RT extension together. I know how to run the slicerRt or Slicer in debug mode separately. But then I would actually like to check the call stacks and everything from SlicerRT to Slicer.
Appreciation in Advance.
I guess you mean using an IDE debugger to look at the C++ code? Yes, that should work normally if you build both the Slicer core and the SlicerRT extension in debug mode and either start up the app from the IDE or connect to the running process.
Thanks for your reply, I did build both of them in debug mode and i ran
.\S5D\Slicer-build\Slicer.exe --VisualStudio --launcher-no-splash --launcher-additional-settings E:/RTD/inner-build/AdditionalLauncherSettings.ini E:\RTD\inner-build\SlicerRT.sln
which eventually started SlicerRT sln, and I set up the ALL_BUILD project according to Debugging using Visual Studio
from slicer doc. What is happening is I can set breakpoints in the slicer part of code, for example
vtkMRMLSegmentationNode.cxx. but if I try to set a breakpoint in SlicerRT code, for example,
vtkSlicerDicomRtImportExportModuleLogic.cxx, MSVC says breakpoint won’t be hit because no symbol is loaded, so I went ahead and loaded a Dicom RT structure file, in the Dicom data browser, and found RT Structure examine failed, apparently, the initiated slicer.exe don’t think a slicerRT extension is loaded, which by the way doesn’t happen when I run the
SlicerWithSlicerRT.exe file found in SlicerRt’s inner-build. So I think SlicerRT and Slicer were built fine. I just can’t seem to understand why the slicerRT specific modules and debug symbols aren’t loaded.
@pieper However, I got curious about the AdditionalLauncherSettings.ini file, and there are few paths listed, Strangely some of these paths don’t really exist on my device. the ini file is pasted down below. the c style
/**/ commented paths don’t exist.
[General] additionalPathVariables=PYTHONPATH [LibraryPaths] 1\path=E:/RTD/inner-build/lib/Slicer-5.3/cli-modules/Debug 2\path=E:/RTD/inner-build/lib/Slicer-5.3/qt-loadable-modules/Debug /* 3\path=E:/RTD/lib/Slicer-5.3/Debug */ size=3 [Paths] 1\path=E:/RTD/inner-build/lib/Slicer-5.3/cli-modules/Debug 2\path=E:/RTD/inner-build/bin/Debug /* 3\path=E:/RTD/bin/Debug */ size=3 [EnvironmentVariables] [PYTHONPATH] 1\path=E:/RTD/inner-build/lib/Slicer-5.3/qt-scripted-modules 2\path=E:/RTD/inner-build/lib/Slicer-5.3/qt-loadable-modules/Debug /* 3\path=E:/RTD/inner-build/lib/Slicer-5.3/qt-loadable-modules/Python */ /* 4\path=E:/RTD/lib/Slicer-5.3/Debug */ size=4
It sounds like you are close. I haven’t debugged extensions with visual studio for quite a while myself, but I agree the paths look wrong in that ini file. Perhaps there’s been some format change in the visual studio build files and the launcher settings code needs to be updated.
What I would suggest though is to start Slicer with the
SlicerWithSlicerRT.exe command and then just connect the debugger to the process once it starts so it should pick up all the paths from the running process. You can then load data and do your debugging.
Your approach sounds good. This command starts VS for me with the ability to debug Slicer and SlicerRT:
..\S5D\Slicer-build\Slicer.exe --VisualStudio --launcher-no-splash --launcher-additional-settings ./SlicerRT_D/inner-build/AdditionalLauncherSettings.ini c:\d\_Extensions\SlicerRT_D\inner-build\SlicerRT.sln
Then when the solution opens, make sure that you select a project other than
ALL_BUILD as startup, it can be any of them (qSlicer… or vtkMRML…). Then, in the project settings you need to set the command to be the
SlicerApp-real.exe, such as
c:\d\S5D\Slicer-build\bin\Debug\SlicerApp-real.exe. Then when you start the debugger, the breakpoints in Slicer and SlicerRT (and CTK etc) should be hit.
Of course what @pieper suggests with
SlicerWithSlicerRT.exe should work too, but what I have wrote above is how I have been doing it forever and it still works.