Using the Eclipse CDT to remotely debug a Linux/C + + program under Windows

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.