A Discrete-Event Network Simulator
API
breakpoint.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006,2007 INESC Porto, INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Gustavo Carneiro <gjc@inescporto.pt>
19  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  */
21 #ifndef BREAKPOINT_H
22 #define BREAKPOINT_H
23 
31 namespace ns3 {
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__) && __GNUC__ >= 2
61 # define NS_BREAKPOINT() \
62  do { __asm__ __volatile__ ("int $03"); } while(false)
63 #elif defined (_MSC_VER) && defined (_M_IX86)
64 # define NS_BREAKPOINT() \
65  do { __asm int 3h } while(false)
66 #elif defined (__alpha__) && !defined(__osf__) && defined (__GNUC__) && __GNUC__ >= 2
67 # define NS_BREAKPOINT() \
68  do { __asm__ __volatile__ ("bpt"); } while(false)
69 #else /* !__i386__ && !__alpha__ */
70 # define NS_BREAKPOINT() ns3::BreakpointFallback ()
71 #endif
72 
85 void BreakpointFallback (void);
86 
87 
88 } // namespace ns3
89 
90 
91 #endif /* BREAKPOINT_H */
void BreakpointFallback(void)
fallback breakpoint function
Definition: breakpoint.cc:52
Every class exported by the ns3 library is enclosed in the ns3 namespace.