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

Side by Side Diff: runtime/vm/disassembler_x64.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_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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 return chars; 800 return chars;
801 } 801 }
802 802
803 803
804 void DisassemblerX64::AppendAddressToBuffer(uint8_t* addr_byte_ptr) { 804 void DisassemblerX64::AppendAddressToBuffer(uint8_t* addr_byte_ptr) {
805 NoGCScope no_gc; 805 NoGCScope no_gc;
806 uword addr = reinterpret_cast<uword>(addr_byte_ptr); 806 uword addr = reinterpret_cast<uword>(addr_byte_ptr);
807 AppendToBuffer("%#" Px "", addr); 807 AppendToBuffer("%#" Px "", addr);
808 // Try to print as heap object or stub name 808 // Try to print as heap object or stub name
809 if (((addr & kSmiTagMask) == kHeapObjectTag) && 809 if (((addr & kSmiTagMask) == kHeapObjectTag) &&
810 reinterpret_cast<RawObject*>(addr)->IsOldObject() &&
810 !Isolate::Current()->heap()->CodeContains(addr) && 811 !Isolate::Current()->heap()->CodeContains(addr) &&
811 Isolate::Current()->heap()->Contains(addr - kHeapObjectTag)) { 812 Isolate::Current()->heap()->OldContains(addr - kHeapObjectTag) &&
Ivan Posva 2014/01/07 20:54:59 ditto
srdjan 2014/01/07 21:02:57 Done.
813 Disassembler::CanFindOldObject(addr)) {
812 const Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr)); 814 const Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr));
813 if (obj.IsArray()) { 815 if (obj.IsArray()) {
814 const Array& arr = Array::Cast(obj); 816 const Array& arr = Array::Cast(obj);
815 intptr_t len = arr.Length(); 817 intptr_t len = arr.Length();
816 if (len > 5) len = 5; // Print a max of 5 elements. 818 if (len > 5) len = 5; // Print a max of 5 elements.
817 AppendToBuffer(" Array["); 819 AppendToBuffer(" Array[");
818 int i = 0; 820 int i = 0;
819 Object& element = Object::Handle(); 821 Object& element = Object::Handle();
820 while (i < len) { 822 while (i < len) {
821 element = arr.At(i); 823 element = arr.At(i);
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 pc); 1940 pc);
1939 pc += instruction_length; 1941 pc += instruction_length;
1940 } 1942 }
1941 1943
1942 return; 1944 return;
1943 } 1945 }
1944 1946
1945 } // namespace dart 1947 } // namespace dart
1946 1948
1947 #endif // defined TARGET_ARCH_X64 1949 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698