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

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

Issue 10915256: FIx crash in disassembler: check that an addrs is tagged before testing it to be part of the heap. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/disassembler_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 return chars; 414 return chars;
415 } 415 }
416 416
417 417
418 void X86Decoder::PrintAddress(uword addr) { 418 void X86Decoder::PrintAddress(uword addr) {
419 NoGCScope no_gc; 419 NoGCScope no_gc;
420 char addr_buffer[32]; 420 char addr_buffer[32];
421 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%#"Px"", addr); 421 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%#"Px"", addr);
422 Print(addr_buffer); 422 Print(addr_buffer);
423 // Try to print as heap object or stub name 423 // Try to print as heap object or stub name
424 if (!Isolate::Current()->heap()->CodeContains(addr) && 424 if (((addr & kSmiTagMask) == kHeapObjectTag) &&
425 !Isolate::Current()->heap()->CodeContains(addr) &&
425 Isolate::Current()->heap()->Contains(addr - kHeapObjectTag)) { 426 Isolate::Current()->heap()->Contains(addr - kHeapObjectTag)) {
426 Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr)); 427 Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr));
427 if (obj.IsArray()) { 428 if (obj.IsArray()) {
428 const Array& arr = Array::CheckedHandle(obj.raw()); 429 const Array& arr = Array::CheckedHandle(obj.raw());
429 intptr_t len = arr.Length(); 430 intptr_t len = arr.Length();
430 if (len > 5) len = 5; // Print a max of 5 elements. 431 if (len > 5) len = 5; // Print a max of 5 elements.
431 Print(" Array["); 432 Print(" Array[");
432 int i = 0; 433 int i = 0;
433 while (i < len) { 434 while (i < len) {
434 obj = arr.At(i); 435 obj = arr.At(i);
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 human_buffer, 1640 human_buffer,
1640 sizeof(human_buffer), 1641 sizeof(human_buffer),
1641 pc); 1642 pc);
1642 pc += instruction_length; 1643 pc += instruction_length;
1643 } 1644 }
1644 } 1645 }
1645 1646
1646 } // namespace dart 1647 } // namespace dart
1647 1648
1648 #endif // defined TARGET_ARCH_IA32 1649 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/disassembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698