| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <cmath> | 6 #include <cmath> |
| 7 #include <cstdarg> | 7 #include <cstdarg> |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #if V8_TARGET_ARCH_ARM64 | 10 #if V8_TARGET_ARCH_ARM64 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 TEXT_COLOUR clr_debug_number = FLAG_log_colour ? COLOUR(BOLD(ORANGE)) : ""; | 54 TEXT_COLOUR clr_debug_number = FLAG_log_colour ? COLOUR(BOLD(ORANGE)) : ""; |
| 55 TEXT_COLOUR clr_debug_message = FLAG_log_colour ? COLOUR(ORANGE) : ""; | 55 TEXT_COLOUR clr_debug_message = FLAG_log_colour ? COLOUR(ORANGE) : ""; |
| 56 TEXT_COLOUR clr_printf = FLAG_log_colour ? COLOUR(GREEN) : ""; | 56 TEXT_COLOUR clr_printf = FLAG_log_colour ? COLOUR(GREEN) : ""; |
| 57 | 57 |
| 58 | 58 |
| 59 // This is basically the same as PrintF, with a guard for FLAG_trace_sim. | 59 // This is basically the same as PrintF, with a guard for FLAG_trace_sim. |
| 60 void Simulator::TraceSim(const char* format, ...) { | 60 void Simulator::TraceSim(const char* format, ...) { |
| 61 if (FLAG_trace_sim) { | 61 if (FLAG_trace_sim) { |
| 62 va_list arguments; | 62 va_list arguments; |
| 63 va_start(arguments, format); | 63 va_start(arguments, format); |
| 64 OS::VFPrint(stream_, format, arguments); | 64 base::OS::VFPrint(stream_, format, arguments); |
| 65 va_end(arguments); | 65 va_end(arguments); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 | 68 |
| 69 | 69 |
| 70 const Instruction* Simulator::kEndOfSimAddress = NULL; | 70 const Instruction* Simulator::kEndOfSimAddress = NULL; |
| 71 | 71 |
| 72 | 72 |
| 73 void SimSystemRegister::SetBits(int msb, int lsb, uint32_t bits) { | 73 void SimSystemRegister::SetBits(int msb, int lsb, uint32_t bits) { |
| 74 int width = msb - lsb + 1; | 74 int width = msb - lsb + 1; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } else { | 136 } else { |
| 137 ASSERT(arg.IsD() || arg.IsX()); | 137 ASSERT(arg.IsD() || arg.IsX()); |
| 138 stack_args.push_back(arg.bits()); | 138 stack_args.push_back(arg.bits()); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Process stack arguments, and make sure the stack is suitably aligned. | 142 // Process stack arguments, and make sure the stack is suitably aligned. |
| 143 uintptr_t original_stack = sp(); | 143 uintptr_t original_stack = sp(); |
| 144 uintptr_t entry_stack = original_stack - | 144 uintptr_t entry_stack = original_stack - |
| 145 stack_args.size() * sizeof(stack_args[0]); | 145 stack_args.size() * sizeof(stack_args[0]); |
| 146 if (OS::ActivationFrameAlignment() != 0) { | 146 if (base::OS::ActivationFrameAlignment() != 0) { |
| 147 entry_stack &= -OS::ActivationFrameAlignment(); | 147 entry_stack &= -base::OS::ActivationFrameAlignment(); |
| 148 } | 148 } |
| 149 char * stack = reinterpret_cast<char*>(entry_stack); | 149 char * stack = reinterpret_cast<char*>(entry_stack); |
| 150 std::vector<int64_t>::const_iterator it; | 150 std::vector<int64_t>::const_iterator it; |
| 151 for (it = stack_args.begin(); it != stack_args.end(); it++) { | 151 for (it = stack_args.begin(); it != stack_args.end(); it++) { |
| 152 memcpy(stack, &(*it), sizeof(*it)); | 152 memcpy(stack, &(*it), sizeof(*it)); |
| 153 stack += sizeof(*it); | 153 stack += sizeof(*it); |
| 154 } | 154 } |
| 155 | 155 |
| 156 ASSERT(reinterpret_cast<uintptr_t>(stack) <= original_stack); | 156 ASSERT(reinterpret_cast<uintptr_t>(stack) <= original_stack); |
| 157 set_sp(entry_stack); | 157 set_sp(entry_stack); |
| (...skipping 3279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3437 PrintF("%s unrecognized\n", arg1); | 3437 PrintF("%s unrecognized\n", arg1); |
| 3438 } | 3438 } |
| 3439 } else { | 3439 } else { |
| 3440 ListBreakpoints(); | 3440 ListBreakpoints(); |
| 3441 PrintF("Use `break <address>` to set or disable a breakpoint\n"); | 3441 PrintF("Use `break <address>` to set or disable a breakpoint\n"); |
| 3442 } | 3442 } |
| 3443 | 3443 |
| 3444 // gdb ------------------------------------------------------------------- | 3444 // gdb ------------------------------------------------------------------- |
| 3445 } else if (strcmp(cmd, "gdb") == 0) { | 3445 } else if (strcmp(cmd, "gdb") == 0) { |
| 3446 PrintF("Relinquishing control to gdb.\n"); | 3446 PrintF("Relinquishing control to gdb.\n"); |
| 3447 OS::DebugBreak(); | 3447 base::OS::DebugBreak(); |
| 3448 PrintF("Regaining control from gdb.\n"); | 3448 PrintF("Regaining control from gdb.\n"); |
| 3449 | 3449 |
| 3450 // sysregs --------------------------------------------------------------- | 3450 // sysregs --------------------------------------------------------------- |
| 3451 } else if (strcmp(cmd, "sysregs") == 0) { | 3451 } else if (strcmp(cmd, "sysregs") == 0) { |
| 3452 PrintSystemRegisters(); | 3452 PrintSystemRegisters(); |
| 3453 | 3453 |
| 3454 // help / h -------------------------------------------------------------- | 3454 // help / h -------------------------------------------------------------- |
| 3455 } else if (strcmp(cmd, "help") == 0 || strcmp(cmd, "h") == 0) { | 3455 } else if (strcmp(cmd, "help") == 0 || strcmp(cmd, "h") == 0) { |
| 3456 PrintF( | 3456 PrintF( |
| 3457 "stepi / si\n" | 3457 "stepi / si\n" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3585 DoRuntimeCall(instr); | 3585 DoRuntimeCall(instr); |
| 3586 } else if (instr->ImmException() == kImmExceptionIsPrintf) { | 3586 } else if (instr->ImmException() == kImmExceptionIsPrintf) { |
| 3587 DoPrintf(instr); | 3587 DoPrintf(instr); |
| 3588 | 3588 |
| 3589 } else if (instr->ImmException() == kImmExceptionIsUnreachable) { | 3589 } else if (instr->ImmException() == kImmExceptionIsUnreachable) { |
| 3590 fprintf(stream_, "Hit UNREACHABLE marker at PC=%p.\n", | 3590 fprintf(stream_, "Hit UNREACHABLE marker at PC=%p.\n", |
| 3591 reinterpret_cast<void*>(pc_)); | 3591 reinterpret_cast<void*>(pc_)); |
| 3592 abort(); | 3592 abort(); |
| 3593 | 3593 |
| 3594 } else { | 3594 } else { |
| 3595 OS::DebugBreak(); | 3595 base::OS::DebugBreak(); |
| 3596 } | 3596 } |
| 3597 break; | 3597 break; |
| 3598 } | 3598 } |
| 3599 | 3599 |
| 3600 default: | 3600 default: |
| 3601 UNIMPLEMENTED(); | 3601 UNIMPLEMENTED(); |
| 3602 } | 3602 } |
| 3603 } | 3603 } |
| 3604 | 3604 |
| 3605 | 3605 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3727 | 3727 |
| 3728 delete[] format; | 3728 delete[] format; |
| 3729 } | 3729 } |
| 3730 | 3730 |
| 3731 | 3731 |
| 3732 #endif // USE_SIMULATOR | 3732 #endif // USE_SIMULATOR |
| 3733 | 3733 |
| 3734 } } // namespace v8::internal | 3734 } } // namespace v8::internal |
| 3735 | 3735 |
| 3736 #endif // V8_TARGET_ARCH_ARM64 | 3736 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |