OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 int32_t value; | 309 int32_t value; |
310 float svalue; | 310 float svalue; |
311 double dvalue; | 311 double dvalue; |
312 if (strcmp(arg1, "all") == 0) { | 312 if (strcmp(arg1, "all") == 0) { |
313 for (int i = 0; i < kNumRegisters; i++) { | 313 for (int i = 0; i < kNumRegisters; i++) { |
314 value = GetRegisterValue(i); | 314 value = GetRegisterValue(i); |
315 PrintF("%3s: 0x%08x %10d\n", Registers::Name(i), value, value); | 315 PrintF("%3s: 0x%08x %10d\n", Registers::Name(i), value, value); |
316 } | 316 } |
317 for (int i = 0; i < kNumVFPDoubleRegisters; i++) { | 317 for (int i = 0; i < kNumVFPDoubleRegisters; i++) { |
318 dvalue = GetVFPDoubleRegisterValue(i); | 318 dvalue = GetVFPDoubleRegisterValue(i); |
319 PrintF("%3s: %f\n", | 319 int32_t* as_word = reinterpret_cast<int32_t*>(&dvalue); |
320 VFPRegisters::Name(i, true), dvalue); | 320 PrintF("%3s: %f 0x%08x %08x\n", |
321 VFPRegisters::Name(i, true), | |
322 dvalue, | |
323 as_word[1], | |
324 as_word[0]); | |
321 } | 325 } |
322 } else { | 326 } else { |
323 if (GetValue(arg1, &value)) { | 327 if (GetValue(arg1, &value)) { |
324 PrintF("%s: 0x%08x %d \n", arg1, value, value); | 328 PrintF("%s: 0x%08x %d \n", arg1, value, value); |
325 } else if (GetVFPSingleValue(arg1, &svalue)) { | 329 } else if (GetVFPSingleValue(arg1, &svalue)) { |
326 PrintF("%s: %f \n", arg1, svalue); | 330 int32_t* as_word = reinterpret_cast<int32_t*>(&svalue); |
331 PrintF("%s: %f 0x%08x\n", arg1, svalue, *as_word); | |
327 } else if (GetVFPDoubleValue(arg1, &dvalue)) { | 332 } else if (GetVFPDoubleValue(arg1, &dvalue)) { |
328 PrintF("%s: %f \n", arg1, dvalue); | 333 int32_t* as_word = reinterpret_cast<int32_t*>(&dvalue); |
334 PrintF("%s: %f 0x%08x %08x\n", | |
335 arg1, | |
336 dvalue, | |
337 as_word[1], | |
338 as_word[0]); | |
329 } else { | 339 } else { |
330 PrintF("%s unrecognized\n", arg1); | 340 PrintF("%s unrecognized\n", arg1); |
331 } | 341 } |
332 } | 342 } |
333 } else { | 343 } else { |
334 PrintF("print <register>\n"); | 344 PrintF("print <register>\n"); |
335 } | 345 } |
336 } else if ((strcmp(cmd, "po") == 0) | 346 } else if ((strcmp(cmd, "po") == 0) |
337 || (strcmp(cmd, "printobject") == 0)) { | 347 || (strcmp(cmd, "printobject") == 0)) { |
338 if (argc == 2) { | 348 if (argc == 2) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 if (argc == next_arg) { | 383 if (argc == next_arg) { |
374 words = 10; | 384 words = 10; |
375 } else if (argc == next_arg + 1) { | 385 } else if (argc == next_arg + 1) { |
376 if (!GetValue(argv[next_arg], &words)) { | 386 if (!GetValue(argv[next_arg], &words)) { |
377 words = 10; | 387 words = 10; |
378 } | 388 } |
379 } | 389 } |
380 end = cur + words; | 390 end = cur + words; |
381 | 391 |
382 while (cur < end) { | 392 while (cur < end) { |
383 PrintF(" 0x%08x: 0x%08x %10d\n", | 393 PrintF(" 0x%08x: 0x%08x %10d", |
384 reinterpret_cast<intptr_t>(cur), *cur, *cur); | 394 reinterpret_cast<intptr_t>(cur), *cur, *cur); |
395 HeapObject* obj = reinterpret_cast<HeapObject*>(*cur); | |
396 int value = *cur; | |
397 if (Heap::Contains(obj) || ((value & 1) == 0)) { | |
398 PrintF(" ("); | |
399 if ((value & 1) == 0) { | |
400 PrintF("smi %d", value / 2); | |
401 } else { | |
402 obj->ShortPrint(); | |
403 } | |
404 PrintF(")"); | |
405 } | |
406 PrintF("\n"); | |
385 cur++; | 407 cur++; |
386 } | 408 } |
387 } else if (strcmp(cmd, "disasm") == 0) { | 409 } else if (strcmp(cmd, "disasm") == 0 || strcmp(cmd, "da")) { |
Søren Thygesen Gjesse
2011/03/16 22:28:42
Maybe di instead of da?
Karl Klose
2011/03/17 10:10:07
Done.
| |
388 disasm::NameConverter converter; | 410 disasm::NameConverter converter; |
389 disasm::Disassembler dasm(converter); | 411 disasm::Disassembler dasm(converter); |
390 // use a reasonably large buffer | 412 // use a reasonably large buffer |
391 v8::internal::EmbeddedVector<char, 256> buffer; | 413 v8::internal::EmbeddedVector<char, 256> buffer; |
392 | 414 |
393 byte* prev = NULL; | 415 byte* prev = NULL; |
394 byte* cur = NULL; | 416 byte* cur = NULL; |
395 byte* end = NULL; | 417 byte* end = NULL; |
396 | 418 |
397 if (argc == 1) { | 419 if (argc == 1) { |
398 cur = reinterpret_cast<byte*>(sim_->get_pc()); | 420 cur = reinterpret_cast<byte*>(sim_->get_pc()); |
399 end = cur + (10 * Instruction::kInstrSize); | 421 end = cur + (10 * Instruction::kInstrSize); |
400 } else if (argc == 2) { | 422 } else if (argc == 2) { |
401 int32_t value; | 423 int regnum = Registers::Number(arg1); |
402 if (GetValue(arg1, &value)) { | 424 if (regnum != kNoRegister || strncmp(arg1, "0x", 2) == 0) { |
403 cur = reinterpret_cast<byte*>(sim_->get_pc()); | 425 // The argument is an address or a register name. |
404 // Disassemble <arg1> instructions. | 426 int32_t value; |
405 end = cur + (value * Instruction::kInstrSize); | 427 if (GetValue(arg1, &value)) { |
428 cur = reinterpret_cast<byte*>(value); | |
429 // Disassemble 10 instructions at <arg1>. | |
430 end = cur + (10 * Instruction::kInstrSize); | |
431 } | |
432 } else { | |
433 // The argument is the number of instructions. | |
434 int32_t value; | |
435 if (GetValue(arg1, &value)) { | |
436 cur = reinterpret_cast<byte*>(sim_->get_pc()); | |
437 // Disassemble <arg1> instructions. | |
438 end = cur + (value * Instruction::kInstrSize); | |
439 } | |
406 } | 440 } |
407 } else { | 441 } else { |
408 int32_t value1; | 442 int32_t value1; |
409 int32_t value2; | 443 int32_t value2; |
410 if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) { | 444 if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) { |
411 cur = reinterpret_cast<byte*>(value1); | 445 cur = reinterpret_cast<byte*>(value1); |
412 end = cur + (value2 * Instruction::kInstrSize); | 446 end = cur + (value2 * Instruction::kInstrSize); |
413 } | 447 } |
414 } | 448 } |
415 | 449 |
(...skipping 2747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3163 uintptr_t address = *stack_slot; | 3197 uintptr_t address = *stack_slot; |
3164 set_register(sp, current_sp + sizeof(uintptr_t)); | 3198 set_register(sp, current_sp + sizeof(uintptr_t)); |
3165 return address; | 3199 return address; |
3166 } | 3200 } |
3167 | 3201 |
3168 } } // namespace v8::internal | 3202 } } // namespace v8::internal |
3169 | 3203 |
3170 #endif // USE_SIMULATOR | 3204 #endif // USE_SIMULATOR |
3171 | 3205 |
3172 #endif // V8_TARGET_ARCH_ARM | 3206 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |