From be04820c070d01d7565b936fa14efc2941055e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 16 Feb 2011 06:54:15 +0100 Subject: emulator: Add a fourth element in exception stacktraces This commit is a preparation for introducing location information (filename/line number) in stacktraces in exceptions. Currently a stack trace looks like: [{Mod1,Function1,Arity1}, . . . {ModN,FunctionN,ArityN}] Add a forth element to each tuple that can be used indication the filename and line number of the source file: [{Mod1,Function1,Arity1,Location1}, . . . {ModN,FunctionN,ArityN,LocationN}] In this commit, the fourth element will just be an empty list, and we will change all code that look at or manipulate stacktraces. --- erts/emulator/beam/beam_emu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'erts/emulator/beam/beam_emu.c') diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c index ef992487be..0bd5e27843 100644 --- a/erts/emulator/beam/beam_emu.c +++ b/erts/emulator/beam/beam_emu.c @@ -5948,18 +5948,18 @@ build_stacktrace(Process* c_p, Eterm exc) { { int i; Eterm mfa; - Uint heap_size = 6*(depth+1); + Uint heap_size = 7*(depth+1); Eterm* hp = HAlloc(c_p, heap_size); Eterm* hp_end = hp + heap_size; if (args != am_true) { /* We have an arglist - use it */ - mfa = TUPLE3(hp, current[0], current[1], args); + mfa = TUPLE4(hp, current[0], current[1], args, NIL); } else { Eterm arity = make_small(current[2]); - mfa = TUPLE3(hp, current[0], current[1], arity); + mfa = TUPLE4(hp, current[0], current[1], arity, NIL); } - hp += 4; + hp += 5; ASSERT(*next_p == NIL); *next_p = CONS(hp, mfa, NIL); next_p = &CDR(list_val(*next_p)); @@ -5971,8 +5971,8 @@ build_stacktrace(Process* c_p, Eterm exc) { for (i = 0; i < depth; i++) { BeamInstr *fi = find_function_from_pc((BeamInstr *) s->trace[i]); if (fi == NULL) continue; - mfa = TUPLE3(hp, fi[0], fi[1], make_small(fi[2])); - hp += 4; + mfa = TUPLE4(hp, fi[0], fi[1], make_small(fi[2]), NIL); + hp += 5; ASSERT(*next_p == NIL); *next_p = CONS(hp, mfa, NIL); next_p = &CDR(list_val(*next_p)); -- cgit v1.2.3