OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 <stdarg.h> | 5 #include <stdarg.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #if V8_TARGET_ARCH_S390 | 9 #if V8_TARGET_ARCH_S390 |
10 | 10 |
11 #include "src/assembler.h" | 11 #include "src/assembler.h" |
12 #include "src/base/bits.h" | 12 #include "src/base/bits.h" |
13 #include "src/base/once.h" | 13 #include "src/base/once.h" |
14 #include "src/codegen.h" | 14 #include "src/codegen.h" |
15 #include "src/disasm.h" | 15 #include "src/disasm.h" |
16 #include "src/runtime/runtime-utils.h" | 16 #include "src/runtime/runtime-utils.h" |
17 #include "src/s390/constants-s390.h" | 17 #include "src/s390/constants-s390.h" |
18 #include "src/s390/frames-s390.h" | 18 #include "src/s390/frames-s390.h" |
19 #include "src/s390/simulator-s390.h" | 19 #include "src/s390/simulator-s390.h" |
20 #if defined(USE_SIMULATOR) | 20 #if defined(USE_SIMULATOR) |
21 | 21 |
22 // Only build the simulator if not compiling for real s390 hardware. | 22 // Only build the simulator if not compiling for real s390 hardware. |
23 namespace v8 { | 23 namespace v8 { |
24 namespace internal { | 24 namespace internal { |
25 | 25 |
| 26 const auto GetRegConfig = RegisterConfiguration::Crankshaft; |
| 27 |
26 // This macro provides a platform independent use of sscanf. The reason for | 28 // This macro provides a platform independent use of sscanf. The reason for |
27 // SScanF not being implemented in a platform independent way through | 29 // SScanF not being implemented in a platform independent way through |
28 // ::v8::internal::OS in the same way as SNPrintF is that the | 30 // ::v8::internal::OS in the same way as SNPrintF is that the |
29 // Windows C Run-Time Library does not provide vsscanf. | 31 // Windows C Run-Time Library does not provide vsscanf. |
30 #define SScanF sscanf // NOLINT | 32 #define SScanF sscanf // NOLINT |
31 | 33 |
32 // The S390Debugger class is used by the simulator while debugging simulated | 34 // The S390Debugger class is used by the simulator while debugging simulated |
33 // z/Architecture code. | 35 // z/Architecture code. |
34 class S390Debugger { | 36 class S390Debugger { |
35 public: | 37 public: |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // Leave the debugger shell. | 326 // Leave the debugger shell. |
325 done = true; | 327 done = true; |
326 } else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) { | 328 } else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) { |
327 if (argc == 2 || (argc == 3 && strcmp(arg2, "fp") == 0)) { | 329 if (argc == 2 || (argc == 3 && strcmp(arg2, "fp") == 0)) { |
328 intptr_t value; | 330 intptr_t value; |
329 double dvalue; | 331 double dvalue; |
330 if (strcmp(arg1, "all") == 0) { | 332 if (strcmp(arg1, "all") == 0) { |
331 for (int i = 0; i < kNumRegisters; i++) { | 333 for (int i = 0; i < kNumRegisters; i++) { |
332 value = GetRegisterValue(i); | 334 value = GetRegisterValue(i); |
333 PrintF(" %3s: %08" V8PRIxPTR, | 335 PrintF(" %3s: %08" V8PRIxPTR, |
334 Register::from_code(i).ToString(), value); | 336 GetRegConfig()->GetGeneralRegisterName(i), value); |
335 if ((argc == 3 && strcmp(arg2, "fp") == 0) && i < 8 && | 337 if ((argc == 3 && strcmp(arg2, "fp") == 0) && i < 8 && |
336 (i % 2) == 0) { | 338 (i % 2) == 0) { |
337 dvalue = GetRegisterPairDoubleValue(i); | 339 dvalue = GetRegisterPairDoubleValue(i); |
338 PrintF(" (%f)\n", dvalue); | 340 PrintF(" (%f)\n", dvalue); |
339 } else if (i != 0 && !((i + 1) & 3)) { | 341 } else if (i != 0 && !((i + 1) & 3)) { |
340 PrintF("\n"); | 342 PrintF("\n"); |
341 } | 343 } |
342 } | 344 } |
343 PrintF(" pc: %08" V8PRIxPTR " cr: %08x\n", sim_->special_reg_pc_, | 345 PrintF(" pc: %08" V8PRIxPTR " cr: %08x\n", sim_->special_reg_pc_, |
344 sim_->condition_reg_); | 346 sim_->condition_reg_); |
345 } else if (strcmp(arg1, "alld") == 0) { | 347 } else if (strcmp(arg1, "alld") == 0) { |
346 for (int i = 0; i < kNumRegisters; i++) { | 348 for (int i = 0; i < kNumRegisters; i++) { |
347 value = GetRegisterValue(i); | 349 value = GetRegisterValue(i); |
348 PrintF(" %3s: %08" V8PRIxPTR " %11" V8PRIdPTR, | 350 PrintF(" %3s: %08" V8PRIxPTR " %11" V8PRIdPTR, |
349 Register::from_code(i).ToString(), value, value); | 351 GetRegConfig()->GetGeneralRegisterName(i), value, value); |
350 if ((argc == 3 && strcmp(arg2, "fp") == 0) && i < 8 && | 352 if ((argc == 3 && strcmp(arg2, "fp") == 0) && i < 8 && |
351 (i % 2) == 0) { | 353 (i % 2) == 0) { |
352 dvalue = GetRegisterPairDoubleValue(i); | 354 dvalue = GetRegisterPairDoubleValue(i); |
353 PrintF(" (%f)\n", dvalue); | 355 PrintF(" (%f)\n", dvalue); |
354 } else if (!((i + 1) % 2)) { | 356 } else if (!((i + 1) % 2)) { |
355 PrintF("\n"); | 357 PrintF("\n"); |
356 } | 358 } |
357 } | 359 } |
358 PrintF(" pc: %08" V8PRIxPTR " cr: %08x\n", sim_->special_reg_pc_, | 360 PrintF(" pc: %08" V8PRIxPTR " cr: %08x\n", sim_->special_reg_pc_, |
359 sim_->condition_reg_); | 361 sim_->condition_reg_); |
360 } else if (strcmp(arg1, "allf") == 0) { | 362 } else if (strcmp(arg1, "allf") == 0) { |
361 for (int i = 0; i < DoubleRegister::kNumRegisters; i++) { | 363 for (int i = 0; i < DoubleRegister::kNumRegisters; i++) { |
362 float fvalue = GetFPFloatRegisterValue(i); | 364 float fvalue = GetFPFloatRegisterValue(i); |
363 uint32_t as_words = bit_cast<uint32_t>(fvalue); | 365 uint32_t as_words = bit_cast<uint32_t>(fvalue); |
364 PrintF("%3s: %f 0x%08x\n", | 366 PrintF("%3s: %f 0x%08x\n", |
365 DoubleRegister::from_code(i).ToString(), fvalue, as_words); | 367 GetRegConfig()->GetDoubleRegisterName(i), fvalue, |
| 368 as_words); |
366 } | 369 } |
367 } else if (strcmp(arg1, "alld") == 0) { | 370 } else if (strcmp(arg1, "alld") == 0) { |
368 for (int i = 0; i < DoubleRegister::kNumRegisters; i++) { | 371 for (int i = 0; i < DoubleRegister::kNumRegisters; i++) { |
369 dvalue = GetFPDoubleRegisterValue(i); | 372 dvalue = GetFPDoubleRegisterValue(i); |
370 uint64_t as_words = bit_cast<uint64_t>(dvalue); | 373 uint64_t as_words = bit_cast<uint64_t>(dvalue); |
371 PrintF("%3s: %f 0x%08x %08x\n", | 374 PrintF("%3s: %f 0x%08x %08x\n", |
372 DoubleRegister::from_code(i).ToString(), dvalue, | 375 GetRegConfig()->GetDoubleRegisterName(i), dvalue, |
373 static_cast<uint32_t>(as_words >> 32), | 376 static_cast<uint32_t>(as_words >> 32), |
374 static_cast<uint32_t>(as_words & 0xffffffff)); | 377 static_cast<uint32_t>(as_words & 0xffffffff)); |
375 } | 378 } |
376 } else if (arg1[0] == 'r' && | 379 } else if (arg1[0] == 'r' && |
377 (arg1[1] >= '0' && arg1[1] <= '2' && | 380 (arg1[1] >= '0' && arg1[1] <= '2' && |
378 (arg1[2] == '\0' || (arg1[2] >= '0' && arg1[2] <= '5' && | 381 (arg1[2] == '\0' || (arg1[2] >= '0' && arg1[2] <= '5' && |
379 arg1[3] == '\0')))) { | 382 arg1[3] == '\0')))) { |
380 int regnum = strtoul(&arg1[1], 0, 10); | 383 int regnum = strtoul(&arg1[1], 0, 10); |
381 if (regnum != kNoRegister) { | 384 if (regnum != kNoRegister) { |
382 value = GetRegisterValue(regnum); | 385 value = GetRegisterValue(regnum); |
(...skipping 12179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12562 return 0; | 12565 return 0; |
12563 } | 12566 } |
12564 | 12567 |
12565 #undef EVALUATE | 12568 #undef EVALUATE |
12566 | 12569 |
12567 } // namespace internal | 12570 } // namespace internal |
12568 } // namespace v8 | 12571 } // namespace v8 |
12569 | 12572 |
12570 #endif // USE_SIMULATOR | 12573 #endif // USE_SIMULATOR |
12571 #endif // V8_TARGET_ARCH_S390 | 12574 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |