File 0767-erts-Print-stackdump-in-crashdump-procdump-with-y-pr.patch of Package erlang
From 710045d6b5389be027fa389c8cc63e41ebec29f3 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Wed, 13 Oct 2021 09:42:17 +0200
Subject: [PATCH 2/2] erts: Print stackdump in crashdump/procdump with y prefix
In OTP-23 the placement of the top frame was changed and that
caused the stackdump printing algorithm to not prefix variables
in the first frame with y. i.e.
0x00007f72440b76f0:N
0x00007f72440b76f8:SReturn addr 0x44381898 (proc_lib:init_p_do_apply/3 + 72)
y0:P<0.9.0>
y1:P<0.10.0>
0x00007f72440b7718:SReturn addr 0x66325748 (<terminate process normally>)
was written instead of
y0:N
0x00007f72440b76f8:SReturn addr 0x44381898 (proc_lib:init_p_do_apply/3 + 72)
y0:P<0.9.0>
y1:P<0.10.0>
0x00007f72440b7718:SReturn addr 0x66325748 (<terminate process normally>)
The same issue was also fixed for erlang:process_display,
erlang:process_info(backtrace) and the ctrl-c proc dump.
---
erts/emulator/beam/erl_process.c | 10 +++++-----
erts/emulator/beam/erl_process_dump.c | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 8313a4863e..7a3ef3c5b2 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -561,7 +561,7 @@ do { \
static void exec_misc_ops(ErtsRunQueue *);
static void print_function_from_pc(fmtfn_t to, void *to_arg, BeamInstr* x);
-static int stack_element_dump(fmtfn_t to, void *to_arg, Eterm* sp, int yreg);
+static Uint stack_element_dump(fmtfn_t to, void *to_arg, Eterm* sp, Uint yreg);
static void aux_work_timeout(void *unused);
static void aux_work_timeout_early_init(int no_schedulers);
@@ -14149,7 +14149,7 @@ void
erts_stack_dump(fmtfn_t to, void *to_arg, Process *p)
{
Eterm* sp;
- int yreg = -1;
+ Uint yreg = 0;
if (ERTS_TRACE_FLAGS(p) & F_SENSITIVE) {
return;
@@ -14210,12 +14210,12 @@ print_function_from_pc(fmtfn_t to, void *to_arg, ErtsCodePtr x)
}
}
-static int
-stack_element_dump(fmtfn_t to, void *to_arg, Eterm* sp, int yreg)
+static Uint
+stack_element_dump(fmtfn_t to, void *to_arg, Eterm* sp, Uint yreg)
{
Eterm x = *sp;
- if (yreg < 0 || is_CP(x)) {
+ if (is_CP(x)) {
erts_print(to, to_arg, "\n%p ", sp);
} else {
char sbuf[16];
diff --git a/erts/emulator/beam/erl_process_dump.c b/erts/emulator/beam/erl_process_dump.c
index 3beafb4b3c..77bd344352 100644
--- a/erts/emulator/beam/erl_process_dump.c
+++ b/erts/emulator/beam/erl_process_dump.c
@@ -47,8 +47,8 @@ static void dump_process_info(fmtfn_t to, void *to_arg, Process *p);
static void dump_element(fmtfn_t to, void *to_arg, Eterm x);
static void dump_dist_ext(fmtfn_t to, void *to_arg, ErtsDistExternal *edep);
static void dump_element_nl(fmtfn_t to, void *to_arg, Eterm x);
-static int stack_element_dump(fmtfn_t to, void *to_arg, Eterm* sp,
- int yreg);
+static Uint stack_element_dump(fmtfn_t to, void *to_arg, Eterm* sp,
+ Uint yreg);
static void stack_trace_dump(fmtfn_t to, void *to_arg, Eterm* sp);
static void print_function_from_pc(fmtfn_t to, void *to_arg, BeamInstr* x);
static void heap_dump(fmtfn_t to, void *to_arg, Eterm x);
@@ -222,7 +222,7 @@ static void
dump_process_info(fmtfn_t to, void *to_arg, Process *p)
{
Eterm* sp;
- int yreg = -1;
+ Uint yreg = 0;
if (ERTS_TRACE_FLAGS(p) & F_SENSITIVE)
return;
@@ -402,8 +402,8 @@ erts_limited_stack_trace(fmtfn_t to, void *to_arg, Process *p)
}
-static int
-stack_element_dump(fmtfn_t to, void *to_arg, Eterm* sp, int yreg)
+static Uint
+stack_element_dump(fmtfn_t to, void *to_arg, Eterm* sp, Uint yreg)
{
Eterm x = *sp;
--
2.31.1