A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
breakpoint.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006,2007 INRIA, INESC Porto
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 * Author: Gustavo Carneiro <gjc@inescporto.pt>
8 */
9
10#include "breakpoint.h"
11
12#include "log.h"
13
14#include "ns3/core-config.h"
15#ifdef HAVE_SIGNAL_H
16#include <signal.h>
17#endif
18
19namespace ns3
20{
21
22/**
23 * \file
24 * \ingroup breakpoint
25 * ns3::BreakpointFallback function implementation.
26 */
27
28NS_LOG_COMPONENT_DEFINE("Breakpoint");
29
30#if defined(HAVE_SIGNAL_H) && defined(SIGTRAP)
31
32void
34{
36
37 raise(SIGTRAP);
38}
39
40#else
41
42void
44{
46
47 int* a = nullptr;
48 /**
49 * we test here to allow a debugger to change the value of
50 * the variable 'a' to allow the debugger to avoid the
51 * subsequent segfault.
52 */
53 if (a == nullptr)
54 {
55 *a = 0;
56 }
57}
58
59#endif // HAVE_SIGNAL_H
60
61} // namespace ns3
NS_BREAKPOINT() macro definition and ns3::BreakpointFallback function declaration.
void BreakpointFallback()
fallback breakpoint function
Definition breakpoint.cc:43
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
Debug message logging.
Every class exported by the ns3 library is enclosed in the ns3 namespace.