A Discrete-Event Network Simulator
API
breakpoint.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006,2007 INESC Porto, INRIA
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: Gustavo Carneiro <gjc@inescporto.pt>
18  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #ifndef BREAKPOINT_H
21 #define BREAKPOINT_H
22 
30 namespace ns3
31 {
32 
33 /* Hacker macro to place breakpoints for selected machines.
34  * Actual use is strongly discouraged of course ;)
35  * Copied from GLib 2.12.9.
36  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
37  *
38  * Modified by the GLib Team and others 1997-2000. See the AUTHORS
39  * file for a list of people on the GLib Team. See the ChangeLog
40  * files for a list of changes. These files are distributed with
41  * GLib at ftp://ftp.gtk.org/pub/gtk/.
42  */
43 
60 #if (defined(__i386__) || defined(__amd64__) || defined(__x86_64__)) && defined(__GNUC__) && \
61  __GNUC__ >= 2
62 #define NS_BREAKPOINT() \
63  do \
64  { \
65  __asm__ __volatile__("int $03"); \
66  } while (false)
67 #elif defined(_MSC_VER) && defined(_M_IX86)
68 #define NS_BREAKPOINT() \
69  do \
70  { \
71  __asm int 3h \
72  } while (false)
73 #elif defined(__alpha__) && !defined(__osf__) && defined(__GNUC__) && __GNUC__ >= 2
74 #define NS_BREAKPOINT() \
75  do \
76  { \
77  __asm__ __volatile__("bpt"); \
78  } while (false)
79 #else /* !__i386__ && !__alpha__ */
80 #define NS_BREAKPOINT() ns3::BreakpointFallback()
81 #endif
82 
95 void BreakpointFallback();
96 
97 } // namespace ns3
98 
99 #endif /* BREAKPOINT_H */
void BreakpointFallback()
fallback breakpoint function
Definition: breakpoint.cc:54
Every class exported by the ns3 library is enclosed in the ns3 namespace.