debug: create a Debug namespace
This commit is contained in:
parent
bbb1392c08
commit
f946d7bcdb
9 changed files with 22 additions and 14 deletions
|
@ -289,7 +289,7 @@ ISA::setIpr(int idx, uint64_t val, ThreadContext *tc)
|
||||||
case IPR_IPLR:
|
case IPR_IPLR:
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (break_ipl != -1 && break_ipl == (int)(val & 0x1f))
|
if (break_ipl != -1 && break_ipl == (int)(val & 0x1f))
|
||||||
debug_break();
|
Debug::breakpoint();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// only write least significant five bits - interrupt level
|
// only write least significant five bits - interrupt level
|
||||||
|
|
|
@ -35,12 +35,16 @@
|
||||||
|
|
||||||
#include "base/cprintf.hh"
|
#include "base/cprintf.hh"
|
||||||
|
|
||||||
|
namespace Debug {
|
||||||
|
|
||||||
void
|
void
|
||||||
debug_break()
|
breakpoint()
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
kill(getpid(), SIGTRAP);
|
kill(getpid(), SIGTRAP);
|
||||||
#else
|
#else
|
||||||
cprintf("debug_break suppressed, compiled with NDEBUG\n");
|
cprintf("Debug::breakpoint suppressed, compiled with NDEBUG\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Debug
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
#ifndef __BASE_DEBUG_HH__
|
#ifndef __BASE_DEBUG_HH__
|
||||||
#define __BASE_DEBUG_HH__
|
#define __BASE_DEBUG_HH__
|
||||||
|
|
||||||
void debug_break();
|
namespace Debug {
|
||||||
|
|
||||||
|
void breakpoint();
|
||||||
|
|
||||||
|
} // namespace Debug
|
||||||
|
|
||||||
#endif // __BASE_DEBUG_HH__
|
#endif // __BASE_DEBUG_HH__
|
||||||
|
|
|
@ -130,7 +130,7 @@ Info::Info()
|
||||||
{
|
{
|
||||||
id = id_count++;
|
id = id_count++;
|
||||||
if (debug_break_id >= 0 and debug_break_id == id)
|
if (debug_break_id >= 0 and debug_break_id == id)
|
||||||
debug_break();
|
Debug::breakpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info::~Info()
|
Info::~Info()
|
||||||
|
|
|
@ -132,7 +132,7 @@ BreakPCEvent::process(ThreadContext *tc)
|
||||||
{
|
{
|
||||||
StringWrap name(tc->getCpuPtr()->name() + ".break_event");
|
StringWrap name(tc->getCpuPtr()->name() + ".break_event");
|
||||||
DPRINTFN("break event %s triggered\n", descr());
|
DPRINTFN("break event %s triggered\n", descr());
|
||||||
debug_break();
|
Debug::breakpoint();
|
||||||
if (remove)
|
if (remove)
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -937,7 +937,7 @@ NSGigE::cpuIntrPost(Tick when)
|
||||||
|
|
||||||
intrTick = when;
|
intrTick = when;
|
||||||
if (intrTick < curTick()) {
|
if (intrTick < curTick()) {
|
||||||
debug_break();
|
Debug::breakpoint();
|
||||||
intrTick = curTick();
|
intrTick = curTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1705,7 +1705,7 @@ NSGigE::txKick()
|
||||||
udp->sum(cksum(udp));
|
udp->sum(cksum(udp));
|
||||||
txUdpChecksums++;
|
txUdpChecksums++;
|
||||||
} else {
|
} else {
|
||||||
debug_break();
|
Debug::breakpoint();
|
||||||
warn_once("UDPPKT set, but not UDP!\n");
|
warn_once("UDPPKT set, but not UDP!\n");
|
||||||
}
|
}
|
||||||
} else if (extsts & EXTSTS_TCPPKT) {
|
} else if (extsts & EXTSTS_TCPPKT) {
|
||||||
|
@ -1715,7 +1715,7 @@ NSGigE::txKick()
|
||||||
tcp->sum(cksum(tcp));
|
tcp->sum(cksum(tcp));
|
||||||
txTcpChecksums++;
|
txTcpChecksums++;
|
||||||
} else {
|
} else {
|
||||||
debug_break();
|
Debug::breakpoint();
|
||||||
warn_once("TCPPKT set, but not UDP!\n");
|
warn_once("TCPPKT set, but not UDP!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1725,7 +1725,7 @@ NSGigE::txKick()
|
||||||
ip->sum(cksum(ip));
|
ip->sum(cksum(ip));
|
||||||
txIpChecksums++;
|
txIpChecksums++;
|
||||||
} else {
|
} else {
|
||||||
debug_break();
|
Debug::breakpoint();
|
||||||
warn_once("IPPKT set, but not UDP!\n");
|
warn_once("IPPKT set, but not UDP!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -687,7 +687,7 @@ Base::cpuIntrPost(Tick when)
|
||||||
|
|
||||||
intrTick = when;
|
intrTick = when;
|
||||||
if (intrTick < curTick()) {
|
if (intrTick < curTick()) {
|
||||||
debug_break();
|
Debug::breakpoint();
|
||||||
intrTick = curTick();
|
intrTick = curTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,14 +67,14 @@ DebugBreakEvent::DebugBreakEvent()
|
||||||
void
|
void
|
||||||
DebugBreakEvent::process()
|
DebugBreakEvent::process()
|
||||||
{
|
{
|
||||||
debug_break();
|
Debug::breakpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
DebugBreakEvent::description() const
|
DebugBreakEvent::description() const
|
||||||
{
|
{
|
||||||
return "debug break";
|
return "debug breakpoint";
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -353,7 +353,7 @@ readfile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset)
|
||||||
void
|
void
|
||||||
debugbreak(ThreadContext *tc)
|
debugbreak(ThreadContext *tc)
|
||||||
{
|
{
|
||||||
debug_break();
|
Debug::breakpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue