--break_on_debugbreak

This commit is contained in:
Ben Vanik 2015-02-01 11:38:16 -08:00
parent f60677f359
commit 5f3ab7979f
3 changed files with 6 additions and 1 deletions

View File

@ -19,5 +19,6 @@ DECLARE_bool(validate_hir);
DECLARE_uint64(break_on_instruction); DECLARE_uint64(break_on_instruction);
DECLARE_uint64(break_on_memory); DECLARE_uint64(break_on_memory);
DECLARE_bool(break_on_debugbreak);
#endif // ALLOY_ALLOY_PRIVATE_H_ #endif // ALLOY_ALLOY_PRIVATE_H_

View File

@ -32,3 +32,4 @@ DEFINE_uint64(break_on_instruction, 0,
"int3 before the given guest address is executed."); "int3 before the given guest address is executed.");
DEFINE_uint64(break_on_memory, 0, DEFINE_uint64(break_on_memory, 0,
"int3 on read/write to the given memory address."); "int3 on read/write to the given memory address.");
DEFINE_bool(break_on_debugbreak, true, "int3 on JITed __debugbreak requests.");

View File

@ -9,6 +9,7 @@
#include "alloy/backend/x64/x64_emitter.h" #include "alloy/backend/x64/x64_emitter.h"
#include "alloy/alloy-private.h"
#include "alloy/backend/x64/x64_backend.h" #include "alloy/backend/x64/x64_backend.h"
#include "alloy/backend/x64/x64_code_cache.h" #include "alloy/backend/x64/x64_code_cache.h"
#include "alloy/backend/x64/x64_function.h" #include "alloy/backend/x64/x64_function.h"
@ -371,7 +372,9 @@ void X64Emitter::Trap(uint16_t trap_type) {
case 22: case 22:
// Always trap? // Always trap?
// TODO(benvanik): post software interrupt to debugger. // TODO(benvanik): post software interrupt to debugger.
if (FLAGS_break_on_debugbreak) {
db(0xCC); db(0xCC);
}
break; break;
default: default:
PLOGW("Unknown trap type %d", trap_type); PLOGW("Unknown trap type %d", trap_type);