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

Re: [ns] eval signal SIGSEGV




This is a known problem where some compilers (i.e., recent gccs) that
place strings in read-only memory and this interacts badly with Tcl.
Tcl wants to modify the string during evalution.  Fix: change tcl.eval
to tcl.evalc, or change your Tcl code not to have embedded []
expressions (in your example udp__ is thrown away so you can just get
rid of the set part).

   -John Heidemann


>
>Hello, deal all:
>
>	I met a problem when I use:
>
>  Tcl &tcl=Tcl::instance();
>  tcl.eval("set udp__ [new Agent/UDP]");
>  agent_ = (Kronos_UdpAgent *) TclObject::lookup(tcl.result());
>
>at c++ level, it receives signal SIGSEGV. while it is okay in TCL level.
>the below is the debug information:
>....
>Reading symbols from /usr/lib/gconv/ISO8859-1.so...done.
>#0  0x81574ab in Tcl_ParseCommand () at gen/ptypes.cc:120
>120     EmbeddedTcl et_ns_ptypes(code);
>(gdb) bt
>#0  0x81574ab in Tcl_ParseCommand () at gen/ptypes.cc:120
>#1  0x8158495 in Tcl_EvalEx () at gen/ptypes.cc:120
>#2  0x81581ca in Tcl_EvalTokens () at gen/ptypes.cc:120
>#3  0x8158512 in Tcl_EvalEx () at gen/ptypes.cc:120
>#4  0x81587aa in Tcl_Eval () at gen/ptypes.cc:120
>#5  0x8125630 in Tcl_GlobalEval () at gen/ptypes.cc:120
>#6  0x811bc64 in Tcl::eval () at gen/ptypes.cc:120
>......
>
>any hint is appreciated.
>
>BTW:  I wrote similar stuff and ran in ns-2.1b6 before.
>
>thank you
>
>Sencun 
>
>