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

Side by Side Diff: runtime/vm/disassembler_ia32.cc

Issue 125263002: Fix disassembler crash when mistaking integer values for objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
8 #if defined(TARGET_ARCH_IA32) 8 #if defined(TARGET_ARCH_IA32)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 465 }
466 466
467 467
468 void X86Decoder::PrintAddress(uword addr) { 468 void X86Decoder::PrintAddress(uword addr) {
469 NoGCScope no_gc; 469 NoGCScope no_gc;
470 char addr_buffer[32]; 470 char addr_buffer[32];
471 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%#" Px "", addr); 471 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%#" Px "", addr);
472 Print(addr_buffer); 472 Print(addr_buffer);
473 // Try to print as heap object or stub name 473 // Try to print as heap object or stub name
474 if (((addr & kSmiTagMask) == kHeapObjectTag) && 474 if (((addr & kSmiTagMask) == kHeapObjectTag) &&
475 reinterpret_cast<RawObject*>(addr)->IsOldObject() &&
475 !Isolate::Current()->heap()->CodeContains(addr) && 476 !Isolate::Current()->heap()->CodeContains(addr) &&
476 Isolate::Current()->heap()->Contains(addr - kHeapObjectTag)) { 477 Isolate::Current()->heap()->OldContains(addr - kHeapObjectTag) &&
Ivan Posva 2014/01/07 20:54:59 CanFindOldObject does OldContains implicitly. So w
srdjan 2014/01/07 21:02:57 Removed call to OldContains.
478 Disassembler::CanFindOldObject(addr)) {
477 const Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr)); 479 const Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr));
478 if (obj.IsArray()) { 480 if (obj.IsArray()) {
479 const Array& arr = Array::Cast(obj); 481 const Array& arr = Array::Cast(obj);
480 intptr_t len = arr.Length(); 482 intptr_t len = arr.Length();
481 if (len > 5) len = 5; // Print a max of 5 elements. 483 if (len > 5) len = 5; // Print a max of 5 elements.
482 Print(" Array["); 484 Print(" Array[");
483 int i = 0; 485 int i = 0;
484 Object& element = Object::Handle(); 486 Object& element = Object::Handle();
485 while (i < len) { 487 while (i < len) {
486 element = arr.At(i); 488 element = arr.At(i);
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 pc); 1824 pc);
1823 pc += instruction_length; 1825 pc += instruction_length;
1824 } 1826 }
1825 1827
1826 return; 1828 return;
1827 } 1829 }
1828 1830
1829 } // namespace dart 1831 } // namespace dart
1830 1832
1831 #endif // defined TARGET_ARCH_IA32 1833 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698