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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 * Author: Gustavo Carneiro <gjc@inescporto.pt>
19 */
20
21#include "breakpoint.h"
22
23#include "log.h"
24
25#include "ns3/core-config.h"
26#ifdef HAVE_SIGNAL_H
27#include <signal.h>
28#endif
29
30namespace ns3
31{
32
33/**
34 * \file
35 * \ingroup breakpoint
36 * ns3::BreakpointFallback function implementation.
37 */
38
39NS_LOG_COMPONENT_DEFINE("Breakpoint");
40
41#if defined(HAVE_SIGNAL_H) && defined(SIGTRAP)
42
43void
45{
47
48 raise(SIGTRAP);
49}
50
51#else
52
53void
55{
57
58 int* a = nullptr;
59 /**
60 * we test here to allow a debugger to change the value of
61 * the variable 'a' to allow the debugger to avoid the
62 * subsequent segfault.
63 */
64 if (a == nullptr)
65 {
66 *a = 0;
67 }
68}
69
70#endif // HAVE_SIGNAL_H
71
72} // namespace ns3
NS_BREAKPOINT() macro definition and ns3::BreakpointFallback function declaration.
void BreakpointFallback()
fallback breakpoint function
Definition: breakpoint.cc:54
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#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.