[Rd] debugonce() functions are not considered as debugged

Gabe Becker becker@g@be @ending from gene@com
Tue May 1 19:05:38 CEST 2018


Others can speak to the origins of this more directly, but from what I
recall this has been true at least since I was working in this space on the
debugcall stuff a couple years ago. I imagine the reasoning  is what you
would expect: a single bit of course can't tell R both that a function is
debugged AND that it should undebug after the first call.  I don't know of
any R-facing way to check for debugonce status, though its possible I
missed it

That said, it would be possible to alter how the two bits are used so that
debugonce sets both of them, and debug (not once) only sets one, rather
them being treated as mutually exclusive. This would alter the behavior so
that debugonce'ed functions that haven't been called yet are considered
debugged, e.g., by isdebugged.

This would not, strictly speaking, be backwards compatible, but by the very
nature of what debugging means, it would not break any existing script
code. It could, and likely would, effect code implementing GUIs, however.

R-core - is this a patch that you are interested in and would consider
incorporating? If so I can volunteer to work on it.


On Sat, Apr 28, 2018 at 4:57 AM, Gábor Csárdi <csardi.gabor at gmail.com>

> debugonce() sets a different flag (RSTEP), and this is not queried by
> isdebugged(), and it is also not unset by undebug().
> Is this expected? If yes, is there a way to query and unset the RSTEP flag
> from R code?
> ❯ f <- function() { }
> ❯ debugonce(f)
> ❯ isdebugged(f)
> [1] FALSE
> ❯ undebug(f)
> Warning message:
> In undebug(f) : argument is not being debugged
> ❯ f()
> debugging in: f()
> debug at #1: {
> }
> Browse[2]>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Gabriel Becker, Ph.D
Bioinformatics and Computational Biology
Genentech Research

	[[alternative HTML version deleted]]

More information about the R-devel mailing list