Cross-platformizing MMIO stuff.

MSVC build likely needs some fixes.
This commit is contained in:
Ben Vanik
2014-07-29 22:12:39 -07:00
parent d56ae60460
commit 0129a96225
11 changed files with 651 additions and 176 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -16,5 +16,9 @@ bool IsDebuggerAttached() {
return IsDebuggerPresent() ? true : false;
}
void Break() {
__debugbreak();
}
} // namespace debugging
} // namespace poly

View File

@@ -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>