Skip to content
Snippets Groups Projects
Commit dbe79a9e authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Some more paranoia in describe_backtrace().

Rev: lib/master.pike.in:1.82
parent 97984877
No related branches found
No related tags found
No related merge requests found
/* -*- Pike -*- /* -*- Pike -*-
* *
* $Id: master.pike.in,v 1.81 1999/12/06 22:16:05 grubba Exp $ * $Id: master.pike.in,v 1.82 1999/12/06 23:55:41 grubba Exp $
* *
* Master-file for Pike. * Master-file for Pike.
* *
...@@ -65,7 +65,7 @@ string basename(string x) ...@@ -65,7 +65,7 @@ string basename(string x)
#define FILE_STAT_CACHE #define FILE_STAT_CACHE
#define UNDEFINED (([])[0]) #define UNDEFINED (([])[0])
#define error(X) throw( ({ (X), backtrace()[0..sizeof(backtrace())-2] }) ) #define error(X) throw( ({ (X), backtrace()/*[0..sizeof(backtrace())-2]*/ }) )
string describe_backtrace(mixed *trace); string describe_backtrace(mixed *trace);
object low_cast_to_object(string oname, string current_file); object low_cast_to_object(string oname, string current_file);
...@@ -1461,9 +1461,12 @@ string describe_backtrace(mixed trace, void|int linewidth) ...@@ -1461,9 +1461,12 @@ string describe_backtrace(mixed trace, void|int linewidth)
else if(arrayp(tmp)) else if(arrayp(tmp))
{ {
string pos; string pos;
if(sizeof(tmp)>=2 && stringp(tmp[0]) && intp(tmp[1])) if(sizeof(tmp)>=2 && stringp(tmp[0])) {
{ if (intp(tmp[1])) {
pos=trim_file_name(tmp[0])+":"+tmp[1]; pos=trim_file_name(tmp[0])+":"+tmp[1];
} else {
pos = sprintf("%s:Bad line %t", trim_file_name(tmp[0]), tmp[1]);
}
}else{ }else{
mixed desc="Unknown program"; mixed desc="Unknown program";
if(sizeof(tmp)>=3 && functionp(tmp[2])) if(sizeof(tmp)>=3 && functionp(tmp[2]))
...@@ -1499,6 +1502,8 @@ string describe_backtrace(mixed trace, void|int linewidth) ...@@ -1499,6 +1502,8 @@ string describe_backtrace(mixed trace, void|int linewidth)
}else{ }else{
row=sprintf("%s:\n%s",pos,sprintf(" %*-/s",linewidth-6,data)); row=sprintf("%s:\n%s",pos,sprintf(" %*-/s",linewidth-6,data));
} }
} else {
row = pos;
} }
} }
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment