author | Gustavo J. A. M. Carneiro <gjc@inescporto.pt> |
Tue, 07 Aug 2007 00:16:13 +0100 | |
changeset 1211 | f96d69ef6038 |
parent 1203 | c225fdfe6de2 |
child 2834 | 1aab57845b07 |
permissions | -rw-r--r-- |
1018
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
2 |
/* |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
3 |
* Copyright (c) 2006,2007 INRIA, INESC Porto |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
4 |
* All rights reserved. |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
5 |
* |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
7 |
* it under the terms of the GNU General Public License version 2 as |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation; |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
9 |
* |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
13 |
* GNU General Public License for more details. |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
14 |
* |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
18 |
* |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
19 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
20 |
* Author: Gustavo Carneiro <gjc@inescporto.pt> |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
21 |
*/ |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
22 |
|
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
23 |
#include "breakpoint.h" |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
24 |
#include "ns3/core-config.h" |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
25 |
#ifdef HAVE_SIGNAL_H |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
26 |
# include <signal.h> |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
27 |
#endif |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
28 |
|
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
29 |
namespace ns3 { |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
30 |
|
1211
f96d69ef6038
Fix compilation of BreakpointFallback on win32/mingw, which has signal.h but does not define SIGTRAP.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1203
diff
changeset
|
31 |
#if defined (HAVE_SIGNAL_H) && defined (SIGTRAP) |
1018
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
32 |
|
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
33 |
void |
1203
c225fdfe6de2
Correct misspelled BreakpointFallback function implementation; fixes OS X build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1018
diff
changeset
|
34 |
BreakpointFallback (void) |
1018
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
35 |
{ |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
36 |
raise (SIGTRAP); |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
37 |
} |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
38 |
|
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
39 |
#else |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
40 |
|
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
41 |
void |
1203
c225fdfe6de2
Correct misspelled BreakpointFallback function implementation; fixes OS X build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
1018
diff
changeset
|
42 |
BreakpointFallback (void) |
1018
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
43 |
{ |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
44 |
int *a = 0; |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
45 |
/** |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
46 |
* we test here to allow a debugger to change the value of |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
47 |
* the variable 'a' to allow the debugger to avoid the |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
48 |
* subsequent segfault. |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
49 |
*/ |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
50 |
if (a == 0) |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
51 |
{ |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
52 |
*a = 0; |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
53 |
} |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
54 |
} |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
55 |
|
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
56 |
#endif // HAVE_SIGNAL_H |
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
57 |
|
99476ef5580a
Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
58 |
}//namespace ns3 |