====== Debugging with Eclipse and gdb ====== {{ :eclipse:screenshot-debug_-_hello_world-hello_world.c_-_eclipse_-1.png?600 |}} ===== Connecting to the target ===== First a connection to the TQ-Module has to be established with the Remote System Explorer. A step-by-step instruction is on this wiki page: [[en:eclipse:rse|Connecting to the TQ-Module with the Remote System Explorer]]. ===== Configuration Eclipse gdb ===== **Conditions**: * running demo application * debugging works on the command line - Open the configuration window in the menu ''Run > Debug Configurations...''. {{ :eclipse:screenshot-debug_configurations_.png? |}} - Create a new ''C/C++ Remote Application'' configuration there. - First select at the bottom ''Select other'' as launcher. In the appearing window check ''Use configuration specific settings'' and then select the ''Standard Remote Create Process Launcher''. - Then select the previously created connection as connection in the tab ''Main''. - The ''Remote Absolute File Path for C/C++ Application'' has to be set (preferably via the button ''Browse...''. - The project- and application settings should be set correctly. - Additional parameters can be passed to the program to be debugged in the tab ''arguments''. - The GDB debugger has to be set to the right GDB, in our case ''arm-linux-gdb'', in the tab ''main'' of the ''Debugger Options'' in the tab ''Debugger''. {{ :eclipse:screenshot-debug_configurations_-1.png?nolink& |}} - The path to the ''Shared Libraries'' on the host system has to be added in the ''Debugger Options'' for the module. In this case ''/opt/eldk/arm/lib''{{ :eclipse:screenshot-debug_configurations_-2.png?nolink& |}} - Nothing has to be set in the tab ''Gdbserver Settings''. {{ :eclipse:screenshot-debug_configurations_-3.png?nolink& |}} - Save the settings with ''Apply'' and start debugging with ''Debug''. ===== Troubleshooting ===== ==== No source available ==== When you start the debug process, the source code is not displayed. Instead, an error message appears. "No source available for main() " {{ :eclipse:screenshot-debug_-_source_not_found.png?nolink& |}} **Reason**: Debug symbols are not compiled in. **Correction**: Activate the debug symbols in the variable ''CPPFLAGS'' with the switch ''-g'' in the make file: ''CPPFLAGS := -Wall -g'' ===== Source ===== * http://www.embedded-linux.co.uk/tutorial/eclipse-rse