Skip to content

Commit cc981c8

Browse files
committed
Don't use %p when generating disassembly in vm service.
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= [email protected] Review URL: https://codereview.chromium.org//1282993002 .
1 parent e9d2f73 commit cc981c8

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

runtime/observatory/lib/src/service/object.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3365,7 +3365,7 @@ class Code extends HeapObject {
33653365
var pcOffset = 0;
33663366
if (disassembly[i] != '') {
33673367
// Not a code comment, extract address.
3368-
address = int.parse(disassembly[i]);
3368+
address = int.parse(disassembly[i], radix:16);
33693369
pcOffset = address - startAddress;
33703370
}
33713371
var instruction = new CodeInstruction(address, pcOffset, machine, human);

runtime/observatory/tests/service/service.status

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
77
evaluate_activation_test/scope: RuntimeError # http://dartbug.com/20047
88

9-
# Unexpected number format: http://dartbug.com/24038
10-
[ $system == windows ]
11-
code_test: Skip
12-
139
# Disable on simulators.
1410
[ $arch == simarm || $arch == simmips || $arch == simarm64]
1511
*: SkipSlow

runtime/platform/globals.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,13 @@ typedef simd128_value_t fpu_register_t;
306306
#define Pu64 PRIu64
307307
#define Px64 PRIx64
308308

309+
// Zero-padded pointer
310+
#if defined(ARCH_IS_32_BIT)
311+
#define Pp "08" PRIxPTR
312+
#else
313+
#define Pp "016" PRIxPTR
314+
#endif
315+
309316

310317
// Suffixes for 64-bit integer literals.
311318
#ifdef _MSC_VER

runtime/vm/disassembler.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ void DisassembleToJSONStream::ConsumeInstruction(char* hex_buffer,
4646
char* human_buffer,
4747
intptr_t human_size,
4848
uword pc) {
49-
uint8_t* pc_ptr = reinterpret_cast<uint8_t*>(pc);
5049
// Instructions are represented as three consecutive values in a JSON array.
5150
// All three are strings. The first is the address of the instruction,
5251
// the second is the hex string of the code, and the final is a human
5352
// readable string.
54-
jsarr_.AddValueF("%p", pc_ptr);
53+
jsarr_.AddValueF("%" Pp "", pc);
5554
jsarr_.AddValue(hex_buffer);
5655
jsarr_.AddValue(human_buffer);
5756
}

0 commit comments

Comments
 (0)