From b3b9d321ce0622e1d774ad54e9700e22edde8abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 8 Jul 2015 16:13:30 +0200 Subject: Fix crash when disassembling modules with BIFs In a debug-compiled emulator, running erts_debug:df(io) would trigger an assertion failure: 1> erts_debug:df(io). beam/beam_debug.c:301:erts_debug_disassemble_1() Assertion failed: (((funcinfo[0]) & 0x3F) == ((0x0 << 4) | ((0x2 << 2) | 0x3))) Aborted (core dumped) It turns out that the assertion is wrong. It should have been updated in 64ccd8c9b7a7 which made it possible to have stubs for BIFs in the BEAM code for a module. The faulty assertion was only found when when 16317f73f79265 added a smoke test of the BEAM disassembler. --- erts/emulator/beam/beam_debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'erts') diff --git a/erts/emulator/beam/beam_debug.c b/erts/emulator/beam/beam_debug.c index 8a35ad17c6..c774a70d4c 100644 --- a/erts/emulator/beam/beam_debug.c +++ b/erts/emulator/beam/beam_debug.c @@ -298,8 +298,8 @@ erts_debug_disassemble_1(BIF_ALIST_1) (void) erts_bld_uword(NULL, &hsz, (BeamInstr) code_ptr); hp = HAlloc(p, hsz); addr = erts_bld_uword(&hp, NULL, (BeamInstr) code_ptr); - ASSERT(is_atom(funcinfo[0])); - ASSERT(is_atom(funcinfo[1])); + ASSERT(is_atom(funcinfo[0]) || funcinfo[0] == NIL); + ASSERT(is_atom(funcinfo[1]) || funcinfo[1] == NIL); mfa = TUPLE3(hp, (Eterm) funcinfo[0], (Eterm) funcinfo[1], make_small((Eterm) funcinfo[2])); hp += 4; return TUPLE3(hp, addr, bin, mfa); -- cgit v1.2.3