[ESS] ESS 'trigger-happy' in its browser() step-through behavior

Vitalie Spinu spinuvit at gmail.com
Wed May 29 19:58:47 CEST 2013


 >> "Josh O'Brien" <joshmobrien at gmail.com>
 >> on Wed, 29 May 2013 10:26:53 -0700 wrote:

 > Hello,
 > To show what I mean, let's say I was interested in using a browser call to
 > examine the contents of the dots object from within a function call.

 > Running R from the Windows R gui (for example), I could just do this:

 >> f <- function(...) browser()

This is an artificial example which is unfortunately pops on rare
occasions. But it is a small price to pay for proper visual debugging.

In general you should put browser before a line on which you want to
stop. ESS indeed skips first step because R stops on browser() and
doesn't display source references at all. So that step is completely
useless for visual debugger.

I have added an option ess-debug-skip-first-call that you can set to nil
to completely inhibit this behavior. But then you will have to press M-N
to enter into visual debugger.

[...]


 >> f <- function(...) {browser(), dummy <-1}

You probably pressed RET by accident. This works as expected:

   
   > f <- function(...) {browser(); dummy <-1}
   > f(a = 23)
   Called from: f(a = 23)
   Browse[1]> 
   debug at #1: dummy <- 1
   Browse[2]> list(...)
   $a
   [1] 23
   
   Browse[2]> 

The only thing that you have to remember is to avoid your breakpoint be
the last in a call.

    Vitalie



More information about the ESS-help mailing list