OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 void BreakLocationIterator::SetDebugBreakAtReturn() { | 44 void BreakLocationIterator::SetDebugBreakAtReturn() { |
45 // Patch the code changing the return from JS function sequence from | 45 // Patch the code changing the return from JS function sequence from |
46 // mov sp, fp | 46 // mov sp, fp |
47 // ldmia sp!, {fp, lr} | 47 // ldmia sp!, {fp, lr} |
48 // add sp, sp, #4 | 48 // add sp, sp, #4 |
49 // bx lr | 49 // bx lr |
50 // to a call to the debug break return code. | 50 // to a call to the debug break return code. |
51 // #ifdef USE_BLX | |
52 // ldr ip, [pc, #0] | 51 // ldr ip, [pc, #0] |
53 // blx ip | 52 // blx ip |
54 // #else | |
55 // mov lr, pc | |
56 // ldr pc, [pc, #-4] | |
57 // #endif | |
58 // <debug break return code entry point address> | 53 // <debug break return code entry point address> |
59 // bktp 0 | 54 // bktp 0 |
60 CodePatcher patcher(rinfo()->pc(), Assembler::kJSReturnSequenceInstructions); | 55 CodePatcher patcher(rinfo()->pc(), Assembler::kJSReturnSequenceInstructions); |
61 #ifdef USE_BLX | |
62 patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0)); | 56 patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0)); |
63 patcher.masm()->blx(v8::internal::ip); | 57 patcher.masm()->blx(v8::internal::ip); |
64 #else | |
65 patcher.masm()->mov(v8::internal::lr, v8::internal::pc); | |
66 patcher.masm()->ldr(v8::internal::pc, MemOperand(v8::internal::pc, -4)); | |
67 #endif | |
68 patcher.Emit(Isolate::Current()->debug()->debug_break_return()->entry()); | 58 patcher.Emit(Isolate::Current()->debug()->debug_break_return()->entry()); |
69 patcher.masm()->bkpt(0); | 59 patcher.masm()->bkpt(0); |
70 } | 60 } |
71 | 61 |
72 | 62 |
73 // Restore the JS frame exit code. | 63 // Restore the JS frame exit code. |
74 void BreakLocationIterator::ClearDebugBreakAtReturn() { | 64 void BreakLocationIterator::ClearDebugBreakAtReturn() { |
75 rinfo()->PatchCode(original_rinfo()->pc(), | 65 rinfo()->PatchCode(original_rinfo()->pc(), |
76 Assembler::kJSReturnSequenceInstructions); | 66 Assembler::kJSReturnSequenceInstructions); |
77 } | 67 } |
(...skipping 14 matching lines...) Expand all Loading... |
92 } | 82 } |
93 | 83 |
94 | 84 |
95 void BreakLocationIterator::SetDebugBreakAtSlot() { | 85 void BreakLocationIterator::SetDebugBreakAtSlot() { |
96 ASSERT(IsDebugBreakSlot()); | 86 ASSERT(IsDebugBreakSlot()); |
97 // Patch the code changing the debug break slot code from | 87 // Patch the code changing the debug break slot code from |
98 // mov r2, r2 | 88 // mov r2, r2 |
99 // mov r2, r2 | 89 // mov r2, r2 |
100 // mov r2, r2 | 90 // mov r2, r2 |
101 // to a call to the debug break slot code. | 91 // to a call to the debug break slot code. |
102 // #ifdef USE_BLX | |
103 // ldr ip, [pc, #0] | 92 // ldr ip, [pc, #0] |
104 // blx ip | 93 // blx ip |
105 // #else | |
106 // mov lr, pc | |
107 // ldr pc, [pc, #-4] | |
108 // #endif | |
109 // <debug break slot code entry point address> | 94 // <debug break slot code entry point address> |
110 CodePatcher patcher(rinfo()->pc(), Assembler::kDebugBreakSlotInstructions); | 95 CodePatcher patcher(rinfo()->pc(), Assembler::kDebugBreakSlotInstructions); |
111 #ifdef USE_BLX | |
112 patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0)); | 96 patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0)); |
113 patcher.masm()->blx(v8::internal::ip); | 97 patcher.masm()->blx(v8::internal::ip); |
114 #else | |
115 patcher.masm()->mov(v8::internal::lr, v8::internal::pc); | |
116 patcher.masm()->ldr(v8::internal::pc, MemOperand(v8::internal::pc, -4)); | |
117 #endif | |
118 patcher.Emit(Isolate::Current()->debug()->debug_break_slot()->entry()); | 98 patcher.Emit(Isolate::Current()->debug()->debug_break_slot()->entry()); |
119 } | 99 } |
120 | 100 |
121 | 101 |
122 void BreakLocationIterator::ClearDebugBreakAtSlot() { | 102 void BreakLocationIterator::ClearDebugBreakAtSlot() { |
123 ASSERT(IsDebugBreakSlot()); | 103 ASSERT(IsDebugBreakSlot()); |
124 rinfo()->PatchCode(original_rinfo()->pc(), | 104 rinfo()->PatchCode(original_rinfo()->pc(), |
125 Assembler::kDebugBreakSlotInstructions); | 105 Assembler::kDebugBreakSlotInstructions); |
126 } | 106 } |
127 | 107 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 316 |
337 #undef __ | 317 #undef __ |
338 | 318 |
339 | 319 |
340 | 320 |
341 #endif // ENABLE_DEBUGGER_SUPPORT | 321 #endif // ENABLE_DEBUGGER_SUPPORT |
342 | 322 |
343 } } // namespace v8::internal | 323 } } // namespace v8::internal |
344 | 324 |
345 #endif // V8_TARGET_ARCH_ARM | 325 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |