[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] how to use debugger



1) You should use -g option to turn on debugging, in the makefile : 
CCOPT	= -g
2) to use gdb with ns ; gdb ./ns
3) set your breakpoints, ex : break MAC::recv
4) run your script, ex : run script.tcl
5) when the break point is reached do whatever you need: continue, next, step
6) to get help with the commands, try typing help on the command line.


>X-Authentication-Warning: mash.CS.Berkeley.EDU: majrdomo set sender to 
[email protected] using -f
>Date: Thu, 01 Jun 2000 02:35:35 +0900
>From: Minehiko Iida <[email protected]>
>To: [email protected]
>Subject: [ns] how to use debugger
>MIME-Version: 1.0
>Content-Transfer-Encoding: 7bit
>
>Hi, all!
>
>I'd like to trace ns source code with a script (for example, 
>/foo/bar/ns/ns-2.1b6/tcl/lib/simple.tcl). I tried to trace with
>debugger "gdb", but I couldn't. gdb is suspended like this:
>
>------------------------------------------------------------------------
>Current directory is /foo/bar/ns/ns-2.1b6/tcl/ex/
>GNU gdb 4.18
>Copyright 1998 Free Software Foundation, Inc.
>GDB is free software, covered by the GNU General Public License, and you are
>welcome to change it and/or distribute copies of it under certain conditions.
>Type "show copying" to see the conditions.
>There is absolutely no warranty for GDB.  Type "show warranty" for details.
>This GDB was configured as "i386-unknown-freebsd"...
>(gdb) l
>51	 *	Whatever the application does.
>52	 *
>53	 *----------------------------------------------------------------------
>54	 */
>55	
>56	int
>57	main(int argc, char **argv)
>58	{
>59	    Tcl_Main(argc, argv, 
>60		     Tcl_AppInit);
>(gdb) b 59
>Breakpoint 1 at 0x804aed6: file tclAppInit.cc, line 59.
>(gdb) run
>Starting program: /usr/local/ns/bin/ns 
>
>Breakpoint 1, main (argc=1, argv=0xbfbffa1c) at tclAppInit.cc:60
>(gdb) s
>0x8141940 in Tcl_Main () at gen/ptypes.cc:112
>(gdb) s
>%
>---------------------------------------------------------------------
>I located the line "debug 1" at appropriate place, but did not work well.
>
>Because I couldn't understand the way of debugging only by reading 
>ns manual, please tell me the way in detail.
>----
>Minehiko Iida <[email protected]>

Tarik