[ndnSIM] Compilng error during the usage of "name.toUri()"
Alex Afanasyev
aa at CS.UCLA.EDU
Sun Nov 20 22:17:55 PST 2016
> On Nov 20, 2016, at 10:15 PM, ZHANG, Lu <lu.zhang at fuji.waseda.jp> wrote:
>
> Hi all,
>
> I would like to print out the prefix name in PIT on to screen by using the toUri() function in Name class. The topology is simple as below:
>
>
> * +----------+ 10Mbps +--------+ 10Mbps +----------+
> * | consumer | <------------> | router | <------------> | producer |
> * +----------+ 10ms +--------+ 10ms +----------+
> *
>
>
> Part of my program is like below:
>
> Ptr<ndn::Pit> pit = nodes.Get(1)->GetObject<ndn::Pit> ();
> Ptr<ndn::pit::Entry> entry = pit->Find(ns3::ndn::Name("/prefix"));
> ns3::ndn::Name name = entry-> GetPrefix();
> name.toUri();
>
> When executing compile command ./waf --run 1 --vis I got below output:
>
> Command ['/home/11/ndnSIM/ns-3/build/scratch/1', '--SimulatorImplementationType=ns3::VisualSimulatorImpl'] terminated with signal SIGSEGV. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").
>
> Any one have clue on why this happens or how should I use the toUri() function?
You can check to run the scenario in the debugger using the suggested command, but I would suspect that you're simply getting a segfault because there is no "/prefix" entry in the PIT (Find returns NULL and then you're dereferencing NULL).
---
Alex
More information about the ndnSIM
mailing list