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

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

Issue 1331623002: Uses SNPRINT macro where possible. Otherwise uses #define for format. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Format string fixes Created 5 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
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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 obj.IsBool() || 472 obj.IsBool() ||
473 obj.IsClass() || 473 obj.IsClass() ||
474 obj.IsFunction() || 474 obj.IsFunction() ||
475 obj.IsICData() || 475 obj.IsICData() ||
476 obj.IsField()) { 476 obj.IsField()) {
477 return obj.ToCString(); 477 return obj.ToCString();
478 } 478 }
479 479
480 const Class& clazz = Class::Handle(obj.clazz()); 480 const Class& clazz = Class::Handle(obj.clazz());
481 const char* full_class_name = clazz.ToCString(); 481 const char* full_class_name = clazz.ToCString();
482 const char* format = "instance of %s"; 482 char* chars = NULL;
483 intptr_t len = OS::SNPrint(NULL, 0, format, full_class_name) + 1; 483 SNPRINT(chars, Thread::Current()->zone()->Alloc<char>, "instance of %s",
484 char* chars = Thread::Current()->zone()->Alloc<char>(len); 484 full_class_name);
485 OS::SNPrint(chars, len, format, full_class_name);
486 return chars; 485 return chars;
487 } 486 }
488 487
489 488
490 void X86Decoder::PrintAddress(uword addr) { 489 void X86Decoder::PrintAddress(uword addr) {
491 char addr_buffer[32]; 490 char addr_buffer[32];
492 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%#" Px "", addr); 491 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%#" Px "", addr);
493 Print(addr_buffer); 492 Print(addr_buffer);
494 // Try to print as heap object or stub name 493 // Try to print as heap object or stub name
495 if (((addr & kSmiTagMask) == kHeapObjectTag) && 494 if (((addr & kSmiTagMask) == kHeapObjectTag) &&
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 } 1868 }
1870 hex_buffer[hex_index] = '\0'; 1869 hex_buffer[hex_index] = '\0';
1871 if (out_instr_len) { 1870 if (out_instr_len) {
1872 *out_instr_len = instruction_length; 1871 *out_instr_len = instruction_length;
1873 } 1872 }
1874 } 1873 }
1875 1874
1876 } // namespace dart 1875 } // namespace dart
1877 1876
1878 #endif // defined TARGET_ARCH_IA32 1877 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/disassembler_x64.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698