Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: src/arm/simulator-arm.cc

Issue 6676042: Improve ARM-Simulator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update to use isolates. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 uint64_t as_words = BitCast<uint64_t>(dvalue);
320 VFPRegisters::Name(i, true), dvalue); 320 PrintF("%3s: %f 0x%08x %08x\n",
321 VFPRegisters::Name(i, true),
322 dvalue,
323 static_cast<uint32_t>(as_words >> 32),
324 static_cast<uint32_t>(as_words & 0xffffffff));
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 uint32_t as_word = BitCast<uint32_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 uint64_t as_words = BitCast<uint64_t>(dvalue);
334 PrintF("%s: %f 0x%08x %08x\n",
335 arg1,
336 dvalue,
337 static_cast<uint32_t>(as_words >> 32),
338 static_cast<uint32_t>(as_words & 0xffffffff));
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
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 Heap* current_heap = v8::internal::Isolate::Current()->heap();
398 if (current_heap->Contains(obj) || ((value & 1) == 0)) {
399 PrintF(" (");
400 if ((value & 1) == 0) {
401 PrintF("smi %d", value / 2);
402 } else {
403 obj->ShortPrint();
404 }
405 PrintF(")");
406 }
407 PrintF("\n");
385 cur++; 408 cur++;
386 } 409 }
387 } else if (strcmp(cmd, "disasm") == 0) { 410 } else if (strcmp(cmd, "disasm") == 0 || strcmp(cmd, "di") == 0) {
388 disasm::NameConverter converter; 411 disasm::NameConverter converter;
389 disasm::Disassembler dasm(converter); 412 disasm::Disassembler dasm(converter);
390 // use a reasonably large buffer 413 // use a reasonably large buffer
391 v8::internal::EmbeddedVector<char, 256> buffer; 414 v8::internal::EmbeddedVector<char, 256> buffer;
392 415
393 byte* prev = NULL; 416 byte* prev = NULL;
394 byte* cur = NULL; 417 byte* cur = NULL;
395 byte* end = NULL; 418 byte* end = NULL;
396 419
397 if (argc == 1) { 420 if (argc == 1) {
398 cur = reinterpret_cast<byte*>(sim_->get_pc()); 421 cur = reinterpret_cast<byte*>(sim_->get_pc());
399 end = cur + (10 * Instruction::kInstrSize); 422 end = cur + (10 * Instruction::kInstrSize);
400 } else if (argc == 2) { 423 } else if (argc == 2) {
401 int32_t value; 424 int regnum = Registers::Number(arg1);
402 if (GetValue(arg1, &value)) { 425 if (regnum != kNoRegister || strncmp(arg1, "0x", 2) == 0) {
403 cur = reinterpret_cast<byte*>(sim_->get_pc()); 426 // The argument is an address or a register name.
404 // Disassemble <arg1> instructions. 427 int32_t value;
405 end = cur + (value * Instruction::kInstrSize); 428 if (GetValue(arg1, &value)) {
429 cur = reinterpret_cast<byte*>(value);
430 // Disassemble 10 instructions at <arg1>.
431 end = cur + (10 * Instruction::kInstrSize);
432 }
433 } else {
434 // The argument is the number of instructions.
435 int32_t value;
436 if (GetValue(arg1, &value)) {
437 cur = reinterpret_cast<byte*>(sim_->get_pc());
438 // Disassemble <arg1> instructions.
439 end = cur + (value * Instruction::kInstrSize);
440 }
406 } 441 }
407 } else { 442 } else {
408 int32_t value1; 443 int32_t value1;
409 int32_t value2; 444 int32_t value2;
410 if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) { 445 if (GetValue(arg1, &value1) && GetValue(arg2, &value2)) {
411 cur = reinterpret_cast<byte*>(value1); 446 cur = reinterpret_cast<byte*>(value1);
412 end = cur + (value2 * Instruction::kInstrSize); 447 end = cur + (value2 * Instruction::kInstrSize);
413 } 448 }
414 } 449 }
415 450
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 PrintF(" use register name 'all' to print all registers\n"); 552 PrintF(" use register name 'all' to print all registers\n");
518 PrintF("printobject <register>\n"); 553 PrintF("printobject <register>\n");
519 PrintF(" print an object from a register (alias 'po')\n"); 554 PrintF(" print an object from a register (alias 'po')\n");
520 PrintF("flags\n"); 555 PrintF("flags\n");
521 PrintF(" print flags\n"); 556 PrintF(" print flags\n");
522 PrintF("stack [<words>]\n"); 557 PrintF("stack [<words>]\n");
523 PrintF(" dump stack content, default dump 10 words)\n"); 558 PrintF(" dump stack content, default dump 10 words)\n");
524 PrintF("mem <address> [<words>]\n"); 559 PrintF("mem <address> [<words>]\n");
525 PrintF(" dump memory content, default dump 10 words)\n"); 560 PrintF(" dump memory content, default dump 10 words)\n");
526 PrintF("disasm [<instructions>]\n"); 561 PrintF("disasm [<instructions>]\n");
527 PrintF("disasm [[<address>] <instructions>]\n"); 562 PrintF("disasm [<address/register>]\n");
528 PrintF(" disassemble code, default is 10 instructions from pc\n"); 563 PrintF("disasm [[<address/register>] <instructions>]\n");
564 PrintF(" disassemble code, default is 10 instructions\n");
565 PrintF(" from pc (alias 'di')\n");
529 PrintF("gdb\n"); 566 PrintF("gdb\n");
530 PrintF(" enter gdb\n"); 567 PrintF(" enter gdb\n");
531 PrintF("break <address>\n"); 568 PrintF("break <address>\n");
532 PrintF(" set a break point on the address\n"); 569 PrintF(" set a break point on the address\n");
533 PrintF("del\n"); 570 PrintF("del\n");
534 PrintF(" delete the breakpoint\n"); 571 PrintF(" delete the breakpoint\n");
535 PrintF("trace (alias 't')\n"); 572 PrintF("trace (alias 't')\n");
536 PrintF(" toogle the tracing of all executed statements\n"); 573 PrintF(" toogle the tracing of all executed statements\n");
537 PrintF("stop feature:\n"); 574 PrintF("stop feature:\n");
538 PrintF(" Description:\n"); 575 PrintF(" Description:\n");
539 PrintF(" Stops are debug instructions inserted by\n"); 576 PrintF(" Stops are debug instructions inserted by\n");
540 PrintF(" the Assembler::stop() function.\n"); 577 PrintF(" the Assembler::stop() function.\n");
541 PrintF(" When hitting a stop, the Simulator will\n"); 578 PrintF(" When hitting a stop, the Simulator will\n");
542 PrintF(" stop and and give control to the ArmDebugger.\n"); 579 PrintF(" stop and and give control to the ArmDebugger.\n");
543 PrintF(" The first %d stop codes are watched:\n", 580 PrintF(" The first %d stop codes are watched:\n",
544 Simulator::kNumOfWatchedStops); 581 Simulator::kNumOfWatchedStops);
545 PrintF(" - They can be enabled / disabled: the Simulator\n"); 582 PrintF(" - They can be enabled / disabled: the Simulator\n");
546 PrintF(" will / won't stop when hitting them.\n"); 583 PrintF(" will / won't stop when hitting them.\n");
547 PrintF(" - The Simulator keeps track of how many times they \n"); 584 PrintF(" - The Simulator keeps track of how many times they \n");
548 PrintF(" are met. (See the info command.) Going over a\n"); 585 PrintF(" are met. (See the info command.) Going over a\n");
549 PrintF(" disabled stop still increases its counter. \n"); 586 PrintF(" disabled stop still increases its counter. \n");
550 PrintF(" Commands:\n"); 587 PrintF(" Commands:\n");
551 PrintF(" stop info all/<code> : print infos about number <code>\n"); 588 PrintF(" stop info all/<code> : print infos about number <code>\n");
552 PrintF(" or all stop(s).\n"); 589 PrintF(" or all stop(s).\n");
553 PrintF(" stop enable/disable all/<code> : enables / disables\n"); 590 PrintF(" stop enable/disable all/<code> : enables / disables\n");
554 PrintF(" all or number <code> stop(s)\n"); 591 PrintF(" all or number <code> stop(s)\n");
555 PrintF(" stop unstop\n"); 592 PrintF(" stop unstop\n");
556 PrintF(" ignore the stop instruction at the current location\n"); 593 PrintF(" ignore the stop instruction at the current location\n");
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after
3169 uintptr_t address = *stack_slot; 3206 uintptr_t address = *stack_slot;
3170 set_register(sp, current_sp + sizeof(uintptr_t)); 3207 set_register(sp, current_sp + sizeof(uintptr_t));
3171 return address; 3208 return address;
3172 } 3209 }
3173 3210
3174 } } // namespace v8::internal 3211 } } // namespace v8::internal
3175 3212
3176 #endif // USE_SIMULATOR 3213 #endif // USE_SIMULATOR
3177 3214
3178 #endif // V8_TARGET_ARCH_ARM 3215 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698