bug 264: NS_BREAKPOINT never stops the debugger at the right location.

This commit is contained in:
Mathieu Lacage
2008-07-29 11:19:16 -07:00
parent 5857618635
commit 1f86e826e5
2 changed files with 12 additions and 12 deletions

View File

@@ -24,8 +24,6 @@
#include <iostream>
#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)

View File

@@ -20,7 +20,6 @@
#ifndef FATAL_ERROR_H
#define FATAL_ERROR_H
#include "breakpoint.h"
#include <iostream>
/**
@@ -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)