"Will Coleda" <[EMAIL PROTECTED]> wrote:
Storing the information is very good: how do we extract it, again? we
have {get,set}{file,line} opcodes, but if we're going to store more
generic information, we need a more generic way to extract it.
My current thinking on this is that a HLL will define a sub that knows how
to print errors for that HLL. That sub would be passed an array PMC, with
element 0 representing the current sub, element 1 representing it's caller,
etc, so you can produce a backtrace. Each entry in the array would be a
hash containing the HLL debug info. So a very simple handler could maybe
look like:-
.sub err_handler
.param pmc bt
.local pmc entry
.local int i, elems
elems = elements bt
i = 0
LOOP:
if i >= elems goto END
entry = bt[i]
print "Error at line "
print entry["line"]
print " column "
print entry["column"]
print " of file "
print entry["file"]
print "\n"
inc i
goto LOOP
END:
.end
But there is also an issue relating to what if some of the BT is from
another HLL's code, so it may not be able to be quite as simple as I suggest
there. Also, the exception that was thrown should probably be a parameter
to that sub too.
As one of the first "here's something extra I need", I need not only line
numbers for files, but line numbers of user defined subroutines and eval
blocks. (that is, the line *of the sub def* that the error occurs on, in
addition to each line as we go.)
Unless I'm missing something, that's fine with what I proposed; you can emit
a ".hll_debug line 42" or similar without having to specify a filename. The
line number means whatever you'd like it to mean - it doesn't have to be
line number in a file.
user generated error
while executing
"error "user generated error""
Am I right in thinking that:
error "user generated error"
Comes from the source text of the tcl program?
Thanks,
Jonathan