[ESS] debug: automatically step into functions

Andreas Leha andreas.leha at med.uni-goettingen.de
Sat Mar 15 09:59:36 CET 2014


Vitalie Spinu <spinuvit at gmail.com> writes:

>  >>> Andreas Leha on Fri, 14 Mar 2014 23:49:06 +0100 wrote:
>
>  > Hi all,
>  > lets say I debug function a() which calls function b() and I want to
>  > step into b() during the debugging session.
>
>  > In this situation I can flag b() for debugging also during the active
>  > debugging session, which is great.  But if I want to follow control into
>  > some deeply nested function, that becomes cumbersome - despite all the
>  > support by ess (ess-debug-flag-for-debugging, ...)
>
>  > So, my question is:  Is there even more support by ess?  The most
>  > straight forward support IMO would be a key-stroke to sth like
>  > ess-debug-command-next-and-step-into that would automatically flag b()
>  > for debugging before executing ess-debug-command-next (and also undebug
>  > it automatically again).
>
>  > Is that possible (or even already implemented)?
>
> Possible? Yes. Implemented in ESS? No. Implemented in R. To the best of
> my knowledge not. If you can think of how to implement this in R. Then,
> adding it to ESS is straightforward.
>

Well, I think the main difficulty is to determine which function to
debug, as functions can be called in too many ways.  Obvious and simple
examples are do.call() or apply().  Or also 'x <- b(10)' where probably
not '<-' but 'b()' is to be debugged.

There are also undecidable cases, like 'x <- a(10, b(100))' where ess
would have difficulties to tell whether a() ore b() are to be debugged
next.

Maybe a good interface would be to provide a list of function calls in
the next 'line' to the user to decide (while omitting functions like
'+', apply(), ...).



Without too much thought (and in absence of much/any knowledge in that
field) I had something like this in mind:

If the next line to execute by ess-debug-command-next is 'b(10)' then
ess could run 'debug(quote(b(10))[[1]])' prior to sending the line to R
(and undebug afterwards).


All in all, such feature would be cool, but since I can flag function
for debugging manually it is definitely not a must-have.

Regards,
Andreas



More information about the ESS-help mailing list