How to debug NS using Kdevelop in Ubuntu

Source: Internet
Author: User
This includes the issue of resolving invalid breakpoints. 1. in the software package management area, select the relevant components of Kdevelop to install. 2. in the NS directory, make the following changes to the Makefile file: Add debugging information in the Code: Modify Makefile (without any suffix) will inside the CCOPT =-wall # if it is a ns-allinone-2.28, here is CCOPT =-O2STATIC = LDFLAGS = $ (STATI

This includes the issue of resolving invalid breakpoints.

1. Select the relevant components of Kdevelop to install in the software package management area.

2. In the NS directory, make the following changes to the Makefile file:

Add debugging information in the Code: Modify Makefile (without any suffix)

CCOPT =-wall # For ns-allinone-2.28, here is CCOPT =-O2

STATIC =

LDFLAGS = $ (STATIC)

LDOUT =-o $ (BLANK)

Changed:

CCOPT =-wall-g # if it is a ns-allinone-2.28, change here to CCOPT =-O2-g

STATIC =

LDFLAGS = $ (STATIC)

LDOUT =-o $ (BLANK)

3. Then recompile

Note: do not perform the following steps

Make clean

Make depend)

Make

(Note: make install is not required ).

4. Rename Makefile to Makefile. am.

5. Open Kdevelop and select "Project"-> "Import Existing Project ". In the Directory, select the NS Directory (the Directory where the Makefile is located), set the Project Name to a Name, and select "Generic C ++ Application (Custom Makefiles)" for the Project type )". select "OK ". Select "Populate.

6. Change Makefile. am to the name Makefile.

Previously I encountered the problem of invalid breakpoint settings. Later I found that the-g option was not added to the Makefile (step 2)

Then you can perform debugging:

1. Enter ns on the terminal and press Enter.

2. Select the menu command "Debug/Attach to process" in Kdevelop, find the NS process you just run in the dialog box, and press OK.

(Note: I encountered a problem here. I have always been prompted that there is no name defined in kdevelop. Define the project name in kdevelop as ns to solve the problem and debug it .)

3. Enter the tcl command on the terminal, such as "source test. tcl" and press Enter.

4. Set a breakpoint (it is invalid if a breakpoint is set at the beginning)

5. Select the Debug command Continue to Continue running the program. The debugging result is displayed.

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.