Changeset 219740 in webkit for trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp
- Timestamp:
- Jul 21, 2017, 1:44:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp
r215642 r219740 38 38 using FPRegisterID = MacroAssembler::FPRegisterID; 39 39 40 template<typename T> T nextID(T id) { return static_cast<T>(id + 1); } 41 40 42 void printAllRegisters(PrintStream& out, Context& context) 41 43 { … … 57 59 #endif 58 60 59 #define PRINT_GPREGISTER(_type, _regName) { \60 intptr_t value = reinterpret_cast<intptr_t>(cpu._regName); \61 INDENT, out.printf(" %6s: " INTPTR_HEX_VALUE_FORMAT " %ld\n", #_regName, value, value) ; \61 for (auto id = MacroAssembler::firstRegister(); id <= MacroAssembler::lastRegister(); id = nextID(id)) { 62 intptr_t value = static_cast<intptr_t>(cpu.gpr(id)); 63 INDENT, out.printf(" %6s: " INTPTR_HEX_VALUE_FORMAT " %ld\n", cpu.gprName(id), value, value); 62 64 } 63 FOR_EACH_CPU_GPREGISTER(PRINT_GPREGISTER) 64 FOR_EACH_CPU_SPECIAL_REGISTER(PRINT_GPREGISTER) 65 #undef PRINT_GPREGISTER 65 for (auto id = MacroAssembler::firstSPRegister(); id <= MacroAssembler::lastSPRegister(); id = nextID(id)) { 66 intptr_t value = static_cast<intptr_t>(cpu.spr(id)); 67 INDENT, out.printf(" %6s: " INTPTR_HEX_VALUE_FORMAT " %ld\n", cpu.sprName(id), value, value); 68 } 66 69 #undef INTPTR_HEX_VALUE_FORMAT 67 68 #define PRINT_FPREGISTER(_type, _regName) { \69 uint64_t * u = reinterpret_cast<uint64_t*>(&cpu._regName); \70 double * d = reinterpret_cast<double*>(&cpu._regName); \71 INDENT, out.printf(" %6s: 0x%016llx %.13g\n", #_regName, *u, *d); \70 71 for (auto id = MacroAssembler::firstFPRegister(); id <= MacroAssembler::lastFPRegister(); id = nextID(id)) { 72 uint64_t u = bitwise_cast<uint64_t>(cpu.fpr(id)); 73 double d = cpu.fpr(id); 74 INDENT, out.printf(" %6s: 0x%016llx %.13g\n", cpu.fprName(id), u, d); 72 75 } 73 FOR_EACH_CPU_FPREGISTER(PRINT_FPREGISTER)74 #undef PRINT_FPREGISTER75 76 76 77 INDENT, out.print("}\n"); … … 82 83 { 83 84 auto cpu = context.probeContext.cpu; 84 void* value; 85 #if CPU(X86) || CPU(X86_64) 86 value = cpu.eip; 87 #elif CPU(ARM_TRADITIONAL) || CPU(ARM_THUMB2) || CPU(ARM64) 88 value = cpu.pc; 89 #else 90 #error "Unsupported CPU" 91 #endif 92 out.printf("pc:<%p %ld>", value, bitwise_cast<intptr_t>(value)); 85 intptr_t value = cpu.pc(); 86 out.printf("pc:<%p %ld>", bitwise_cast<void*>(value), value); 93 87 } 94 88 … … 97 91 RegisterID regID = context.data.as<RegisterID>(); 98 92 const char* name = CPUState::gprName(regID); 99 void*value = context.probeContext.gpr(regID);100 out.printf("%s:<%p %ld>", name, value, bitwise_cast<intptr_t>(value));93 intptr_t value = context.probeContext.gpr(regID); 94 out.printf("%s:<%p %ld>", name, bitwise_cast<void*>(value), value); 101 95 } 102 96 … … 114 108 RegisterID regID = address.base; 115 109 const char* name = CPUState::gprName(regID); 116 void*value = context.probeContext.gpr(regID);117 out.printf("Address{base:%s:<%p %ld>, offset:<0x%x %d>", name, value, bitwise_cast<intptr_t>(value), address.offset, address.offset);110 intptr_t value = context.probeContext.gpr(regID); 111 out.printf("Address{base:%s:<%p %ld>, offset:<0x%x %d>", name, bitwise_cast<void*>(value), value, address.offset, address.offset); 118 112 } 119 113
Note:
See TracChangeset
for help on using the changeset viewer.