Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Low-Level crash tracing errorInfo

4 views
Skip to first unread message

ctasada

unread,
Jun 8, 2009, 4:23:41 AM6/8/09
to
Hi guys,

I'm trying to have a detailed errorStack in Tcl. My intention is
double, on one hand I want to have more info when executing bytecoded
procs, and on the other hand I want to detect catched errors in a
legacy code.

Searching a bit I found a nice example, using traces with errorInfo,
in http://wiki.tcl.tk/2626, but I found it's crashing a lot. What am I
doing wrong? is still bug 1038021 or some bug related causing
problems?

Here is the code I'm using:

================================================
# From http://wiki.tcl.tk/2626

set ::errorLevel -1

set ::errorStack {}

trace add variable ::errorInfo write {

set __n [info level]

if {($__n > 0) && ($__n != $::errorLevel)} {

set ::errorLevel $__n

set __l [info level 0]

lappend ::errorStack $__l

} else {

puts "======================"

puts "ERROR Found: "

puts $::errorInfo

puts "----------------------"

puts [join $::errorStack \n]

puts "======================"

set ::errorLevel -1;

set ::errorStack [list];

}

}
================================================

Now if I execute the next code I get a low-level crash

set ::Total 0

proc A {a} {

if {catch {[expr {5 + [B $a]}]} err} {

puts "Something went wrong"

set ::Total $a

}

}

proc B {b} {

incr $b

return b

}

And yes, I known that should be "if {[catch {[expr {5 + [B $a]}]}
err]} {", but that's not the point here ;)

I'm running ActiveTcl 8.5.4 and executing in the wish console, so no
bytecode related. I'm looking deeply because I also found a nasty
"TclStackFree: incorrect freePtr" when running in my code, but so far
I cannot replicate it with an small example :(


Alexandre Ferrieux

unread,
Jun 8, 2009, 5:28:02 AM6/8/09
to
On Jun 8, 10:23 am, ctasada <ctas...@gmail.com> wrote:
> Hi guys,
>
> I'm trying to have a detailed errorStack in Tcl. My intention is
> double, on one hand I want to have more info when executing bytecoded
> procs, and on the other hand I want to detect catched errors in a
> legacy code.
>
> Searching a bit I found a nice example, using traces with errorInfo,
> inhttp://wiki.tcl.tk/2626, but I found it's crashing a lot. What am I

> doing wrong? is still bug 1038021 or some bug related causing
> problems?
>
> Here is the code I'm using:
>
> ================================================
> # Fromhttp://wiki.tcl.tk/2626

Interesting !!!

Funnily,

proc A a {if {foo} {puts BAD}}

triggers the segfault, while

proc B b {expr {foo}}

doesn't.

Also,

::tcl::unsupported::disassemble proc A

triggers it too.

So it would seem there's something wrong at compile time.
In any case, this is nasty enough to deserve a bug report :-)

> I'm looking deeply because I also found a nasty
> "TclStackFree: incorrect freePtr" when running in my code, but so far
> I cannot replicate it with an small example :(

This may deserve yet another report, where you can start pouring
evidence...

-Alex

miguel sofer

unread,
Jun 8, 2009, 8:09:10 AM6/8/09
to

Alexandre Ferrieux

unread,
Jun 15, 2009, 6:56:28 PM6/15/09
to
On Jun 8, 2:09 pm, miguel sofer <mso...@users.sf.net> wrote:
> Logged as bug # 2802881 in SF:https://sourceforge.net/tracker/?func=detail&aid=2802881&group_id=108...
>
> Thanks for the reports.

Just for the record: Don has just fixed it for 8.4.20 and 8.[56].

-Alex

0 new messages