From f946d7bcdb4d0b4327857d319dd4ecdd1c320d62 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Fri, 15 Apr 2011 10:44:15 -0700 Subject: [PATCH] debug: create a Debug namespace --- src/arch/alpha/ev5.cc | 2 +- src/base/debug.cc | 8 ++++++-- src/base/debug.hh | 6 +++++- src/base/statistics.cc | 2 +- src/cpu/pc_event.cc | 2 +- src/dev/ns_gige.cc | 8 ++++---- src/dev/sinic.cc | 2 +- src/sim/debug.cc | 4 ++-- src/sim/pseudo_inst.cc | 2 +- 9 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/arch/alpha/ev5.cc b/src/arch/alpha/ev5.cc index f97244260..2bc913f92 100644 --- a/src/arch/alpha/ev5.cc +++ b/src/arch/alpha/ev5.cc @@ -289,7 +289,7 @@ ISA::setIpr(int idx, uint64_t val, ThreadContext *tc) case IPR_IPLR: #ifdef DEBUG if (break_ipl != -1 && break_ipl == (int)(val & 0x1f)) - debug_break(); + Debug::breakpoint(); #endif // only write least significant five bits - interrupt level diff --git a/src/base/debug.cc b/src/base/debug.cc index 1d7be5a9a..6f01b3fc0 100644 --- a/src/base/debug.cc +++ b/src/base/debug.cc @@ -35,12 +35,16 @@ #include "base/cprintf.hh" +namespace Debug { + void -debug_break() +breakpoint() { #ifndef NDEBUG kill(getpid(), SIGTRAP); #else - cprintf("debug_break suppressed, compiled with NDEBUG\n"); + cprintf("Debug::breakpoint suppressed, compiled with NDEBUG\n"); #endif } + +} // namespace Debug diff --git a/src/base/debug.hh b/src/base/debug.hh index b1577f782..ee7402912 100644 --- a/src/base/debug.hh +++ b/src/base/debug.hh @@ -31,6 +31,10 @@ #ifndef __BASE_DEBUG_HH__ #define __BASE_DEBUG_HH__ -void debug_break(); +namespace Debug { + +void breakpoint(); + +} // namespace Debug #endif // __BASE_DEBUG_HH__ diff --git a/src/base/statistics.cc b/src/base/statistics.cc index 5ee018b1c..fa3a4a0c9 100644 --- a/src/base/statistics.cc +++ b/src/base/statistics.cc @@ -130,7 +130,7 @@ Info::Info() { id = id_count++; if (debug_break_id >= 0 and debug_break_id == id) - debug_break(); + Debug::breakpoint(); } Info::~Info() diff --git a/src/cpu/pc_event.cc b/src/cpu/pc_event.cc index 40432ed93..0ac5102bb 100644 --- a/src/cpu/pc_event.cc +++ b/src/cpu/pc_event.cc @@ -132,7 +132,7 @@ BreakPCEvent::process(ThreadContext *tc) { StringWrap name(tc->getCpuPtr()->name() + ".break_event"); DPRINTFN("break event %s triggered\n", descr()); - debug_break(); + Debug::breakpoint(); if (remove) delete this; } diff --git a/src/dev/ns_gige.cc b/src/dev/ns_gige.cc index 794fd5355..f1b95e113 100644 --- a/src/dev/ns_gige.cc +++ b/src/dev/ns_gige.cc @@ -937,7 +937,7 @@ NSGigE::cpuIntrPost(Tick when) intrTick = when; if (intrTick < curTick()) { - debug_break(); + Debug::breakpoint(); intrTick = curTick(); } @@ -1705,7 +1705,7 @@ NSGigE::txKick() udp->sum(cksum(udp)); txUdpChecksums++; } else { - debug_break(); + Debug::breakpoint(); warn_once("UDPPKT set, but not UDP!\n"); } } else if (extsts & EXTSTS_TCPPKT) { @@ -1715,7 +1715,7 @@ NSGigE::txKick() tcp->sum(cksum(tcp)); txTcpChecksums++; } else { - debug_break(); + Debug::breakpoint(); warn_once("TCPPKT set, but not UDP!\n"); } } @@ -1725,7 +1725,7 @@ NSGigE::txKick() ip->sum(cksum(ip)); txIpChecksums++; } else { - debug_break(); + Debug::breakpoint(); warn_once("IPPKT set, but not UDP!\n"); } } diff --git a/src/dev/sinic.cc b/src/dev/sinic.cc index 98a2426f5..9141b629c 100644 --- a/src/dev/sinic.cc +++ b/src/dev/sinic.cc @@ -687,7 +687,7 @@ Base::cpuIntrPost(Tick when) intrTick = when; if (intrTick < curTick()) { - debug_break(); + Debug::breakpoint(); intrTick = curTick(); } diff --git a/src/sim/debug.cc b/src/sim/debug.cc index f8a3215d0..e866c13e7 100644 --- a/src/sim/debug.cc +++ b/src/sim/debug.cc @@ -67,14 +67,14 @@ DebugBreakEvent::DebugBreakEvent() void DebugBreakEvent::process() { - debug_break(); + Debug::breakpoint(); } const char * DebugBreakEvent::description() const { - return "debug break"; + return "debug breakpoint"; } // diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc index 65dd7a1a1..3b78cc1ee 100644 --- a/src/sim/pseudo_inst.cc +++ b/src/sim/pseudo_inst.cc @@ -353,7 +353,7 @@ readfile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset) void debugbreak(ThreadContext *tc) { - debug_break(); + Debug::breakpoint(); } void