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

Side by Side Diff: runtime/vm/disassembler_x64.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/disassembler_ia32.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 (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_X64) 8 #if defined(TARGET_ARCH_X64)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 OS::SNPrint(chars, len, format, full_class_name); 792 OS::SNPrint(chars, len, format, full_class_name);
793 return chars; 793 return chars;
794 } 794 }
795 795
796 796
797 void DisassemblerX64::AppendAddressToBuffer(uint8_t* addr_byte_ptr) { 797 void DisassemblerX64::AppendAddressToBuffer(uint8_t* addr_byte_ptr) {
798 NoGCScope no_gc; 798 NoGCScope no_gc;
799 uword addr = reinterpret_cast<uword>(addr_byte_ptr); 799 uword addr = reinterpret_cast<uword>(addr_byte_ptr);
800 AppendToBuffer("%#"Px"", addr); 800 AppendToBuffer("%#"Px"", addr);
801 // Try to print as heap object or stub name 801 // Try to print as heap object or stub name
802 if (!Isolate::Current()->heap()->CodeContains(addr) && 802 if (((addr & kSmiTagMask) == kHeapObjectTag) &&
803 !Isolate::Current()->heap()->CodeContains(addr) &&
803 Isolate::Current()->heap()->Contains(addr - kHeapObjectTag)) { 804 Isolate::Current()->heap()->Contains(addr - kHeapObjectTag)) {
804 Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr)); 805 Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr));
805 if (obj.IsArray()) { 806 if (obj.IsArray()) {
806 const Array& arr = Array::CheckedHandle(obj.raw()); 807 const Array& arr = Array::CheckedHandle(obj.raw());
807 intptr_t len = arr.Length(); 808 intptr_t len = arr.Length();
808 if (len > 5) len = 5; // Print a max of 5 elements. 809 if (len > 5) len = 5; // Print a max of 5 elements.
809 AppendToBuffer(" Array["); 810 AppendToBuffer(" Array[");
810 int i = 0; 811 int i = 0;
811 while (i < len) { 812 while (i < len) {
812 obj = arr.At(i); 813 obj = arr.At(i);
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 human_buffer, 1859 human_buffer,
1859 sizeof(human_buffer), 1860 sizeof(human_buffer),
1860 pc); 1861 pc);
1861 pc += instruction_length; 1862 pc += instruction_length;
1862 } 1863 }
1863 } 1864 }
1864 1865
1865 } // namespace dart 1866 } // namespace dart
1866 1867
1867 #endif // defined TARGET_ARCH_X64 1868 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/disassembler_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698