From 1f86e826e5e95e84dbdd1455b3203ff7708d47d4 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 29 Jul 2008 11:19:16 -0700 Subject: [PATCH] bug 264: NS_BREAKPOINT never stops the debugger at the right location. --- src/core/assert.h | 13 ++++++------- src/core/fatal-error.h | 11 ++++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/core/assert.h b/src/core/assert.h index 3dadf537c..235ad9db1 100644 --- a/src/core/assert.h +++ b/src/core/assert.h @@ -24,8 +24,6 @@ #include -#include "breakpoint.h" - /** * \ingroup core * \defgroup debugging Debugging @@ -49,8 +47,7 @@ * * At runtime, in debugging builds, if this condition is not * true, the program prints the source file, line number and - * unverified condition and halts in the ns3::AssertBreakpoint - * function. + * unverified condition and halts by dereferencing a null pointer. */ #define NS_ASSERT(condition) \ do \ @@ -60,7 +57,8 @@ std::cerr << "assert failed. file=" << __FILE__ << \ ", line=" << __LINE__ << ", cond=\""#condition << \ "\"" << std::endl; \ - NS_BREAKPOINT (); \ + int *a = 0; \ + *a = 0; \ } \ } \ while (false) @@ -73,7 +71,7 @@ * * At runtime, in debugging builds, if this condition is not * true, the program prints the message to output and - * halts in the ns3::AssertBreakpoint function. + * halts by dereferencing a null pointer. */ #define NS_ASSERT_MSG(condition, message) \ do \ @@ -81,7 +79,8 @@ if (!(condition)) \ { \ std::cerr << message << std::endl; \ - NS_BREAKPOINT (); \ + int *a = 0; \ + *a = 0; \ } \ } \ while (false) diff --git a/src/core/fatal-error.h b/src/core/fatal-error.h index 8e896cf2f..05711780c 100644 --- a/src/core/fatal-error.h +++ b/src/core/fatal-error.h @@ -20,7 +20,6 @@ #ifndef FATAL_ERROR_H #define FATAL_ERROR_H -#include "breakpoint.h" #include /** @@ -30,15 +29,17 @@ * \param msg message to output when this macro is hit. * * When this macro is hit at runtime, the user-specified - * error message is output and the program is halted by calling - * the NS_BREAKPOINT macro. This macro is enabled unconditionally - * in all builds, including debug and optimized builds. + * error message is output and the program is halted by + * dereferencing a null pointer. This macro is enabled + * unconditionally in all builds, including debug and + * optimized builds. */ #define NS_FATAL_ERROR(msg) \ do \ { \ std::cerr << msg << std::endl; \ - NS_BREAKPOINT (); \ + int *a = 0; \ + *a = 0; \ } \ while (false)