Difference between revisions of "Documentation/4.0/Developers/Tutorials/Debug Instructions"

From Slicer Wiki
Jump to: navigation, search
(Created page with '==Background== The executable Slicer application is: Slicer-build/Slicer (or Slicer.exe) This is actually a wrapper created using the [[http://www.commontk.org/index.php/Tools:_…')
 
Line 2: Line 2:
 
The executable Slicer application is: Slicer-build/Slicer (or Slicer.exe)
 
The executable Slicer application is: Slicer-build/Slicer (or Slicer.exe)
  
This is actually a wrapper created using the [[http://www.commontk.org/index.php/Tools:_Application_launcher|CTK AppLauncher]]. The wrapper exists to set library and environment paths before launching the real application binary in Slicer-build/bin/SlicerQT-real
+
This is actually a wrapper created using the [http://www.commontk.org/index.php/Tools:_Application_launcher CTK AppLauncher]. The wrapper exists to set library and environment paths before launching the real application binary in Slicer-build/bin/SlicerQT-real
 
*The wrapper is configured in Slicer4/Applications/QTGUI/CMakeLists.txt under the heading "Configure Slicer Launcher"
 
*The wrapper is configured in Slicer4/Applications/QTGUI/CMakeLists.txt under the heading "Configure Slicer Launcher"
 
*The AppLauncher source code is here: https://github.com/commontk/AppLauncher
 
*The AppLauncher source code is here: https://github.com/commontk/AppLauncher
*The launcher configuration is put here: SlicerLauncherSettings.ini
+
*The launcher configuration is put here: Slicer-build/SlicerLauncherSettings.ini
  
 
==Linux==
 
==Linux==

Revision as of 02:45, 9 October 2011

Home < Documentation < 4.0 < Developers < Tutorials < Debug Instructions

Background

The executable Slicer application is: Slicer-build/Slicer (or Slicer.exe)

This is actually a wrapper created using the CTK AppLauncher. The wrapper exists to set library and environment paths before launching the real application binary in Slicer-build/bin/SlicerQT-real

  • The wrapper is configured in Slicer4/Applications/QTGUI/CMakeLists.txt under the heading "Configure Slicer Launcher"
  • The AppLauncher source code is here: https://github.com/commontk/AppLauncher
  • The launcher configuration is put here: Slicer-build/SlicerLauncherSettings.ini

Linux

GDB debug by attach to running process

Run ./Slicer-build/Slicer

Now, run "ps -Afww | grep SlicerQT-real" and note the PID of this binary.

Now, run "gdb --pid $PIDABOVE"

GDB debug by using exec-wrapper

An alternative approach is to use a wrapper script to emulate the functionality of the app launcher. This will allow you to use gdb or a gdb-controlling program such as an IDE, in order to interactively debug with one command.

The general idea of the wrapper is to set all of the appropriate environment variables as they would be set by the app launcher. From SlicerLauncherSettings:

  • [LibraryPath] contents should be in LD_LIBRARY_PATH
  • [Paths] contents should be in PATH
  • [EnvironmentVariables] should each be set

See this example script

See also: Linux debugging with CodeLite