[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ns] target_ is (NSObject *)0x0
Thanks Scooter,
I've figured out the bug...
The agent was initilized by mistake :(
Cheers,
Lee
On Sun, 14 Jan 2001, Scott Michel wrote:
> FWIW, my guess is that there is an intermediate node somewhere
> in your sim that doesn't have an agent attached to the node.
>
> Also, you might want to dump the agent's dest address and port
> fields to see if they are properly (not randomly) initialized.
> Alternatively, you might also dump the dest of the packet you're
> sending to insure that the packet's dest is legit.
>
> I hacked config.h to provide a default ctor for ns_addr_t so
> that these would be readily obvious to me when I did something
> totally dippy, like not connecting an agent to a destination.
> (Patch follows at end of message)
>
>
>
> -scooter
>
> On Sat, Jan 13, 2001 at 11:59:08PM -0700, Lee wrote:
> >
> > Actually, I print out the values in TCL, as follows,
> >
> > _o305 attached to 1 with target _o18
> > _o306 attached to 2 with target _o24
> > _o307 attached to 3 with target _o30
> > _o308 attached to 5 with target _o42
> > _o309 attached to 4 with target _o36
> >
> > in the format
> > "$agent attached to [$self id] with target $target_ [$self entry]"
> > (it is in ns-node.tcl add-target)
> >
> > It says that the target_ is not 0x0, it should be the entry of the node
> > (there is $agent target [$self entry] above)
> >
> > However, in C++, it becomes 0x0.
> >
> > On Sat, 13 Jan 2001, Lee wrote:
> >
> > >
> > > Hello,
> > >
> > > I got a Segmentation Fault. target_ of some agent is (NSObject *)0x0.
> > > I guess there is something wrong with attaching the agent.
> > > (However I do use attach-agent to do that.)
> > > Would you like to tell me, generally,
> > > what is the possible reason for that?
> > > Thanks.
> > >
> > > Have a good time,
> > > Lee
>
> Index: config.h
> ===================================================================
> RCS file: /work/repo/scottm/ns/config.h,v
> retrieving revision 1.1.1.2
> retrieving revision 1.10
> diff -u -r1.1.1.2 -r1.10
> --- config.h 2000/11/28 20:44:56 1.1.1.2
> +++ config.h 2001/01/04 19:46:46 1.10
> @@ -54,6 +54,10 @@
> #include "autoconf.h"
> #endif
>
> +/* iostream, for ns_addr_t serialization */
> +
> +#include <iostream>
> +
> /* after autoconf (and HAVE_INT64) we can pick up tclcl.h */
> #ifndef stand_alone
> #ifdef __cplusplus
> @@ -77,16 +108,33 @@
> int32_t addr_;
> int32_t port_;
> #ifdef __cplusplus
> + // It's nice to have ctors in C++, no?
> +
> + ns_addr_t() : addr_(-1), port_(-1)
> + { }
> +
> + ns_addr_t(nsaddr_t addr, nsaddr_t port) : addr_(addr), port_(port)
> + { }
> +
> ns_addr_t& operator= (const ns_addr_t& n) {
> addr_ = n.addr_;
> port_ = n.port_;
> return (*this);
> }
> - int operator== (const ns_addr_t& n) {
> + bool operator== (const ns_addr_t& n) const {
> return ((addr_ == n.addr_) && (port_ == n.port_));
> }
> + bool operator!= (const ns_addr_t& n) const {
> + return !operator==(n);
> + }
> #endif // __cplusplus
> };
> +
> +
> +// Generally useful
> +
> +istream &operator>>(istream &is, ns_addr_t &addr);
> +ostream &operator<<(ostream &os, const ns_addr_t &addr);
>
> // 64-bit integer support
> #if defined(SIZEOF_LONG) && SIZEOF_LONG >= 8
>