In recent days, some users have encountered an error code when using gdb debug ns2. This problem can arise for several reasons. Let’s discuss it now.
Recommended
Memory Leaks
- OTcl
OTcl, in particular TclCL, allows you to activate new objects,however, as a result, it doesn’t offer awesome garbage collectionMechanism for these assigned units. This can be easy toounintentional memory leak.Important: tools like dmalloc purifycannot detect a memory leak of the above type.For example, consider this simple OTcl ns script:
define [new simulator]because I just put 0 {$ iYou expect our memory usage to decrease afterThe first random value is assigned. But above all, because OTcl doesn't have it.Refusal flag if a second random variable is selected,the previous one will not be freed and will subsequently cause a memory leak.Unfortunately for many, there is no easy solution because the rubbishThe set of tasks is fundamentally incompatible with this.Esprit on Tcl. The only way to make it clear now is alwaysExplicitly write each OTcl object assigned in the script tojust like they take care of moved objects in C / C ++.
- C / C ++
Another source is memory leaks in C / C ++. NSthen the guide is much simpler tooKeep an eye out for some tools specially designed for this role, for example:dmalloc and clean.Ns has this special
ns-pure
target to create pure nsexecutable file. First make sure thePURIFY
macro is inns Makefile consists of the correctcompiler
for yourLinker (check out the blank man page if you know what it is).Then entermake ns-pure
.For more information on using ns with libdmalloc see here.
Tcl-level Debugging
Ns supports Don Libs Tcl debugger(seePostScript DocumentationandSource).Install the program or close the source site inparallel with ns-2 and the situation was established.Unlike the described wait which can be found in the tcl-debug documentation,we do not support it-D Flag. To get through thisDebugger, add a bright “Debug 1” to the scriptappropriate place.
The $ ns gen-map command lists each object in raw form.
This is really useful for correlating position with this feature of an object.given his name.Object nameect is the entire OTcl descriptor, usually the name be“ _o ### ”. TclObjects,a C ++ debugger is also available for this, as for gdblike this-> name_.
Debugging At The C Level
Any standard debugger can probably handle this task.
The following macro for gdb makes it easier to understand what’s inside. passRoutines that take Tcl arguments TcpAgent :: command ()):
## (as for dumping arguments passed to Tcldefine pargvcdefine $ i = 0while $ iMix Tcl And C Debugging
(Always fun, right?)
This is a painful reality that usually comes up when viewing Tcl output and debugging.Tcl level stuff hoping to get to C level says and vice versavice versa. This is a small tip on how to make this task easier.If you are browsing ns gdb then
- The If call (shown in bold below) guides youAccess to the Tcl debugger. Tips on how to make this product uniqueUsing the debugger and what you can do with itIspolzovat Gdb Debug Ns2
Usar Gdb Debug Ns2
Usa Gdb Debug Ns2
Uzyj Debugowania Gdb Ns2
Utiliser Gdb Debug Ns2
Utilizar Gdb Debug Ns2
Anvand Gdb Debug Ns2
Gebruik Gdb Debug Ns2
Verwenden Sie Gdb Debug Ns2
Gdb 디버그 Ns2 사용