Can I see the event arrivals and handling when I debug it in eclipse?

32 views
Skip to first unread message

zhao yang

unread,
Sep 9, 2016, 2:36:14 AM9/9/16
to ns-3-users
I'm new on event driven simulator. Now I know, I can see the function call with logging  in console, but it is not so direct. Is there some approach that I can see the event stack in eclipse?
When I debug it in eclipse, after  it runs to Simulation::run(), 
the program automatically runs, and I can debug it step by step anymore until Simulation::destroy().
That is, I can't see the process of the simulation.

Any suggestions?

pdbarnes

unread,
Sep 9, 2016, 8:51:28 AM9/9/16
to ns-3-users
In most debuggers there is a command to "step into" a function call. That will take you to the code of the function, enabling you to continue stepping through the execution line by line.

Peter

zhao yang

unread,
Sep 10, 2016, 1:14:05 AM9/10/16
to ns-3-users
However, when I use step into,  the event scheduling process can't be seen. I wonder if stepping into is suitable for such even driven simulator. 

在 2016年9月9日星期五 UTC+8下午2:36:14,zhao yang写道:

Madan Pande

unread,
Sep 10, 2016, 1:44:48 AM9/10/16
to ns-3-...@googlegroups.com

Hi,

        You would need to clarify what you are looking for ...NS-3 is a simulator that provides extensive logging and tracing facilities. Usually they would cover most of your needs. You can trace the execution steps wherever you want...

       If your intention, however, is to debug a code which is giving an exception somewhere at run-time, then using gdb (within eclipse as well) and setting break-points at some places would help you to step through , as well as, to go quickly to the point at which the code bombs... Eclipse provides an extensive set of enablers in its debugging GUI...you can set and remove break-points, watch variables values during the execution and so on. (You would need to make sure that the requisite libraries are loaded ...,viz., as explained in the guide to use Eclipse with NS-3)

         Some of the recent changes in GCC / G++ with newer releases of Unix- variants are also sources of ...say standard headers not in the place where they used to be etc.... but these would give compile time errors and are easily found and the path correctable if so needed...

   I hope this helps...

With Regards,

madan

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

zhao yang

unread,
Sep 10, 2016, 2:36:53 AM9/10/16
to ns-3-users
Thanks, got it.


在 2016年9月9日星期五 UTC+8下午2:36:14,zhao yang写道:
I'm new on event driven simulator. Now I know, I can see the function call with logging  in console, but it is not so direct. Is there some approach that I can see the event stack in eclipse?

pdbarnes

unread,
Sep 14, 2016, 3:31:56 PM9/14/16
to ns-3-users


On Friday, September 9, 2016 at 10:14:05 PM UTC-7, zhao yang wrote:
However, when I use step into,  the event scheduling process can't be seen. I wonder if stepping into is suitable for such even driven simulator. 

Madan's reply gives several good options for general debugging.

If your question is specifically "what happens when I call 'Schedule(...)'?", then you can step into that function call as well.  You'll see the Event object being constructed and added to the Scheduler priority queue, then returning to the call site.  Note this won't show you the launch of the event.

To see the Simulator itself, set a breakpoint in DefaultSimulatorImpl::Run
Peter

zhao yang

unread,
Sep 15, 2016, 11:13:09 PM9/15/16
to ns-3-users
Ok, thanks~

在 2016年9月15日星期四 UTC+8上午3:31:56,pdbarnes写道:
Reply all
Reply to author
Forward
0 new messages