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

Side by Side Diff: dart/runtime/vm/debugger_ia32.cc

Issue 119673004: Version 1.1.0-dev.5.2 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/runtime/vm/debugger_arm.cc ('k') | dart/runtime/vm/debugger_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/debugger.h" 8 #include "vm/debugger.h"
9 9
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 18 matching lines...) Expand all
29 29
30 RawObject* ActivationFrame::GetClosureObject(intptr_t num_actual_args) { 30 RawObject* ActivationFrame::GetClosureObject(intptr_t num_actual_args) {
31 // At a minimum we have the closure object on the stack. 31 // At a minimum we have the closure object on the stack.
32 ASSERT(num_actual_args > 0); 32 ASSERT(num_actual_args > 0);
33 // Stack pointer points to last argument that was pushed on the stack. 33 // Stack pointer points to last argument that was pushed on the stack.
34 uword closure_addr = sp() + ((num_actual_args - 1) * kWordSize); 34 uword closure_addr = sp() + ((num_actual_args - 1) * kWordSize);
35 return reinterpret_cast<RawObject*>( 35 return reinterpret_cast<RawObject*>(
36 *reinterpret_cast<uword*>(closure_addr)); 36 *reinterpret_cast<uword*>(closure_addr));
37 } 37 }
38 38
39
40 void CodeBreakpoint::PatchFunctionReturn() {
41 uint8_t* code = reinterpret_cast<uint8_t*>(pc_ - 5);
42 ASSERT((code[0] == 0x89) && (code[1] == 0xEC)); // mov esp,ebp
43 ASSERT(code[2] == 0x5D); // pop ebp
44 ASSERT(code[3] == 0xC3); // ret
45 ASSERT(code[4] == 0x90); // nop
46
47 // Smash code with call instruction and relative target address.
48 uword stub_addr = StubCode::BreakpointReturnEntryPoint();
49 code[0] = 0xE8;
50 *reinterpret_cast<uword*>(&code[1]) = stub_addr - pc_;
51 CPU::FlushICache(pc_ - 5, 5);
52 }
53
54
55 void CodeBreakpoint::RestoreFunctionReturn() {
56 uint8_t* code = reinterpret_cast<uint8_t*>(pc_ - 5);
57 ASSERT(code[0] == 0xE8);
58 code[0] = 0x89;
59 code[1] = 0xEC; // mov esp,ebp
60 code[2] = 0x5D; // pop ebp
61 code[3] = 0xC3; // ret
62 code[4] = 0x90; // nop
63 CPU::FlushICache(pc_ - 5, 5);
64 }
65
66
67
68 } // namespace dart 39 } // namespace dart
69 40
70 #endif // defined TARGET_ARCH_IA32 41 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « dart/runtime/vm/debugger_arm.cc ('k') | dart/runtime/vm/debugger_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698