View | Details | Raw Unified | Return to bug 7
Collapse All | Expand All

(-)a/SConstruct (+6 lines)
 Lines 57-62   def config_core (env, config): Link Here 
57
    else:
57
    else:
58
        retval.append ('#undef HAVE_STDLIB_H')
58
        retval.append ('#undef HAVE_STDLIB_H')
59
        retval.append ('#undef HAVE_GETENV')
59
        retval.append ('#undef HAVE_GETENV')
60
61
    if config.CheckCHeader ('signal.h') == 1:
62
        retval.append ('#define HAVE_SIGNAL_H 1')
63
    else:
64
        retval.append ('#undef HAVE_SIGNAL_H')
65
60
    return retval
66
    return retval
61
core.add_config (config_core)
67
core.add_config (config_core)
62
68
(-)a/src/core/assert.cc (+16 lines)
 Lines 20-27    Link Here 
20
 */
20
 */
21
21
22
#include "assert.h"
22
#include "assert.h"
23
#include "ns3/core-config.h"
24
#ifdef HAVE_SIGNAL_H
25
# include <signal.h>
26
#endif
23
27
24
namespace ns3 {
28
namespace ns3 {
29
30
#ifdef HAVE_SIGNAL_H
31
32
void
33
AssertBreakpoint (void)
34
{
35
  raise (SIGTRAP);
36
}
37
38
#else
25
39
26
void
40
void
27
AssertBreakpoint (void)
41
AssertBreakpoint (void)
 Lines 38-41   AssertBreakpoint (void) Link Here 
38
    }
52
    }
39
}
53
}
40
54
55
#endif // HAVE_SIGNAL_H
56
41
}//namespace ns3
57
}//namespace ns3
(-)a/src/core/debug.h (+31 lines)
 Lines 137-140   private: Link Here 
137
137
138
#endif /* NS3_DEBUG_ENABLE */
138
#endif /* NS3_DEBUG_ENABLE */
139
139
140
141
/* Hacker macro to place breakpoints for selected machines.
142
 * Actual use is strongly discouraged of course ;)
143
 * Copied from GLib 2.12.9.
144
 * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
145
 *
146
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
147
 * file for a list of people on the GLib Team.  See the ChangeLog
148
 * files for a list of changes.  These files are distributed with
149
 * GLib at ftp://ftp.gtk.org/pub/gtk/. 
150
 */
151
152
/**
153
 * \ingroup debugging
154
 *
155
 * Inserts a breakpoint instruction (or equivalent system call) into
156
 * the code for selected machines.
157
 */
158
#if (defined (__i386__) || defined (__x86_64__)) && defined (__GNUC__) && __GNUC__ >= 2
159
#  define NS_DEBUG_BREAKPOINT() \
160
   do{ __asm__ __volatile__ ("int $03"); }while(false)
161
#elif defined (_MSC_VER) && defined (_M_IX86)
162
#  define NS_DEBUG_BREAKPOINT() \
163
   do{ __asm int 3h }while(false)
164
#elif defined (__alpha__) && !defined(__osf__) && defined (__GNUC__) && __GNUC__ >= 2
165
#  define NS_DEBUG_BREAKPOINT() \
166
   do{ __asm__ __volatile__ ("bpt"); }while(false)
167
#else	/* !__i386__ && !__alpha__ */
168
#  define NS_DEBUG_BREAKPOINT()    ns3::AssertBreakpoint ()
169
#endif
170
140
#endif /* DEBUG_H */
171
#endif /* DEBUG_H */
(-)a/src/core/fatal-error.h (-2 / +2 lines)
 Lines 31-37    Link Here 
31
 *
31
 *
32
 * When this macro is hit at runtime, the user-specified 
32
 * When this macro is hit at runtime, the user-specified 
33
 * error message is output and the program is halted by calling
33
 * error message is output and the program is halted by calling
34
 * the ns3::AssertBreakpoint function. This macro is enabled
34
 * the NS_DEBUG_BREAKPOINT macro. This macro is enabled
35
 * unconditionally in all builds, including debug and optimized 
35
 * unconditionally in all builds, including debug and optimized 
36
 * builds.
36
 * builds.
37
 */
37
 */
 Lines 39-45    Link Here 
39
  do                                                    \
39
  do                                                    \
40
    {                                                   \
40
    {                                                   \
41
      std::cout << msg << std::endl;			\
41
      std::cout << msg << std::endl;			\
42
      ns3::AssertBreakpoint ();                         \
42
      NS_DEBUG_BREAKPOINT ();                           \
43
    }                                                   \
43
    }                                                   \
44
  while (false)
44
  while (false)
45
45

Return to bug 7