|
Till Strauman has done all of the work for RTEMS to be able to use the GDB debugger. However, unlike the old RMX system where the debugger was built into the image, the image had all of the symbols and the MD386 debugger was a standard command, for RTEMS you need to do a few steps to enable the use of the GDB debugger. All of the information that follows is in the RTEMS documentation written by Till so this just distills that into a few easy steps. |
Cheetsheet:
Here are examples that I use for the upgrade project using a powerpc. |
STEP 1: PATH=$PATH:/afs/slac/package/rtems/vol12/4_9_3/host/i386_linux2x/bin <--- contains powerpc-rtems-gdb Now point to the EPICS bin directory that YOU are loading in your st.cmd file. |
STEP 2: ld("rtems-gdb-stub.obj") <---- The part of GDB that runs on the IOC |
STEP 3: alias gdbmake="make 'OP_SYS_LDFLAGS='" When you want to use GDB on an IOC image, build it with "gdbmake" which prevents the symbols from being stripped from the image. This of course has no run-time effect but just makes the image larger. |
STEP 4: alias rdb='powerpc-rtems-gdb' <---- Starts the RTEMS-specific version of GDB on Linux. So when I'm debugging all I type is "rdb" and I'm connected to the target IOC. |
That's it! Of course there are a few caveats which are also called out in Till's documents so you should peruse them. The one most likely to fool you is that after you set breakpoints, they don't become effective until you "CONTINUE". You may also want to turn off optimization in the Makefile that compiles the modules you're debugging by setting USR_CFLAGS += O0 (that's Oh zero). Beats the heck out of printf statements! Most of the time. SETTING A BREAK POINT from rdb: break <filename>:<line#> |