Skip to content

Commit

Permalink
Don't use %p when generating disassembly in vm service.
Browse files Browse the repository at this point in the history
Evidentally it is platform dependent -- it seems to include the 0x
prefix on mac but not on windows.  I've switched to using %" Px "
instead.

This will fix bug 24038.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1282993002 .
  • Loading branch information
turnidge committed Aug 11, 2015
1 parent e9d2f73 commit cc981c8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion runtime/observatory/lib/src/service/object.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3365,7 +3365,7 @@ class Code extends HeapObject {
var pcOffset = 0;
if (disassembly[i] != '') {
// Not a code comment, extract address.
address = int.parse(disassembly[i]);
address = int.parse(disassembly[i], radix:16);
pcOffset = address - startAddress;
}
var instruction = new CodeInstruction(address, pcOffset, machine, human);
Expand Down
4 changes: 0 additions & 4 deletions runtime/observatory/tests/service/service.status
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047

# Unexpected number format: http://dartbug.com/24038
[ $system == windows ]
code_test: Skip

# Disable on simulators.
[ $arch == simarm || $arch == simmips || $arch == simarm64]
*: SkipSlow
Expand Down
7 changes: 7 additions & 0 deletions runtime/platform/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ typedef simd128_value_t fpu_register_t;
#define Pu64 PRIu64
#define Px64 PRIx64

// Zero-padded pointer
#if defined(ARCH_IS_32_BIT)
#define Pp "08" PRIxPTR
#else
#define Pp "016" PRIxPTR
#endif


// Suffixes for 64-bit integer literals.
#ifdef _MSC_VER
Expand Down
3 changes: 1 addition & 2 deletions runtime/vm/disassembler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,11 @@ void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer,
char* human_buffer,
intptr_t human_size,
uword pc) {
uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc);
// Instructions are represented as three consecutive values in a JSON array.
// All three are strings. The first is the address of the instruction,
// the second is the hex string of the code, and the final is a human
// readable string.
jsarr_.AddValueF("%p", pc_ptr);
jsarr_.AddValueF("%" Pp "", pc);
jsarr_.AddValue(hex_buffer);
jsarr_.AddValue(human_buffer);
}
Expand Down

0 comments on commit cc981c8

Please sign in to comment.