Re: TIP #280, extended callframe introspection and debugging



On 24 Oct 2006 13:15:28 -0700,
"Alex" <alexandre.ferrieux@xxxxxxxxx> wrote:

On Oct 24, 8:15 pm, "Eckhard Lehmann" <eck...@xxxxxx> wrote:
A question in addition to that: is it planned or in work to have
builtin breakpoints, for stopping the execution of a script at a
certain position - or on errors?

It sure would be cool to have many bells and whistles, but I believe
your two proposals have a very different status:
1) Breaking at a certain position: it's doable today, just by
instrumenting the code, thanks to Tcl's introspective power ([info
body] et al).

Sounds like an "error hook" type job. Allow it to run before the error
begins to be propagated away. Of course, not good to be doing this
from within a [catch]... And a [catch] that re-propagates an error
will fowl it up also.

On the other hand, if it's [catch] that's installing the hook, then it
can install a function which will selectively ignore errors it's
expecting, and either fix it, or allow it to continue on... These hook
functions could stack (unlike the [catch]s which are simply layered),
allowing a general debugging level to do whatever it wants; such as
storing the current call environment, or bringing up a debugging
console.

This would NOT be the recommended means of catching errors. But it
would allow for an error console or other debugging apparatus to jump
in, inspect the state of the program, and either allow it to continue
propagating the error (after taking a look around first), halt it right
there where it stands (don't pass go, don't collect $200), or clear the
error condition and continue on as though nothing'd happened (maybe
making it possible at some stage to introduce a kind of demand-based
functionality).


Now, come to think of (2) again, one possibility would be to enrich
the "errorStack" mechanism I proposed on the wiki a few months ago,
so that the trace contains, not only the various [info level 0]
(function and args at each level), but also the [info locals]. Of
course enabling this would put a burden on the interpreter's memory
footprint, because many data would linger with a non-zero refcount
until something resets the trace list. But this would enable pretty
cool debugging tools like the one you outline.

An error has to be caught, otherwise the program explodes. So when you
catch the error, it would be your responsibility to also deal with this
extra information. Something like a -preservestate option to [error]
allowing it to rethrow all that information instead allowing the
[catch] to ground it. (There's your "something that resets the trace
list", right there.)

Hmmm... The poor [error] and [catch] commands are getting a bit of a
work-out lately... ;)


Fredderic
.



Relevant Pages

  • .Net not able to debug a webform
    ... Error while trying to run project: Unable to start debugging on the web ... Set customError mode values to control the display of user-friendly ... error messages to users instead of error details (including a stack trace): ... <!-- SESSION STATE SETTINGS ...
    (microsoft.public.dotnet.framework)
  • RE: Enable Perl Debugging at Run-Time
    ... however it would be neater if there was a command in perl ... It's a filter which removes 'debugging' code based on ... This particular script is one of many CGI's, so I don't have much scope ... code to 'self trace' and dump trace data to STDERR. ...
    (perl.beginners)
  • Re: [PATCH] tracing/markers: make markers select tracepoints
    ... trace points need translation. ... this hook may break. ... without even needing to reboot the kernel. ... Given that the string is self describing, ...
    (Linux-Kernel)
  • Re: AMD64 X2 lost ticks on PM timer
    ... to what debugging facilities are available with each preemption level. ... I got the following trace. ... Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • Re: AIX Trace Functionality...
    ... You had to find the MQ supplied trace ... If, at install time, the ... assumes that file contains trace template source, ... It should be noted though that /etc/trcfmt contains some hook ...
    (comp.unix.aix)