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

[ns] Tcl-debug problem?




I installed Tcl-debug in parallel to ns-2.1b7-current
directory and reconfigure ns with configure
-enable-debug -with-tcldebug=mytcldebugdir
and then I "make distclean" and "make" (i.e.recompile)
the whole ns-2.1b7-current/  (I didn't re-compile
other components like tcl, OTcl,etc. though).

When I run ns, it outputs a lot of Tcl scripts like
trash (showed below the first part).  Anyone has an
idea of what happened ?  Thanks!

----------------------
ns: 




proc warn {msg} {
global warned_
if {![info exists warned_($msg)]} {
puts stderr "warning: $msg"
set warned_($msg) 1
}
}

if {[info commands debug] == ""} {
proc debug args {
warn {Script debugging disabled.  Reconfigure with
--with-tcldebug, and recompile.}
}
}

proc assert args {
if [catch "expr $args" ret] {
set ret [eval $args]
}
if {! $ret} {
error "assertion failed: $args"
}
}

proc find-max list {
set max 0
foreach val $list {
if {$val > $max} {
set max $val
}
}
return $max
}


Class Simulator



proc checkout_executable {exe_var best alternate text}
{
global $exe_var
set $exe_var $best
if {![file executable $best]} {
puts stderr $text
set $exe_var $alternate
}
}

checkout_executable PERL /usr/dist/exe/perl5 perl "
When configured, ns found the right version of perl in
/usr/dist/exe/perl5
but it doesn't seem to be there anymore, so ns will
fall back on running the first perl in your path. The
wrong version of perl may break the test suites.
Reconfigure and rebuild ns if this is a problem. "
checkout_executable TCLSH /usr/dist/exe/tclsh tclsh "
When configured, ns found the right version of tclsh
in /usr/dist/exe/tclsh
but it doesn't seem to be there anymore, so ns will
fall back on running the first tclsh in your path. The
wrong version of tclsh may break the test suites.
Reconfigure and rebuild ns if this is a problem. "













Class AddrParams 
Class AllocAddrBits

Simulator instproc get-AllocAddrBits {prog} {
$self instvar allocAddr_
if ![info exists allocAddr_] {
set allocAddr_ [new AllocAddrBits]
} elseif ![string compare $prog "new"] {
set allocAddr_ [new AllocAddrBits]
}
return $allocAddr_
}


Simulator instproc set-address-format {opt args} {
set len [llength $args]
if {[string compare $opt "def"] == 0} {
$self set-address 32
set mcastshift [AddrParams set McastShift_]
Simulator set McastAddr_ [expr 1 << $mcastshift]
mrtObject expandaddr
} elseif {[string compare $opt "expanded"] == 0} {
puts "set-address-format expanded is obsoleted by
32-bit addressing."
} elseif {[string compare $opt "hierarchical"] == 0 &&
$len == 0} {
if [$self multicast?] {
$self set-hieraddress 3 9 11 11
} else {
$self set-hieraddress 3 10 11 11
}
} else {
if {[string compare $opt "hierarchical"] == 0 && $len
> 0} {
eval $self set-hieraddress [lindex $args 0] [lrange
$args 1 [expr $len - 1]]
}
} 
}


Simulator instproc expand-port-field-bits nbits {
puts "Warning: Simulator::expand-port-field-bits is
obsolete.  Ports are 32 bits wide"
return
}



Simulator instproc set-address {node} {
set a [$self get-AllocAddrBits "new"]
$a set size_ [AllocAddrBits set DEFADDRSIZE_]
if {[expr $node] > [$a set size_]} {
$a set size_ [AllocAddrBits set MAXADDRSIZE_]
}

$a set-mcastbits 1
set lastbit [expr $node - [$a set mcastsize_]]
$a set-idbits 1 $lastbit
}

Simulator instproc expand-address {} {
puts "Warning: Simulator::expand-address is obsolete. 
The node address is 32 bits wides"
return
}



Simulator instproc set-hieraddress {hlevel args} {
set a [$self get-AllocAddrBits "new"]
$a set size_ [AllocAddrBits set MAXADDRSIZE_]
if { ![Simulator set EnableHierRt_] && $hlevel > 1} {
Simulator set EnableHierRt_ 1
Simulator set node_factory_ HierNode
}
if [$self multicast?] {
$a set-mcastbits 1
}
eval $a set-idbits $hlevel $args
}




AllocAddrBits instproc init {} {
eval $self next
$self instvar size_ portsize_ idsize_ mcastsize_
set size_ 0
set portsize_ 0
set idsize_ 0
set mcastsize_ 0
}


AllocAddrBits instproc get-AllocAddr {} {
$self instvar addrStruct_
if ![info exists addrStruct_] {
set addrStruct_ [new AllocAddr]
}
return $addrStruct_
}

AllocAddrBits instproc get-Address {} {
$self instvar address_
if ![info exists address_] {
set address_ [new Address]
}
return $address_
}


AllocAddrBits instproc chksize {bit_num prog} {
$self instvar size_ portsize_ idsize_ mcastsize_  
if {$bit_num <= 0 } {
error "$prog : \# bits less than 1"
}
set totsize [expr $portsize_ + $idsize_ + $mcastsize_]
if {$totsize > [AllocAddrBits set MAXADDRSIZE_]} {
error "$prog : Total \# bits exceed MAXADDRSIZE"
}
if { $size_ < [AllocAddrBits set MAXADDRSIZE_]} {
if {$totsize > [AllocAddrBits set DEFADDRSIZE_]} {
set size_ [AllocAddrBits set MAXADDRSIZE_]
return 1
} 
}
return 0

}



AllocAddrBits instproc set-portbits {bit_num} {
puts "Warning: AllocAddrBits::set-portbits is
obsolete.  Ports are 32 bits wide."
return
}



AllocAddrBits instproc expand-portbits nbits {
puts "Warning: AllocAddrBits::expand-portbits is
obsolete.  Ports are 32 bits wide."
return
}

AllocAddrBits instproc set-mcastbits {bit_num} {
$self instvar size_ mcastsize_
if {$bit_num != 1} {
error "setmcast : mcastbit > 1"
}
set mcastsize_ $bit_num

if [$self chksize mcastsize_ "setmcast"] {
error "set-mcastbits: size_ has been changed."
}
set a [$self get-AllocAddr] 
set v [$a setbit $bit_num $size_]
AddrParams set McastMask_ [lindex $v 0]
AddrParams set McastShift_ [lindex $v 1]

set ad [$self get-Address]
$ad mcastbits-are [AddrParams set McastShift_]
[AddrParams set McastMask_]

}


AllocAddrBits instproc set-idbits {nlevel args} {
$self instvar size_ portsize_ idsize_ hlevel_ hbits_
if {$nlevel != [llength $args]} {
error "setid: hlevel < 1 OR nlevel and \# args donot
match"
}
set a [$self get-AllocAddr] 
set old 0
set idsize_ 0
set nodebits 0
AddrParams set hlevel_ $nlevel
set hlevel_ $nlevel
for {set i 0} {$i < $nlevel} {incr i} {
set bpl($i) [lindex $args $i]
set idsize_ [expr $idsize_ + $bpl($i)]

set chk [$self chksize $bpl($i) "setid"]
if {$chk > 0} {
error "set-idbits: size_ has been changed."
}
set v [$a setbit $bpl($i) $size_]
AddrParams set NodeMask_([expr $i+1]) [lindex $v 0]
set m([expr $i+1]) [lindex $v 0]
AddrParams set NodeShift_([expr $i+1]) [lindex $v 1]
set s([expr $i+1]) [lindex $v 1]
lappend hbits_ $bpl($i)

}
AddrParams set nodebits_ $idsize_
set ad [$self get-Address]
eval $ad idsbits-are [array get s]
eval $ad idmbits-are [array get m]

}





AddrParams proc set-hieraddr addrstr {
set ns [Simulator instance]
set addressObj [[$ns get-AllocAddrBits ""]
get-Address]
set ip [$addressObj str2addr $addrstr]

return $ip
}

AddrParams proc get-hieraddr addr {
AddrParams instvar hlevel_ NodeMask_ NodeShift_
for {set i 1} {$i <= $hlevel_} {incr i} {
set a [expr [expr $addr >> $NodeShift_($i)] &
$NodeMask_($i)]
lappend str $a
}
return $str
}

AddrParams proc elements-in-level? {nodeaddr level} {
AddrParams instvar hlevel_ domain_num_ cluster_num_
nodes_num_ def_
set L [split $nodeaddr .] 
set level [expr $level + 1]

if { $level == 1} {
return $domain_num_
}
if { $level == 2} {
return [lindex $cluster_num_ [lindex $L 0]]
}
if { $level == 3} {
set C 0
set index 0
while {$C < [lindex $L 0]} {
set index [expr $index + [lindex $cluster_num_ $C]]
incr C
}
return [lindex $nodes_num_ [expr $index + [lindex $L
1]]]
}

}




Simulator instproc get-node-by-addr address {
$self instvar Node_
set n [Node set nn_]
for {set q 0} {$q < $n} {incr q} {
set nq $Node_($q)
if {[string compare [$nq node-addr] $address] == 0} {
return $nq
}
}
error "get-node-by-addr:Cannot find node with given
address"
}

Simulator instproc get-node-id-by-addr address {
$self instvar Node_
set n [Node set nn_]
for {set q 0} {$q < $n} {incr q} {
set nq $Node_($q)
if {[string compare [$nq node-addr] $address] == 0} {
return $q
}
}
error "get-node-id-by-addr:Cannot find node with given
address"
}


Classifier/Port/Reserve instproc init args {
eval $self next
$self reserve-port 2
}


Node set nn_ 0
Node proc getid {} {
set id [Node set nn_]
Node set nn_ [expr $id + 1]
return $id
}

Node instproc init args {
eval $self next $args
$self instvar np_ id_ agents_ dmux_ neighbor_ rtsize_
address_
$self instvar nodetype_
$self instvar multiPath_

set nodetype_ [[Simulator instance] get-nodetype]

set neighbor_ ""
set agents_ ""
set dmux_ ""
set np_ 0
set id_ [Node getid]
set rtsize_ 0
$self set-node-address$nodetype_ $args

$self mk-default-classifier$nodetype_
$self cmd addr $address_; # new by tomh
set multiPath_ [$class set multiPath_]

}

Node instproc set-node-address { args } {
}

Node instproc set-node-addressMIPBS { args } {
}

Node instproc set-node-addressMIPMH { args } {
}

Node instproc set-node-addressMobile { args } {

$self instvar nifs_ arptable_
$self instvar netif_ mac_ ifq_ ll_
$self instvar X_ Y_ Z_

set X_ 0.0
set Y_ 0.0
set Z_ 0.0
set arptable_ ""                ;# no ARP table yet

set nifs_	0		;# number of network interfaces

}

Node instproc set-node-addressHier {args} {
$self instvar address_

set address_ $args

}

Node instproc set-node-addressBase {args} {
}

Node instproc mk-default-classifierMIPMH {} {
$self mk-default-classifierBase
}

Node instproc mk-default-classifierMIPBS {} {
$self mk-default-classifierBase
}

Node instproc mk-default-classifierBase {} {
$self mk-default-classifierHier
}

Node instproc mk-default-classifierHier {} {
$self instvar np_ id_ classifiers_ agents_ dmux_
neighbor_ address_ 
set levels [AddrParams set hlevel_]

for {set n 1} {$n <= $levels} {incr n} {
set classifiers_($n) [new Classifier/Addr]
$classifiers_($n) set mask_ [AddrParams set
NodeMask_($n)]
$classifiers_($n) set shift_ [AddrParams set
NodeShift_($n)]
}
}


Node instproc mk-default-classifierMobile {} {
$self mk-default-classifier
}

Node instproc split-addrstr addrstr {
set L [split $addrstr .]
return $L
}

Node instproc mk-default-classifier {} {
$self instvar address_ classifier_ id_
set classifier_ [new Classifier/Hash/Dest 32]
$classifier_ set mask_ [AddrParams set NodeMask_(1)]
$classifier_ set shift_ [AddrParams set NodeShift_(1)]
if ![info exists address_] {
set address_ $id_
}
}

Node instproc enable-mcast sim {
$self instvar classifier_ multiclassifier_ ns_ switch_
mcastproto_
$self set ns_ $sim

$self set switch_ [new Classifier/Addr]

[$self set switch_] set mask_ [AddrParams set
McastMask_]
[$self set switch_] set shift_ [AddrParams set
McastShift_]

$self set multiclassifier_ [new
Classifier/Multicast/Replicator]
[$self set multiclassifier_] set node_ $self

$self set mrtObject_ [new mrtObject $self]

$switch_ install 0 $classifier_
$switch_ install 1 $multiclassifier_

}

Node instproc add-neighbor p {
$self instvar neighbor_
lappend neighbor_ $p
}

Node instproc incr-rtgtable-size {} {
$self instvar rtsize_
set rtsize_ [expr $rtsize_ + 1]
}

Node instproc entry {} {


$self instvar nodetype_
return [$self entry-New$nodetype_]
}

Node instproc entry-NewMIPBS {} {
return [$self entry-NewBase]
}

Node instproc entry-NewMIPMH {} {
return [$self entry-NewBase]
}

Node instproc entry-NewBase {} {

$self instvar ns_
if ![info exist ns_] {
set ns_ [Simulator instance]
}
if [$ns_ multicast?] {
$self instvar switch_
return $switch_
}
$self instvar classifiers_
return $classifiers_(1)

}

Node instproc entry-New {} {

if [info exists router_supp_] {
return $router_supp_
}
if ![info exist ns_] {
set ns_ [Simulator instance]
}
if [$ns_ multicast?] {
$self instvar switch_
return $switch_
}
$self instvar classifier_
return $classifier_
}

Node instproc entry-NewMobile {} {
return [$self entry-New]
}

Node instproc add-route { dst target } {
$self instvar classifier_
$classifier_ install $dst $target
$self incr-rtgtable-size
}

Node instproc get-nam-traceall {args} {

$self instvar namtraceFile_
set file [lindex $args 0]
set namtraceFile_ $file

}


Node instproc id {} {
$self instvar id_
return $id_
}

Node instproc node-addr {} {

$self instvar address_

return $address_
}


Node instproc alloc-port { nullagent } {
$self instvar dmux_ np_
set p [$dmux_ alloc-port $nullagent]
if { $np_ < $p } {
set np_ $p
}
if {$np_ > [$dmux_ set mask_] && [$dmux_ set mask_] >
0 } {
puts stderr "No of ports($np_) attached to $self node
is greater than allowed"
}

return $p
}

Node instproc attach { agent { port "" } } {

$self instvar agents_ address_ dmux_ classifier_
$self instvar classifiers_
lappend agents_ $agent
set mask [AddrParams set ALL_BITS_SET]
set shift 0



$agent set node_ $self

if [Simulator set EnableHierRt_] {
$agent set agent_addr_ [AddrParams set-hieraddr
$address_]

} else {
$agent set agent_addr_ [expr ($address_ &  [AddrParams
set NodeMask_(1)])  << [AddrParams set NodeShift_(1)
]]
}


if { $dmux_ == "" } {
set dmux_ [new Classifier/Port]
$dmux_ set mask_ $mask
$dmux_ set shift_ $shift


if {[Simulator set EnableHierRt_]} {
$self add-hroute $address_ $dmux_
} else {
$self add-route $address_ $dmux_
}
}
if {$port == ""} {
set ns_ [Simulator instance]
$ns_ instvar nullAgent_
set port [$self alloc-port $nullAgent_]
}
$agent set agent_port_ $port

$self add-target $agent $port

}

Node instproc add-target {agent port} {

$self instvar nodetype_
$self add-target-New$nodetype_ $agent $port
}


__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com