From d2d1fead7626d0a5e5f96ae85053c5cfc27a4014 Mon Sep 17 00:00:00 2001 From: Henning Stahlke Date: Fri, 27 Mar 2020 22:34:26 +0100 Subject: [PATCH] modified output of debug.backtrace --- Nasal/debug.nas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Nasal/debug.nas b/Nasal/debug.nas index b684e5d4e..8b07ee4d6 100644 --- a/Nasal/debug.nas +++ b/Nasal/debug.nas @@ -278,7 +278,11 @@ var backtrace = func(desc = nil, dump_vars = 1, skip_level = 0) { skip_level += 1; for (var i = skip_level; 1; i += 1) { if ((var v = caller(i)) == nil) return; - print(_section(sprintf("#%-2d called from %s, line %s:", i - skip_level, v[2], v[3]))); + var filename = v[2]; + if (size(filename) > 50) + filename = substr(filename, 0, 5)~"[...]"~substr(filename, -40); + print(_section(sprintf("#%-2d called from %s, line %s (locals %s):", + i - skip_level, filename, v[3], id(v[0])))); if (dump_vars) dump(v[0]); } }