[Rd] debugger() fails if "..." in function arguments

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Feb 18 14:06:23 CET 2011


On Fri, 18 Feb 2011, Charles Roosen wrote:

> Dear all,
>
> I'm having a problem with debugger() in both R 2.8.0 and R 2.12.0.
> Probably also versions in-between.

But you are asked to report only on current R.

> I don't see it logged in the bug database, but it's hard for me to
> imagine that no-one else has encountered it.  So my question is whether
> it's a known problem with a workaround, or do I log it as a new problem?

I doubt if almost anyone uses dump.frames() in R.  I think this is 
known, and the workaround is 'don't do that': use error=recover.

> The situation is that if I use "options(error=dump.frames)" and then use
> "debugger()", it fails if there's "..." in the function arguments.
> Repro and version info below.
>
> Thanks,
> Charlie Roosen
>
>> myFunc <- function(a,b,...) {d <- a+b; stop("")}
>> options(error=dump.frames)
>> myFunc(1,2)
> Error in myFunc(1, 2) :
>
>> debugger()
> Message:  Error in myFunc(1, 2) :
> Available environments had calls:
> 1: myFunc(1, 2)
> 2: stop("")
>
> Enter an environment number, or 0 to exit  Selection: 1
> Error in get(.obj, envir = dump[[.selection]]) :
>  argument "..." is missing, with no default

That's easy to fix with a tryCatch() wrapper.  But the real problem is 
with last.dump(), and recover() has it to some extent:

options(error=recover)
myFunc(1,2,e=pi)
Error in myFunc(1, 2, e = pi) :

Enter a frame number, or 0 to exit

1: myFunc(1, 2, e = pi)

Selection: 1
Called from: top level
Browse[1]> e
Error during wrapup: object 'e' not found

If you know how, you can get to 'e' though ....

I am really not sure this is worth changing.

>
>> version
>               _
> platform       i386-pc-mingw32
> arch           i386
> os             mingw32
> system         i386, mingw32
> status
> major          2
> minor          12.0
> year           2010
> month          10
> day            15
> svn rev        53317
> language       R
> version.string R version 2.12.0 (2010-10-15)
>
>
> Charles Roosen, PhD
> Technical Director
>
> T: +41 (0)61 206 92 91
> M: +41 (0)79 248 70 71
> F: +41 (0) 61 206 92 99
>
> www.mango-solutions.com
>
> Mango Solutions AG
> Aeschenvorstadt 36
> 4051 Basel
> Switzerland
>
> image002
>
> LEGAL NOTICE
> This message is intended for the use o...{{dropped:10}}
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list