Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(680)

Unified Diff: runtime/vm/debugger.cc

Issue 106593002: Write protect executable pages in the VM. Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/freelist.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger.cc
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index f84dc2e0db20743b28b4ea1770331414d26bbc2e..d182aa6c8fcf9533f499f2aa3ebe07c6c05583b1 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -753,40 +753,40 @@ intptr_t CodeBreakpoint::LineNumber() {
void CodeBreakpoint::PatchCode() {
ASSERT(!is_enabled_);
- switch (breakpoint_kind_) {
- case PcDescriptors::kIcCall: {
- const Code& code =
- Code::Handle(Function::Handle(function_).unoptimized_code());
- saved_bytes_.target_address_ =
- CodePatcher::GetInstanceCallAt(pc_, code, NULL);
- CodePatcher::PatchInstanceCallAt(pc_, code,
- StubCode::BreakpointDynamicEntryPoint());
- break;
- }
- case PcDescriptors::kUnoptStaticCall: {
- const Code& code =
- Code::Handle(Function::Handle(function_).unoptimized_code());
- saved_bytes_.target_address_ =
- CodePatcher::GetStaticCallTargetAt(pc_, code);
- CodePatcher::PatchStaticCallAt(pc_, code,
- StubCode::BreakpointStaticEntryPoint());
- break;
- }
- case PcDescriptors::kRuntimeCall:
- case PcDescriptors::kClosureCall: {
- const Code& code =
- Code::Handle(Function::Handle(function_).unoptimized_code());
- saved_bytes_.target_address_ =
- CodePatcher::GetStaticCallTargetAt(pc_, code);
- CodePatcher::PatchStaticCallAt(pc_, code,
- StubCode::BreakpointRuntimeEntryPoint());
- break;
+ const Code& code =
+ Code::Handle(Function::Handle(function_).unoptimized_code());
+ const Instructions& instrs = Instructions::Handle(code.instructions());
+ {
+ WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
+ switch (breakpoint_kind_) {
+ case PcDescriptors::kIcCall: {
+ saved_bytes_.target_address_ =
+ CodePatcher::GetInstanceCallAt(pc_, code, NULL);
+ CodePatcher::PatchInstanceCallAt(
+ pc_, code, StubCode::BreakpointDynamicEntryPoint());
+ break;
+ }
+ case PcDescriptors::kUnoptStaticCall: {
+ saved_bytes_.target_address_ =
+ CodePatcher::GetStaticCallTargetAt(pc_, code);
+ CodePatcher::PatchStaticCallAt(pc_, code,
+ StubCode::BreakpointStaticEntryPoint());
+ break;
+ }
+ case PcDescriptors::kRuntimeCall:
+ case PcDescriptors::kClosureCall: {
+ saved_bytes_.target_address_ =
+ CodePatcher::GetStaticCallTargetAt(pc_, code);
+ CodePatcher::PatchStaticCallAt(pc_, code,
+ StubCode::BreakpointRuntimeEntryPoint());
+ break;
+ }
+ case PcDescriptors::kReturn:
+ PatchFunctionReturn();
+ break;
+ default:
+ UNREACHABLE();
}
- case PcDescriptors::kReturn:
- PatchFunctionReturn();
- break;
- default:
- UNREACHABLE();
}
is_enabled_ = true;
}
@@ -794,28 +794,32 @@ void CodeBreakpoint::PatchCode() {
void CodeBreakpoint::RestoreCode() {
ASSERT(is_enabled_);
- switch (breakpoint_kind_) {
- case PcDescriptors::kIcCall: {
- const Code& code =
- Code::Handle(Function::Handle(function_).unoptimized_code());
- CodePatcher::PatchInstanceCallAt(pc_, code,
+ const Code& code =
+ Code::Handle(Function::Handle(function_).unoptimized_code());
+ const Instructions& instrs = Instructions::Handle(code.instructions());
+ {
+ WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
+ switch (breakpoint_kind_) {
+ case PcDescriptors::kIcCall: {
+ CodePatcher::PatchInstanceCallAt(pc_, code,
+ saved_bytes_.target_address_);
+ break;
+ }
+ case PcDescriptors::kUnoptStaticCall:
+ case PcDescriptors::kClosureCall:
+ case PcDescriptors::kRuntimeCall: {
+ const Code& code =
+ Code::Handle(Function::Handle(function_).unoptimized_code());
+ CodePatcher::PatchStaticCallAt(pc_, code,
saved_bytes_.target_address_);
- break;
- }
- case PcDescriptors::kUnoptStaticCall:
- case PcDescriptors::kClosureCall:
- case PcDescriptors::kRuntimeCall: {
- const Code& code =
- Code::Handle(Function::Handle(function_).unoptimized_code());
- CodePatcher::PatchStaticCallAt(pc_, code,
- saved_bytes_.target_address_);
- break;
+ break;
+ }
+ case PcDescriptors::kReturn:
+ RestoreFunctionReturn();
+ break;
+ default:
+ UNREACHABLE();
}
- case PcDescriptors::kReturn:
- RestoreFunctionReturn();
- break;
- default:
- UNREACHABLE();
}
is_enabled_ = false;
}
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/freelist.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698