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.