[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Stack trace after a core dump while Tcllevel debugging
All,
I'm using 20010320 snapshots and tcldebug2.0 (but no dmalloc). The
problem is that ns (linked both statically and dynamically) segfaults
when debugging OTcl code: After stepping ("s") through the code,
typing the stack trace ("w") will cause subsequent setepping ("s")
to make ns bomb.
E.g. (tcl script attached at the end of the mail)
./ns ./test.tcl
using backward compatible Agent/CBR; use Application/Traffic/CBR instead
2: lappend auto_path $dbg_library
dbg2.0> s
1: $ns rtmodel-at 1.0 down $n1 $n2
$ns at 1.999 "puts \"Link is going u...
dbg1.1> s
2: list $op $at
dbg2.2> s
2: set parms [list $op $at]
dbg2.3> s
2: list $parms
dbg2.4> s
2: eval $self rtmodel Manual [list $parms] $args
dbg2.5> s
3: _o3 rtmodel Manual {down 1.0} _o13 _o16
dbg3.6> w
0: application
*1: _o3 {_o3} {Simulator} {rtmodel-at} {1.0} {down} {_o13} {_o16}
3: _o3 {rtmodel} {Manual} {down 1.0} {_o13} {_o16}
dbg3.7> s
Bus error (core dumped)
Below is the coresp. call stack trace in ns built statically:
#0 0x21de54 in _smalloc ()
#1 0x21de90 in malloc ()
#2 0x1b2468 in TclpAlloc () at embedded-tclobj.cc:1247
#3 0x14ca84 in Tcl_Alloc () at embedded-tclobj.cc:1247
#4 0x17e5c4 in TclRegisterLiteral () at embedded-tclobj.cc:1247
#5 0x15bc84 in TclCompileScript () at embedded-tclobj.cc:1247
#6 0x15b7bc in TclSetByteCodeFromAny () at embedded-tclobj.cc:1247
#7 0x15ea54 in SetByteCodeFromAny () at embedded-tclobj.cc:1247
#8 0x148974 in Tcl_EvalObjEx () at embedded-tclobj.cc:1247
#9 0x170c04 in Tcl_RecordAndEvalObj () at embedded-tclobj.cc:1247
#10 0x170b0c in Tcl_RecordAndEval () at embedded-tclobj.cc:1247
#11 0x13a764 in simple_interactor (interp=0x4c92f0) at Dbg.c:1231
#12 0x138b5c in debugger_trap (clientData=0x0, interp=0x4c92f0, level=3, command=0x56e850 "_o3 rtmodel Manual {down 1.0} _o13 _o16", cmdProc=0x140208 <OTclDispatch>, cmdClientData=0x6c6ee0, argc=6, argv=0x56b560) at Dbg.c:653
#13 0x186364 in EvalObjv () at embedded-tclobj.cc:1247
#14 0x18681c in Tcl_EvalEx () at embedded-tclobj.cc:1247
#15 0x14878c in Tcl_EvalObjEx () at embedded-tclobj.cc:1247
#16 0x14fe10 in Tcl_EvalObjCmd () at embedded-tclobj.cc:1247
#17 0x165a98 in TclExecuteByteCode () at embedded-tclobj.cc:1247
#18 0x148a34 in Tcl_EvalObjEx () at embedded-tclobj.cc:1247
#19 0x18df64 in TclObjInterpProc () at embedded-tclobj.cc:1247
#20 0x18db30 in TclProcInterpProc () at embedded-tclobj.cc:1247
#21 0x140450 in OTclDispatch (cd=0x6c6ee0, in=0x4c92f0, argc=6, argv=0xffbeeb50)
#22 0x14a7d8 in TclInvokeStringCommand () at embedded-tclobj.cc:1247
#23 0x1863d4 in EvalObjv () at embedded-tclobj.cc:1247
#24 0x18681c in Tcl_EvalEx () at embedded-tclobj.cc:1247
#25 0x17ca9c in Tcl_EvalFile () at embedded-tclobj.cc:1247
#26 0x17f950 in Tcl_Main () at embedded-tclobj.cc:1247
#27 0x10230 in main (argc=2, argv=0xffbef7fc) at tclAppInit.cc:60
Different traces through OTcl code lead to different ways in which ns
breaks. AFAICT the thing that appears consistently in the stack traces are
the stack frames #2 and #3 above.
Below is the simple tcl script i'm struggling^H^H^H^H working on ;)
If you require any further information contact me directly to avoid
spraying the whole list (more than already did).
Cheers,
Florian
-----------
# "Where are the packets go when the link is down" script
#Preamble
set ns [new Simulator]
set nstrf [open STout.tr w]
set namtrf [open out.nam w]
set ltrf [open STout.ltr w]
$ns trace-all $nstrf
$ns namtrace-all $namtrf
###############################################################################
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 1Mb 10ms DropTail
$ns duplex-link $n2 $n3 1Mb 10ms DropTail
# Monitor the packet drops on link from $n(1) to $n(2)
$ns trace-queue $n1 $n2 $ltrf
# The next step is to send some data from node n(0) to node n(3).
set cbr0 [new Agent/CBR]
$ns attach-agent $n0 $cbr0
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
set null0 [new Agent/Null]
$ns attach-agent $n3 $null0
$ns connect $cbr0 $null0
$ns at 0.5 "$cbr0 start"
$ns at 0.999 "puts \"Link is going down at 1.0 \""
debug 1
$ns rtmodel-at 1.0 down $n1 $n2
$ns at 1.999 "puts \"Link is going up at 2.0\""
$ns rtmodel-at 2.0 up $n1 $n2
$ns at 4.5 "$cbr0 stop"
###############################################################################
#Define a 'finish' procedure
proc finish {} {
global ns namtrf nstrf
# Flush all trace files
$ns flush-trace
#Close trace files
close $nstrf
close $namtrf
#Execute nam on the trace file
# exec nam out.nam &
exit 0
}
#Call the finish procedure after 5 seconds simulation time
$ns at 5.0 "finish"
#Run the simulation
$ns run