From c6473253cdc7198061f43d3845f97a27bb5a3f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Tue, 21 Oct 1997 19:36:31 -0700 Subject: [PATCH] backtraces improved Rev: lib/master.pike:1.54 Rev: src/builtin_functions.c:1.49 --- lib/master.pike | 11 ++++++++--- src/builtin_functions.c | 19 +++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lib/master.pike b/lib/master.pike index b5a863d734..00a47c5d17 100644 --- a/lib/master.pike +++ b/lib/master.pike @@ -1,4 +1,4 @@ -/* $Id: master.pike,v 1.53 1997/10/20 22:49:10 hubbe Exp $ +/* $Id: master.pike,v 1.54 1997/10/22 02:36:15 hubbe Exp $ * * Master-file for Pike. */ @@ -712,9 +712,14 @@ string describe_backtrace(mixed *trace) else if(arrayp(tmp)) { row=""; - if(sizeof(tmp)>=3 && functionp(tmp[2])) + if(sizeof(tmp)>=3) { - row=function_name(tmp[2])+"("; + if(functionp(tmp[2])) + row=function_name(tmp[2]); + else + row="unknown function"; + + row+="("; for(int e=3;e<sizeof(tmp);e++) { row+=stupid_describe(tmp[e])+","; diff --git a/src/builtin_functions.c b/src/builtin_functions.c index 1476e3daeb..a60153b343 100644 --- a/src/builtin_functions.c +++ b/src/builtin_functions.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: builtin_functions.c,v 1.48 1997/10/14 10:00:01 hubbe Exp $"); +RCSID("$Id: builtin_functions.c,v 1.49 1997/10/22 02:36:31 hubbe Exp $"); #include "interpret.h" #include "svalue.h" #include "pike_macros.h" @@ -303,7 +303,7 @@ void f_backtrace(INT32 args) frames--; - if(f->current_object && f->current_object->prog) + if(f->current_object && f->context.prog) { INT32 args; args=f->num_args; @@ -315,10 +315,17 @@ void f_backtrace(INT32 args) ITEM(a)[frames].u.array=i=allocate_array_no_init(3+args,0); ITEM(a)[frames].type=T_ARRAY; assign_svalues_no_free(ITEM(i)+3, f->locals, args, BIT_MIXED); - ITEM(i)[2].type=T_FUNCTION; - ITEM(i)[2].subtype=f->fun; - ITEM(i)[2].u.object=f->current_object; - f->current_object->refs++; + if(f->current_object->prog) + { + ITEM(i)[2].type=T_FUNCTION; + ITEM(i)[2].subtype=f->fun; + ITEM(i)[2].u.object=f->current_object; + f->current_object->refs++; + }else{ + ITEM(i)[2].type=T_INT; + ITEM(i)[2].subtype=NUMBER_DESTRUCTED; + ITEM(i)[2].u.integer=0; + } if(f->pc) { -- GitLab