[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] pointer value of name_ variable changing
Hi,
This is a follow-up on my previous question, on further debugging I have
found that after a certain function call the pointer value of 'name_'
variable is changing. I think it is happening because of a cast, but not
sure why. Could anyone please help me out with this problem: here is the
code I feel relevant:
Inheritance heirarchy
// Queue
// |
// dsREDQueue
// |
// modEdgeQueue
// | WDMSchedulerStub
// | |
// WDMQueue
int
WDMScheduler::addQ(Connector *que, int nodeId, int chanId) {
int nidx = installNodeIdx(nodeId);
int cidx = installChanIdx(chanId);
Tcl &tcl = Tcl::instance();
// 04/12/01 -> accepts a stub, ie a que casted to a stub and
// sets the scheduler related data
// *** till this point 'name_' variable contains some pointer
// *** pointing to "_o30"
((WDMSchedulerStub*)que)->setSchedulerInfo(this, nodeId, chanId, nidx,
cidx);
// **** at this point the pointer value has been changed
// **** and points to ""
schStubs_[cidx*Nodes + nidx] = (WDMSchedulerStub*)que;
return 1;
}
What am I doing wrong, I would appreciate your help.
regards,
Sudhin.
---------- Forwarded message ----------
Date: Thu, 12 Apr 2001 17:32:21 -0400 (EDT)
From: Sudhindra Suresh Bengeri <[email protected]>
To: [email protected]
Subject: [ns] SIGSEGV in TclClass::dispatch_cmd ()
Hi,
I have implemented a queue, I was able to create it and attach it in the
list of Connectors (representing a LINK). However when a command is
executed on that queue, it is giving me an SIGSEGV. Here is a snippet of
my tcl code:
$ns simplex-link $node($i) $chan($j) $bandwidth $propdelay dsRED/WDMEdge
set que($i,$j) [[$ns link $node($i) $chan($j)] queue]
$wdmsch addQ $que($i,$j) [$node($i) id] [$chan($j) id]
...
$que($i,$j) meanPktSize $packetSize <<==
this is the command where it is failing, also anyother command on the
queue object also fails. Here is the error message that GDB returned:
Program received signal SIGSEGV, Segmentation fault.
0x216e7c in TclClass::dispatch_cmd () at gen/ptypes.cc:120
120 EmbeddedTcl et_ns_ptypes(code);
++++++++++++++++++++++++++++++++
Here is the C++ queue definition
++++++++++++++++++++++++++++++++
class WDMQueue : public WDMSchedulerStub, public modEdgeQueue {
public:
WDMQueue();
virtual void enque(Packet* p);
virtual Packet* getNextPacket();
virtual void fwdPacket(Packet *p, Handler *h);
int command(int argc, const char*const* argv);
}
+++++++++++
Tcl linkage
+++++++++++
static class WDMQueueClass : public TclClass {
public:
WDMQueueClass() : TclClass("Queue/dsRED/WDMEdge") {};
TclObject* create(int argc, const char*const* argv) {
return (new WDMQueue());
}
} class_wdm_edge_queue;
Any suggestions/comments?
Thanks in Anticipation.
Regards,
Sudhin.
****************** Sudhindra Suresh Bengeri ********************
Graduate Research Assistant | Home: |
to Dr. George N. Rouskas | 2110, Gorman St., |
EGRC 454H, Computer Sci. dept.| Raleigh, NC - 27606 |
NCSU, Raleigh, NC 27695 | Ph. (919) 852-1961 |
(919)515-3655(P) / 515-7925(F)
My web projection: http://www4.ncsu.edu/~ssbenger
* Always glad to share my ignorance - I've got plenty. *