From d71c5604e7ba5e30391c493fb46e67a0284cef76 Mon Sep 17 00:00:00 2001 From: Mikael Pettersson Date: Sat, 11 Nov 2017 14:29:16 +0100 Subject: fix output formatting in several HiPE debug BIFs Fix formatting in hipe_bifs:show_pcb/1, hipe_bifs:show_estack/1, and hipe_bifs:show_nstack/1. fflush(stdout) before switching from printf() to erts_printf() to avoid garbled output. Adjust field lengths to work on both 64- and 32-bit systems. Tested on Linux/x86_64 (64-bit) and Linux/ARMv7 (32-bit). --- erts/emulator/hipe/hipe_risc_stack.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'erts/emulator/hipe/hipe_risc_stack.c') diff --git a/erts/emulator/hipe/hipe_risc_stack.c b/erts/emulator/hipe/hipe_risc_stack.c index 4001bedeb6..bb93a918a2 100644 --- a/erts/emulator/hipe/hipe_risc_stack.c +++ b/erts/emulator/hipe/hipe_risc_stack.c @@ -47,8 +47,10 @@ static void print_slot(Eterm *sp, unsigned int live) printf(" | 0x%0*lx | 0x%0*lx | ", 2*(int)sizeof(long), (unsigned long)sp, 2*(int)sizeof(long), val); - if (live) + if (live) { + fflush(stdout); erts_printf("%.30T", val); + } printf("\r\n"); } @@ -68,7 +70,9 @@ void hipe_print_nstack(Process *p) [0 ... 2*sizeof(long)+3] = '-' }; - printf(" | NATIVE STACK |\r\n"); + printf(" | %*s NATIVE STACK %*s |\r\n", + 2*(int)sizeof(long)-5, "", + 2*(int)sizeof(long)-4, ""); printf(" |%s|%s|\r\n", dashes, dashes); printf(" | %*s | 0x%0*lx |\r\n", 2+2*(int)sizeof(long), "heap", -- cgit v1.2.3