Use kdevelop to debug NS2.

Source: Internet
Author: User
Original converted from: http://www.baisi.net/redirect.php? Tid = 1617581 & goto = newpost + self-Practice

To debug NS using kdevelop in Ubuntu:
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 re-compile
Note: do not perform the following steps
Make clean
Make depend)
Make
(Note: make is not required.
Install ).

4. Rename makefile to makefile. am.

5. Open kdevelop and select "project"-> "Import existing
Project ". In directory, select the NS directory (the directory where makefile is located) and Project
Name, and select "Generic C ++ application (custom
Makefiles) ". Then 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, and find the NS you just run in the dialog box.
Process, 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.