[ESS] ess-tracebug behavior [probably wishlist]

Ross Boylan ross at biostat.ucsf.edu
Sat May 4 03:38:02 CEST 2013

On 4/24/2013 1:21 PM, Vitalie Spinu wrote:
> Hi Ross,
> Dev ESS has now true toggleble breakpoints that you can
> activate/deactivate during the debug session without the need of
> re-sourcing. Toggling is bound to C-c C-t o.
> I have also much improved the ess-dbg-flag-for-debugging. It sees all
> the functions from the current context, and all the internal functions
> in the namespaces of the packages listed in ess-developer-packages. So,
> if you are on SVN or git please test the stuff out. I would be happy to
> hear your comments.
I am now using the latest git: 650a142597a3be857407e180381acf617f333676.

C-c C-t d to debug a function.  It was exported from a package, and did 
appear on the autocompletion list.

I did enter the debugger when I hit it, though no special code display.  
The status area of emacs listed a bunch of keys like (M)-N for next.  I 
hit Esc-n and got an error"M-n is undefined".   If I enter the R window 
I can debug in the usual R way.  Apparently Esc-N (uppercase) works; 
having to hit the shift key for a basic debugging operation is awkward.

I wanted to trace into a function that had not been exported.  C-c C-t d 
did have it on the completion list--impressive.  However, although it 
told me it had set debugging, I did not actually get a debugger on it.  
I typed n in the debugger prompt and it simply returned 
(mice.impute.2lmixed.logit was the inner function I was trying to debug):

debug: type <- c(2, type)
debug: if (any(type == 1)) return(mice.impute.2lmixed.logit(y, ry, x,
Browse[2]> any(type==1)  # set debug on mice.impute.2lmixed.logit here
[1] TRUE
Browse[2]> n
debug: return(mice.impute.2lmixed.logit(y, ry, x, type))

I tried using debugonce() from the command line in the debugger; it too was ineffective.

I verified that when I'm at top level the non-exported function is not in the completion list of functions to debug.

After using ess-developer on the package (C-c C-t a mice) the private 
function is part of the completion list for C-c C-t d at the top level. 
I thought the first time I tried this it did not stop, but when I try to 
reproduce it's OK.  However, the completion lists the function twice, 
once as mice.impute2l.mixed.logit and once as 

C-c C-t D did not remove the debugging from the function.  Actually, I'm 
not sure the uppercase D is getting through; when it was echoing I only 
saw a lower case d, and the status message is "flagged for debugging" 
after I select the function.

Some possible extensions
C-c C-t D (unflag for debugging) lists all functions; it would be nice 
if it only listed ones actually flagged for debugging.  BTW, is typing 
undebug(foo) equivalent to C-c C-t D foo?

C-u C-t d does debugonce.

For the record:
options(deparse.max.lines) limits the stack trace (an R, not ESS, 
feature).  It's only partly effective, limiting the stack trace but not 
the function body dump as you enter the browser.

Ross Boylan

More information about the ESS-help mailing list