Bug 269

Summary: Infinite recursion when NS_LOG=*=level_all|prefix_func|prefix_time
Product: ns-3 Reporter: Christos <cgavos>
Component: coreAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: cgavos
Priority: P1    
Version: pre-release   
Hardware: All   
OS: All   

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