Discussion:
[info stacktrace] → ask for assistance
Add Reply
aotto1968
2024-11-25 21:13:38 UTC
Reply
Permalink
Hi,

my goal is to transfer the "errorInfo" into a "stacktrace" used by my SW.

-> I require: command, fileName and lineNumber
-> the [info errorstack] return "something" which is missing some essential parts.
INNER {invokeStk1 ::tcllcconfig::LcSettingC::MK_NULL LookupBool in} CALL {::oo::Obj40::my LcSettingLookupBool}
as I understand:

$setting LookupBool $name == ::tcllcconfig::LcSettingC::MK_NULL LookupBool in
-> problem: post versa pre parse expression
-> problem: the fileName(class etc) is *not* available


==== lcconfig-2-0-5-(0-0-0+binary+pipe+tcl.pipe.pipe) use invalid cfs FAILED
---- Result was:
C> (client-0-0-0) [ServiceCallError] <Tok|2E3A471B{LcSettingRpc::LookupBool}> <Num|1>
S> (server-0-0-0) [tcl_mqmsgque_ServiceCall] 'LcSettingC' hdl is NULL
while executing
"$setting LookupBool $name"
(class "::LibLcConfigRpcServer" method "LcSettingLookupBool" line 4)
invoked from within
"::oo::Obj40::my LcSettingLookupBool"
C> (client-0-0-0) | 871 | send_mq.c | MqSendEND_AND_WAIT_RT
C> (client-0-0-0) | 508 | high_lng.h | $ctx Send 'W' ... '2E3A471B{LcSettingRpc::LookupBool}:***@O' ...
C> (client-0-0-0) | 522 | high_lng.h | $ctx Send...
C> (client-0-0-0) | 75 | ~KernelRpcClient.tcl | my Send $typ $fmt {*}$args
C> (client-0-0-0) | 588 | ~ConfigRpcClient.tcl | $rpc send "W" "2E3A471B{LcSettingRpc::LookupBool}:***@O" $hdl $name
C> (client-0-0-0) | 3 | lcconfig.test | $null LookupBool in
C> (client-0-0-0) | 2405 | tcltest-2.5.3.tm | uplevel 1 $script
C> (client-0-0-0) | 1 | lcconfig.test | ::tcltest::RunTest lcconfig-2-0-5-(0-0-0+binary+pipe+tcl.pipe.pipe) { ...
C> (client-0-0-0) | 1651 | tcltest-2.5.3.tm | uplevel 1 $script
C> (client-0-0-0) | 1 | lcconfig.test | ::tcltest::Eval {::tcltest::RunTest
lcconfig-2-0-5-(0-0-0+binary+pipe+tcl.pipe.pipe) { ...
C> (client-0-0-0) | 2021 | tcltest-2.5.3.tm | uplevel 1 [list [namespace origin Eval] $command 1]
C> (client-0-0-0) | 87 | lcconfig.test | test lcconfig-2-0-5-($F+$B+$C+$S) { use invalid cfs } -constraints {$B
eq "binary"} -setup { ...
C> (client-0-0-0) | 6 | lcconfig.test | foreach F [handles] { ...
C> (client-0-0-0) | 649 | library.tcl | uplevel $code
C> (client-0-0-0) | 195 | lcconfig.test | Block 2 { ...
C> (client-0-0-0) | 104 | lcconfig.test | foreach S [filter SRV_LST $C ] { ...
C> (client-0-0-0) | 101 | lcconfig.test | foreach C [getEnv COM_LST] { ...
C> (client-0-0-0) | 98 | lcconfig.test | foreach B [getEnv BIN_LST] { ...
Harald Oehlmann
2024-11-26 08:09:16 UTC
Reply
Permalink
Hi,
remark that "info errorstack" and the stack trace are different things.
In the first, variable names are replaced by values.
In the second, there are the variable names "$var".

They don't match directly.

THanks,
Harald
Post by aotto1968
Hi,
my goal is to transfer the "errorInfo" into a "stacktrace" used by my SW.
-> I require: command, fileName and lineNumber
-> the [info errorstack] return "something" which is missing some essential parts.
INNER {invokeStk1 ::tcllcconfig::LcSettingC::MK_NULL LookupBool in}
CALL {::oo::Obj40::my LcSettingLookupBool}
$setting LookupBool $name == ::tcllcconfig::LcSettingC::MK_NULL LookupBool in
-> problem: post versa pre parse expression
-> problem: the fileName(class etc) is *not* available
==== lcconfig-2-0-5-(0-0-0+binary+pipe+tcl.pipe.pipe) use invalid cfs FAILED
C> (client-0-0-0)   [ServiceCallError] <Tok|
2E3A471B{LcSettingRpc::LookupBool}> <Num|1>
S> (server-0-0-0)   [tcl_mqmsgque_ServiceCall] 'LcSettingC' hdl is NULL
    while executing
"$setting LookupBool $name"
    (class "::LibLcConfigRpcServer" method "LcSettingLookupBool" line 4)
    invoked from within
"::oo::Obj40::my LcSettingLookupBool"
C> (client-0-0-0)     | 871   | send_mq.c            |
MqSendEND_AND_WAIT_RT
C> (client-0-0-0)     | 508   | high_lng.h           | $ctx Send 'W' ...
C> (client-0-0-0)     | 522   | high_lng.h           | $ctx Send...
C> (client-0-0-0)     | 75    | ~KernelRpcClient.tcl | my Send $typ $fmt
{*}$args
C> (client-0-0-0)     | 588   | ~ConfigRpcClient.tcl | $rpc send "W"
C> (client-0-0-0)     | 3     | lcconfig.test        | $null LookupBool in
C> (client-0-0-0)     | 2405  | tcltest-2.5.3.tm     | uplevel 1 $script
C> (client-0-0-0)     | 1     | lcconfig.test
| ::tcltest::RunTest lcconfig-2-0-5-(0-0-0+binary+pipe+tcl.pipe.pipe) { ...
C> (client-0-0-0)     | 1651  | tcltest-2.5.3.tm     | uplevel 1 $script
C> (client-0-0-0)     | 1     | lcconfig.test        | ::tcltest::Eval
{::tcltest::RunTest lcconfig-2-0-5-(0-0-0+binary+pipe+tcl.pipe.pipe) { ...
C> (client-0-0-0)     | 2021  | tcltest-2.5.3.tm     | uplevel 1 [list
[namespace origin Eval] $command 1]
C> (client-0-0-0)     | 87    | lcconfig.test        | test
lcconfig-2-0-5-($F+$B+$C+$S) { use invalid cfs }  -constraints {$B eq
"binary"}  -setup { ...
C> (client-0-0-0)     | 6     | lcconfig.test        | foreach F
[handles] { ...
C> (client-0-0-0)     | 649   | library.tcl          | uplevel $code
C> (client-0-0-0)     | 195   | lcconfig.test        | Block 2 { ...
C> (client-0-0-0)     | 104   | lcconfig.test        | foreach S [filter
SRV_LST $C ] { ...
C> (client-0-0-0)     | 101   | lcconfig.test        | foreach C [getEnv
COM_LST] { ...
C> (client-0-0-0)     | 98    | lcconfig.test        | foreach B [getEnv
BIN_LST] { ...
aotto1968
2024-11-26 18:58:58 UTC
Reply
Permalink
Post by Harald Oehlmann
Hi,
remark that "info errorstack" and the stack trace are different things.
In the first, variable names are replaced by values.
In the second, there are the variable names "$var".
They don't match directly.
THanks,
Harald
This is funny because "errorInfo" and "errorStack" are written in the same proc "

/*
*----------------------------------------------------------------------
*
* TclLogCommandInfo --
*
* This function is invoked after an error occurs in an interpreter. It
* adds information to iPtr->errorInfo/errorStack fields to describe the
* command that was being executed when the error occurred. When pc and
* tosPtr are non-NULL, conveying a bytecode execution "inner context",
* and the offending instruction is suitable, that inner context is
* recorded in errorStack.
*
* Results:
* None.
*
* Side effects:
* Information about the command is added to errorInfo/errorStack and the
* line number stored internally in the interpreter is set.
*
*----------------------------------------------------------------------
*/

and the "errorInfo" has a BETTER info than the "errorStack" ?

I use to raise MY error in a my-error-raise-proc and I use [info frame..] to collect all
the required data to build my-errorStack proper.

The problem is the "errorStack" from OTHER software or from TCL self witch do NOT
collect all the available Info.

My question is simple:

why someone program a [info errorstack ...] to provide an API for a missing feature and
do NOT call all the data available from [info frame] ?

TCL could have a wonderful "exception" interface

1. The (Tcl_GetReturnOptions) dict is the "exception-object"
Post by Harald Oehlmann
Tcl_GetReturnOptions(interp,TCL_ERROR): -code 1 -level 0 -errorstack {INNER {invokeStk1
::tcllcconfig::LcSettingC::MK_NULL LookupBool in} CALL {::oo::Obj40::my LcSettingLookupBool}} -errorcode NONE -errorinfo
{'LcSettingC' hdl is NULL
Post by Harald Oehlmann
while executing
"$setting LookupBool $name"
(class "::LibLcConfigRpcServer" method "LcSettingLookupBool" line 4)
invoked from within
"::oo::Obj40::my LcSettingLookupBool"} -errorline 1
2. The "-errorstack" key has the LIST of [info frame] dicts until catch

-> everyone is happy

Loading...