Linux debugging Large and C + + programs for the general programmer is a difficult thing, GDB provides a powerful debugging features and rich debugging commands, but interface friendly and user experience is not as good as vs Debugging tools PS: Many Daniel can use GdB's superb, in this cult, 工欲善其事, its prerequisite, this article focuses on the use of the Eclipse CDT for remote debugging through Gdbserver in a Windows environment.
One, the tool to use Mingw-get-inst-20120426.exe gdb-7.4.1.tar.gz eclipse-cpp-indigo-sr2-incubation-win32.zip
second, installation and configuration
Install MinGW
Open Mingw-get-inst-20120426.exe, all the way next, select C Compile, C + + compile, and MS baseic system in the Select Components dialog box as shown below:
MinGW compile gdb into C:\MinGW\msys\1.0 run Msys.bat open mingw simulate environment copy gdb-7.4.1.tar.gz to current user directory (C:\MinGW\msys\1.0\home\ Tuxingkai) tar zxvf gdb-7.4.1.tar.gz cd gdb-7.4.1./configure--target=i686-pc-linux-gnu This step is important to specify the type of target machine make && Amp Make install
After the installation is successful, copy the I686-pc-linux-gnu-gdb.exe from the C:\MinGW\msys\1.0\local\bin directory to the C:\MinGW\bin directory
Configure samba under Linux
Configure the Linux Samba service so that Windows can access the Linux shared directory and Eclipse creates the project in a shared directory to achieve code sharing under Windows and Linux
Edit the/etc/samba/smb.conf file and add the following information at the bottom
[Share]
Comment = Linux/C + + program Share directory
Path =/home/tuxingkai/share
writable = yes
Read Only = no
browsable =yes
Valid users = Tuxingkai
Guest OK =on
#service Samba Start Service
map Shared folders on Windows
Create C + + Engineering with Eclipse
Open Eclipse, switch working directory to Z:\Project, new C + + project
Select the current compilation method for GNU make builder
Compiling the HelloWorld project, eclipse will automatically generate makefile files under the Debug directory
Under Linux switch to Helloworld/debug directory, execute make clean;make compile Linux executable file
Configuring Remote Debugging
Linux Server boot Gdbserver
Setting up debug configurations in the Eclipse environment
When the configuration is complete, click Debug to debug remotely