Debugging with GDB

From dmon2
Jump to navigationJump to search

Debugging Source code with Eclipse, GDB and DMON

  • Download latest Eclipse IDE for C/C++ Developers from https://www.eclipse.org
  • Unzip
  • Unzip Compilers needed to c:\opt (i.e. C:\opt\sparc-elf-4.4.2-mingw)
  • Add “C:\opt\sparc-elf-4.4.2-mingw\bin” and “C:\opt\sparc-elf-4.4.2-mingw\sparc-elf\bin” to System Path
  • Download and install CYGWIN from https://www.cygwin.com/
  • Add C:\cygwin\bin to the System Path at the beginning
  • Install DMON, follow readme in DMON folder
  • Start Eclipse
  • Select File -> New -> C Project in Eclipse
Create C Project


  • Select “Empty Project” or “ Hello world ANSI C Project” and Toolchains : “Cross GCC”
  • Select 'Next' to last Dialog to set cross compilers prefix and Path to bin folder and press 'Finish' to create new C project
Modify Cross Compiler


  • Build the Project
  • Select 'Debug Configurations' and create new 'GDB Hardware Debugging'. Set Project and application
Create New GDB Hardware Debugging


  • Configure 'Debugger' section
Set Up GDB


  • Configure 'Startup' section if you need
Set Up Startup


  • Press 'Debug' to start debugging. The Program should stop at 'main'.
Debugging


Debugging source code using Eclipse, GDB and DMON tutorial: