Cross-platformizing MMIO stuff.
MSVC build likely needs some fixes.
This commit is contained in:
@@ -23,6 +23,10 @@ namespace debugging {
|
||||
// though, so avoid calling it frequently.
|
||||
bool IsDebuggerAttached();
|
||||
|
||||
// Breaks into the debugger if it is attached.
|
||||
// If no debugger is present, a signal will be raised.
|
||||
void Break();
|
||||
|
||||
} // namespace debugging
|
||||
} // namespace poly
|
||||
|
||||
|
||||
@@ -25,5 +25,11 @@ bool IsDebuggerAttached() {
|
||||
return (info.kp_proc.p_flag & P_TRACED) != 0;
|
||||
}
|
||||
|
||||
// TODO(benvanik): find a more reliable way.
|
||||
void Break() {
|
||||
// __asm__("int $3");
|
||||
__builtin_debugtrap();
|
||||
}
|
||||
|
||||
} // namespace debugging
|
||||
} // namespace poly
|
||||
|
||||
@@ -16,5 +16,9 @@ bool IsDebuggerAttached() {
|
||||
return IsDebuggerPresent() ? true : false;
|
||||
}
|
||||
|
||||
void Break() {
|
||||
__debugbreak();
|
||||
}
|
||||
|
||||
} // namespace debugging
|
||||
} // namespace poly
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <poly/byte_order.h>
|
||||
#include <poly/config.h>
|
||||
#include <poly/cxx_compat.h>
|
||||
#include <poly/debugging.h>
|
||||
#include <poly/math.h>
|
||||
#include <poly/memory.h>
|
||||
#include <poly/platform.h>
|
||||
|
||||
Reference in New Issue
Block a user