Bug 269 - Infinite recursion when NS_LOG=*=level_all|prefix_func|prefix_time
Infinite recursion when NS_LOG=*=level_all|prefix_func|prefix_time
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
pre-release
All All
: P1 minor
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-03 06:17 UTC by Christos
Modified: 2008-08-03 12:04 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christos 2008-08-03 06:17:51 UTC
When NS_LOG is set to '*=level_all|prefix_func|prefix_time' infinite recursion occurs until the program crashes. Simulator::Now calls NS_LOG_FUNCTION_NOARGS which in turn calls Simulator::Now. The same happens for Simulator::GetImpl. This was introduced in revision 3469:9e763021e045.

Commenting out the following lines solves the problem.

diff -r 794671c6a8a1 src/simulator/simulator.cc
--- a/src/simulator/simulator.cc	Fri Aug 01 23:15:00 2008 +0100
+++ b/src/simulator/simulator.cc	Sun Aug 03 11:13:44 2008 +0100
@@ -67,7 +67,7 @@
 SimulatorImpl *
 Simulator::GetImpl (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  //NS_LOG_FUNCTION_NOARGS ();
 
   if (m_impl == 0) 
     {
@@ -90,7 +90,7 @@
 //
       LogSetTimePrinter (&TimePrinter);
     }
-  NS_LOG_LOGIC ("priv " << m_impl);
+  //NS_LOG_LOGIC ("priv " << m_impl);
   return PeekPointer (m_impl);
 }
 
@@ -162,7 +162,7 @@
 Time
 Simulator::Now (void)
 {
-  NS_LOG_FUNCTION_NOARGS ();
+  //NS_LOG_FUNCTION_NOARGS ();
   return GetImpl ()->Now ();
 }
Comment 1 Mathieu Lacage 2008-08-03 12:04:52 UTC
changeset b8cccd54da26