[Ns-developers] debugging ns-3 bindings problems

Gustavo Carneiro gjcarneiro at gmail.com
Thu May 28 08:01:50 PDT 2009


2009/5/28 Tom Henderson <tomh at tomh.org>

>
>
>> True, the method is declared virtual, but is being ignored by pybindgen:
>>
>>   ../bindings/python/ns3_module_node.py:2852:
>> TypeLookupError(['ns3::Socket::SocketErrno &'],)
>>
>> Why this "ns3::Socket::SocketErrno &" type is being rejected by pybindgen
>> I do not know.  Sounds like a bug.  I am looking into it.  Sorry about
>> that...
>>
>>
> OK, thanks for looking into this, but I am also wondering in general
> whether there is a way to increase verbosity in pybindgen logging, or
> whether it is already at the maximum.


pybindgen has no log levels, this is all there is.


>  By the way, the other missing virtual function has similar type error:
>
> ../bindings/python/ns3_module_node.py:2852:
> TypeLookupError(['ns3::Socket::SocketErrno &'],)
> ../bindings/python/ns3_module_node.py:2857:
> TypeLookupError(['ns3::Callback< void, ns3::Ptr< ns3::Ipv4Route >, ns3::Ptr<
> ns3::Packet const >, ns3::Ipv4Header const &, ns3::empty, ns3::empty,
> ns3::empty, ns3::empty, ns3::empty, ns3::empty >'],)
>
> but these TypeLookupErrors seem fairly common (I counted 93 instances in
> the log) so I wasn't sure whether this was the real issue.


Yes, they're fairly common.  Generating code to wrap C++ is _hard_.  I try
to give a warning every time it fails, but ultimately Python coverage will
never be 100%.  That is expected.


>
>
> Another question I had when looking into this was why two similar abstract
> base classes (Ipv4ListRouting and Ipv4StaticRouting) generated different
> pybindgen error statements:
>
> ??:??: <pybindgen.CppClass 'ns3::Ipv4ListRouting'> /
> CodeGenerationError('ns3::Ipv4ListRouting cannot be constructed (have pure
> virtual methods but no helper class)',)
>
> ??:??: <pybindgen.CppClass 'ns3::Ipv4StaticRouting'> /
> CodeGenerationError('ns3::Ipv4StaticRouting cannot be constructed (class has
> pure virtual methods)',)
>
> What causes this distinction?  (that one of the classes has the "but no
> helper class" log message)?  The abstract base classes in ns-3 all seem to
> generate one or the other of these messages, but I couldn't figure out what
> determines which error statement to be outputted.
>

To be perfectly honest, I don't remember the distinction anymore :P  I'd
have to study the relevant code again to recall these details.

I realize it is very hard for you to debug these problems, and that's why I
take responsibility to fix myself the serious bugs in a timely fashion.  I
can't do any serious refactoring in pybindgen at the moment due to lack of
time, I'm afraid.

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list