Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/Dynamic+call+graph?V=9
QUERY_STRINGV=9
CONTENT_TYPE
DOCUMENT_URI/revision/Dynamic+call+graph
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.70.126.234
REMOTE_PORT16060
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.128.78.41
HTTP_CF_RAY87b7f189d86d2980-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP3.128.78.41
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit {Dynamic call graph} {[Richard Suchenwirth] 2005-07-13 - Here's a simple sketch how you can get the "dynamic call graph" (which shows which procedure actually called which other in a program run). The idea is to overload the [proc] command, so that every proc body is augmented (in the beginning) with a call to a helper that records the names of caller and callee in a global array:

======
 rename proc _proc
 _proc proc {name argl body} {
    _proc $name $argl callgraph'report\n$body
 }
 #-- This argument-less proc is prefixed to every proc defined with the overloaded command:
 _proc callgraph'report {} {
    if [catch {info level -2} res] {set res ""}
    set ::callgraph([lindex $res 0],[lindex [info level -1] 0]) ""
 }
======

#--- Testing
 proc a {} {b; c }
 proc b args {d; e}
 proc c {} {b; d}
 proc d {} {}
 proc e {} {}

 a
 parray callgraph
======
which returns (the values are always "", a key a,b expresses that a called b):
======
 callgraph(,a)      =
 callgraph(,parray) =
 callgraph(a,b)     =
 callgraph(a,c)     =
 callgraph(b,d)     =
 callgraph(b,e)     =
 callgraph(c,b)     =
 callgraph(c,d)     =
======
If there is nothing left of the comma, the procedure was called outside of any proc, i.e. interactively or at script toplevel. Note that [parray] was also instrumented, because its file was sourced after the overloading of [proc]. You can do further analyses on the ''callgraph'' array, for instance find out all callers of b:
======
   array names callgraph *,b
======
or all procedures that b called:
======
   array names callgraph b,*
======
Another enhancement would be to record the number an edge of the callgraph was traversed, by counting up:

======
 _proc callgraph'report {} {
    if [catch {info level -2} res] {set res ""}
    set edge [lindex $res 0],[lindex [info level -1] 0]
    if [info exists ::callgraph($edge)] {
        incr ::callgraph($edge)
    } else {set ::callgraph($edge) 1}
 }
======

----
I used the same idea to generate a history of the procedure calls to stderr - VPT

======
 _proc proc {name arg body} {
     uplevel [list _proc $name $arg "puts stderr \[string repeat {  } \[info level]]$name\n$body"]
 }
======
The uplevel is needed for commands within namespaces. (Thanks to Ralf Fassel) [EvilSon]

----
Here is some code that does [Static call graph]

----
Here is another approach to tracing procedure calls ... [Pstack]. The advantage to this approach is that only the procedures of interest are traced which is helpful when debugging. The output is also indented based on call depth. [tjk]

<<categories>> Debugging | Arts and crafts of Tcl-Tk programming} regexp2} CALL {my render {Dynamic call graph} {[Richard Suchenwirth] 2005-07-13 - Here's a simple sketch how you can get the "dynamic call graph" (which shows which procedure actually called which other in a program run). The idea is to overload the [proc] command, so that every proc body is augmented (in the beginning) with a call to a helper that records the names of caller and callee in a global array:

======
 rename proc _proc
 _proc proc {name argl body} {
    _proc $name $argl callgraph'report\n$body
 }
 #-- This argument-less proc is prefixed to every proc defined with the overloaded command:
 _proc callgraph'report {} {
    if [catch {info level -2} res] {set res ""}
    set ::callgraph([lindex $res 0],[lindex [info level -1] 0]) ""
 }
======

#--- Testing
 proc a {} {b; c }
 proc b args {d; e}
 proc c {} {b; d}
 proc d {} {}
 proc e {} {}

 a
 parray callgraph
======
which returns (the values are always "", a key a,b expresses that a called b):
======
 callgraph(,a)      =
 callgraph(,parray) =
 callgraph(a,b)     =
 callgraph(a,c)     =
 callgraph(b,d)     =
 callgraph(b,e)     =
 callgraph(c,b)     =
 callgraph(c,d)     =
======
If there is nothing left of the comma, the procedure was called outside of any proc, i.e. interactively or at script toplevel. Note that [parray] was also instrumented, because its file was sourced after the overloading of [proc]. You can do further analyses on the ''callgraph'' array, for instance find out all callers of b:
======
   array names callgraph *,b
======
or all procedures that b called:
======
   array names callgraph b,*
======
Another enhancement would be to record the number an edge of the callgraph was traversed, by counting up:

======
 _proc callgraph'report {} {
    if [catch {info level -2} res] {set res ""}
    set edge [lindex $res 0],[lindex [info level -1] 0]
    if [info exists ::callgraph($edge)] {
        incr ::callgraph($edge)
    } else {set ::callgraph($edge) 1}
 }
======

----
I used the same idea to generate a history of the procedure calls to stderr - VPT

======
 _proc proc {name arg body} {
     uplevel [list _proc $name $arg "puts stderr \[string repeat {  } \[info level]]$name\n$body"]
 }
======
The uplevel is needed for commands within namespaces. (Thanks to Ralf Fassel) [EvilSon]

----
Here is some code that does [Static call graph]

----
Here is another approach to tracing procedure calls ... [Pstack]. The advantage to this approach is that only the procedures of interest are traced which is helpful when debugging. The output is also indented based on call depth. [tjk]

<<categories>> Debugging | Arts and crafts of Tcl-Tk programming}} CALL {my revision {Dynamic call graph}} CALL {::oo::Obj2649908 process revision/Dynamic+call+graph} CALL {::oo::Obj2649906 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4