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

Unified Diff: runtime/vm/debugger_dbc.cc

Issue 2194493002: DBC: Fix not-stopping/crashing at fast Smi op breakpoints. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: year Created 4 years, 5 months 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/debugger.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger_dbc.cc
diff --git a/runtime/vm/debugger_dbc.cc b/runtime/vm/debugger_dbc.cc
index 5f82cd5368a10a3456def0225c9684c30ca2cadf..b4b6c1f059f85e3019f9aa94e08208906cef6e96 100644
--- a/runtime/vm/debugger_dbc.cc
+++ b/runtime/vm/debugger_dbc.cc
@@ -25,6 +25,11 @@ static Instr* CallInstructionFromReturnAddress(uword pc) {
}
+static Instr* FastSmiInstructionFromReturnAddress(uword pc) {
+ return reinterpret_cast<Instr*>(pc) - 2;
+}
+
+
void CodeBreakpoint::PatchCode() {
ASSERT(!is_enabled_);
const Code& code = Code::Handle(code_);
@@ -54,6 +59,17 @@ void CodeBreakpoint::PatchCode() {
default:
UNREACHABLE();
}
+
+ // If this call is the fall-through for a fast Smi op, also disable the fast
+ // Smi op.
+ if ((Bytecode::DecodeOpcode(saved_value_) == Bytecode::kInstanceCall2) &&
+ Bytecode::IsFastSmiOpcode(*FastSmiInstructionFromReturnAddress(pc_))) {
+ saved_value_fastsmi_ = *FastSmiInstructionFromReturnAddress(pc_);
+ *FastSmiInstructionFromReturnAddress(pc_) =
+ Bytecode::Encode(Bytecode::kNop, 0, 0, 0);
+ } else {
+ saved_value_fastsmi_ = Bytecode::kTrap;
+ }
}
is_enabled_ = true;
}
@@ -75,6 +91,12 @@ void CodeBreakpoint::RestoreCode() {
default:
UNREACHABLE();
}
+
+ if (saved_value_fastsmi_ != Bytecode::kTrap) {
+ Instr current_instr = *FastSmiInstructionFromReturnAddress(pc_);
+ ASSERT(Bytecode::DecodeOpcode(current_instr) == Bytecode::kNop);
+ *FastSmiInstructionFromReturnAddress(pc_) = saved_value_fastsmi_;
+ }
}
is_enabled_ = false;
}
« no previous file with comments | « runtime/vm/debugger.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698