How to use eclipse cdt as front end of arm gdb

Created:

Updated:

reference

Using elipse cdt(C/C++ development Tooling) as the front end of arm gdb

gdb has a lot of features, but it is a command line interface, so it takes time to become proficient. Using TUI mode is a little more convenient, but it is still inconvenient than GUI interface. Here I will explain how to use eclipse cdt as the front end of arm gdb.

Install eclipse cdt

  1. Downloads “eclipse C/C++ IDE” and decompress/install it.
    - https://www.eclipse.org/cdt/downloads.php
  2. Launch “eclipse C/C++ IDE”
  3. In menu, help -> Install New Software… -> click Add… and input like below.
    - ex) if you are installing cdt 10.7
    • Name: cdt10.7
    • Location: https://download.eclipse.org/tools/cdt/releases/10.7
  4. click Select All and click Next> -> … -> Finish


Debugging helloworld with cdt

After installing as above, run qemu and start debugging after setting eclipse debug configuration. Here, I will explain how to debug by running helloworld program with qemu and cdtdebug. Write helloworld.c file as below and compile it with gcc arm compiler.

  • helloworld.c
    1
    2
    3
    4
    5
    6
    
    #include <stdio.h>
    int main(void)
    {
      printf("HelloWorld!\n");
      return 0;
    }
    
  • Compile with gcc arm toolchaing
    1
    
    $ arm-none-linux-gnueabihf-gcc -o helloworld helloworld.c -g -static
    
  • Run qemu
    1
    
    $ qemu-arm -g 1234 helloworld
    
  • eclipse debug configuration
    1. In eclipse menu, click Run -> Debug Configurations
    2. Choose C/C++ Remote Application, click the right mouse button, choose New Configuration menu title
    3. Input name at Name: field
    4. In Project: field, click Browse… button, and then choose Executables
    5. In C/C++ Application:, specify the elf file to use for debugging title
    6. Choose Debugger tab
    7. Select the checkbox before Stop on startup at:, then input main or desired breakpoint in the field
    8. In GDB debugger:, Input the absolute path of arm-eabi-gdb title
    9. In Debugger tab, choose Connection tab
    10. Input Type : TCP, Host name or IP address : localhost, Port number : 1234 title
    11. Choose Source tab
    12. Click Add… button, choose File System Directory, set the source file path title
    13. Click Apply button, click Debug button, then the screen which stopped at the breakpoint(ex.main) appears.
    14. In this state, debug by clicking “Step Into” and “Step Over” buttons. title
    15. “HelloWorld!” is printed in terminal window
      1
      2
      3
      
      $ qemu-arm -g 1234 helloworld
      HelloWorld!
      $
      

Debugging uboot with cdt

1
$ qemu-system-arm --machine vexpress-a9 -m 1G -nographic -kernel u-boot -s -S


Leave a comment