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

Unified Diff: runtime/vm/debugger_ia32.cc

Issue 9484002: StepOver, StepInto, StepOut (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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_arm.cc ('k') | runtime/vm/debugger_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger_ia32.cc
===================================================================
--- runtime/vm/debugger_ia32.cc (revision 4638)
+++ runtime/vm/debugger_ia32.cc (working copy)
@@ -8,6 +8,8 @@
#include "vm/debugger.h"
#include "vm/code_patcher.h"
+#include "vm/cpu.h"
+#include "vm/disassembler.h"
#include "vm/object.h"
#include "vm/os.h"
#include "vm/stack_frame.h"
@@ -22,6 +24,45 @@
*reinterpret_cast<uword*>(var_address));
}
+
+RawInstance* ActivationFrame::GetInstanceCallReceiver(
+ intptr_t num_actual_args) {
+ ASSERT(num_actual_args > 0); // At minimum we have a receiver on the stack.
+ // Stack pointer points to last argument that was pushed on the stack.
+ uword receiver_addr = sp() + ((num_actual_args - 1) * kWordSize);
+ return reinterpret_cast<RawInstance*>(
+ *reinterpret_cast<uword*>(receiver_addr));
+}
+
+
+void Breakpoint::PatchFunctionReturn() {
+ uint8_t* code = reinterpret_cast<uint8_t*>(pc_ - 5);
+ ASSERT((code[0] == 0x89) && (code[1] == 0xEC)); // mov esp,ebp
+ ASSERT(code[2] == 0x5D); // pop ebp
+ ASSERT(code[3] == 0xC3); // ret
+ ASSERT(code[4] == 0x90); // nop
+
+ // Smash code with call instruction and relative target address.
+ uword stub_addr = StubCode::BreakpointReturnEntryPoint();
+ code[0] = 0xE8;
+ *reinterpret_cast<uword*>(&code[1]) = stub_addr - pc_;
+ CPU::FlushICache(pc_, 5);
+}
+
+
+void Breakpoint::RestoreFunctionReturn() {
+ uint8_t* code = reinterpret_cast<uint8_t*>(pc_ - 5);
+ ASSERT(code[0] == 0xE8);
+ code[0] = 0x89;
+ code[1] = 0xEC; // mov esp,ebp
+ code[2] = 0x5D; // pop ebp
+ code[3] = 0xC3; // ret
+ code[4] = 0x90; // nop
+ CPU::FlushICache(pc_, 5);
+}
+
+
+
} // namespace dart
#endif // defined TARGET_ARCH_IA32
« no previous file with comments | « runtime/vm/debugger_arm.cc ('k') | runtime/vm/debugger_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698