Debugging LinuxRT with Eclipse

In Eclipse "CVS Repository Exploring" Check out as.., C++, uncheck default location and select directory, makefile project Empty Project, all toolchanins but Autotools (AVOID Autotools)

Set up debug configuration

  • Run menu -> Debug Configurations
  • Select C/C++ Remote Application and click on the  icon to add a new debug configuration
  • Give it an intuitive name, based on the app name
  • Browse for the Project your app is in
  • Go to the Debugger tab. For "GDB debugger" use the gdb associated with the gcc that builds your executable, e.g. /afs/slac/g/lcls/package/linuxRT/buildroot-2014.11/host/linux-x86_64/x86_64-uclibc-linux/usr/bin/x86_64-linux-gdb. You can find the right directory if you look for gcc in the build output.
  • You probably want to uncheck "Stop on startup at", as this can cause segfaults. If you have a breakpoint set, it will stop there.
  • Under the "Connection" tab, put the network host name the IOC is running on, e.g. "ioc-b34-bd32". The port number must agree with the gdbserver command in the IOC startup script, by default 10000
  • Click Apply, then Close.

Build project (command line or in Eclipse. If command line, select project top in Eclipse and hit F5 to update)

Back on the command line:

ssh laci@ioc-b34-bd32 (Or whatever the host name)

source /afs/slac/g/lcls/epics/setup/go_epics_3-14-12-4_1-0.bash

cd $IOC/ioc-b34-bd32 (Or whatever the host name)

./startupConsole-EV07gdbserver.cmd

Key line: /usr/bin/gdbserver :10000 ./bin/evrLab iocStartup.cmd

rather than the normal  ./bin/evrLab iocStartup.cmd

The IOC should stop with a message similar to

"Process bin/beamLoss created; pid = 3969
Listening on port 10000"

Back to Eclipse, select the dropdown next to the bug icon. Select the debug configuration you had previously set up. Eclipse should offer to switch to the Debug View, which is what you want.

Back on the command line where you started the IOC, you'll see a message similar to "Remote debugging from host 134.79.216.240"

  • No labels