src/core/model/breakpoint.cc
author Tom Henderson <tomh@tomh.org>
Sun, 22 May 2011 22:28:15 -0700
changeset 7252 c8200621e252
parent 7169 358f71a624d8
child 7386 2310ed220a61
permissions -rw-r--r--
rerun check-style.py with uncrustify-0.58
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
 *
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     5
 * 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
     6
 * 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
     7
 * published by the Free Software Foundation;
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     8
 *
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
     9
 * 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
    10
 * 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
    11
 * 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
    12
 * GNU General Public License for more details.
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    13
 *
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    14
 * 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
    15
 * 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
    16
 * 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
    17
 *
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    19
 * Author: Gustavo Carneiro <gjc@inescporto.pt>
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    20
 */
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
#include "breakpoint.h"
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    23
#include "ns3/core-config.h"
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    24
#ifdef HAVE_SIGNAL_H
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    25
# include <signal.h>
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    26
#endif
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    27
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    28
namespace ns3 {
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    29
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
    30
#if defined (HAVE_SIGNAL_H) && defined (SIGTRAP)
1018
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    31
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    32
void
1203
c225fdfe6de2 Correct misspelled BreakpointFallback function implementation; fixes OS X build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1018
diff changeset
    33
BreakpointFallback (void)
1018
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    34
{
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    35
  raise (SIGTRAP);
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    36
}
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
#else
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    39
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    40
void
1203
c225fdfe6de2 Correct misspelled BreakpointFallback function implementation; fixes OS X build.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 1018
diff changeset
    41
BreakpointFallback (void)
1018
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    42
{
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    43
  int *a = 0;
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    44
  /**
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    45
   * 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
    46
   * 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
    47
   * subsequent segfault.
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    48
   */
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    49
  if (a == 0)
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    50
    {
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    51
      *a = 0;
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    52
    }
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
#endif // HAVE_SIGNAL_H
99476ef5580a Bug #7: Better breakpoints.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff changeset
    56
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
    57
} //namespace ns3