Thursday, July 22, 2010

Installation of Eclipse CDT IDE in Fedora 9.

Ref [1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0201a/index.html Debugging Linux Application using Eclipse+GDB


1. Download latest Eclipse CDT IDE.
--------------------------------------------
From:
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/helios/R/eclipse-cpp-helios-linux-gtk.tar.gz

[q.yang@localhost Download]$ ll
-rwxr--r-- 1 q.yang q.yang 91574228 2010-07-23 14:25 eclipse-cpp-helios-linux-gtk.tar.gz



3. Installation Eclipse CDT (IDE 3.6.0 CDT 7.0.0)
----------------------------------------------------
[q.yang@localhost ~]$ mkdir EclipseCDT
[q.yang@localhost EclipseCDT]$ tar zxf ~/Download/eclipse-cpp-helios-linux-gtk.tar.gz






4. Start first Eclipse Project
------------------------------------------
[q.yang@localhost eclipse]$./eclipse

Then set work space storage folder
/home/q.yang/EclipseCDT/qywkspace

Add /home/q.yang/EclipseCDT/eclipse/ into $PATH so that command line '$eclipse' will open eclipse IDE.



5. Create Make file based C/C++ application project
---------------------------------------------------
Not makefile will be generated by eclipse CDT. Good for import existing makefile based source codes and projects. Only use eclipse as a debugger mainly and trigger 'make'.


New-->C++ project
Then give the project name 'GsnProjEclipseHelloCpp'.
And uncheck 'use default location', browse to choose Root directory of source codes '/home/q.yang/lpc3250/ltib-qs/rootfs/home/user/GsnHelloCppRoot'

As shown in this screen shot.





After creating 'Makefile project', attached is the project view screen shot:






6. Set debug configuration
-----------------------------------------------------
In C/C++ editing view, right click project, choose 'Debug As' -> 'Debug Configurations ...'

Create button to new a debug configuration, rename this new debug configuration as 'GsnProjEclipseDebugConfig'.
Then click browse to choose C/C++ application 'hellocpp', which is the binary executable program generated by makefile.

As shown in this screen shot:




Set up GDB debugger (from LTIB tool chain) and GDB command file as shown in the screen shot:



[q.yang@localhost qywkspace]$ pwd
/home/q.yang/EclipseCDT/qywkspace
[q.yang@localhost qywkspace]$ ll
total 16
-rw-rw-r-- 1 q.yang q.yang 145 2010-07-26 12:28 eclipseGdbCmdFile
drwxrwxr-x 4 q.yang q.yang 4096 2010-07-26 14:20 Gsn_HelloCpp_Eclipse
[q.yang@localhost qywkspace]$ cat eclipseGdbCmdFile
set remotetimeout 0
set solib-absolute-prefix /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/arm-none-linux-gnueabi/



Set up Debugger Options -> Shared Libraries as shown in this screen shot (LTIB lib)




Set up Debugger Options -> Connection as shown in this screen shot (via Ethernet to target board phytec 3250)







7. Done. You would be able to do single step debugging now.
--------------------------------------------------------------
As shown in this screen shot:

[root@GsnCommsModule debug]# gdbserver 127.0.0.1:2000 hellocpp
Process hellocpp created; pid = 501
Listening on port 2000
Remote debugging from host 10.10.20.70
Hello world!
Hello there. First GsnCpp from Eclipse IDE.
Child exited with retcode = 0
Child exited with status 0
GDBserver exiting

No comments: