Consider we have called debug() for several functions to make a breakpoint on them. When we find and solve the bug, is there anyway to undebug() all functions already marked by debug() by a single command?
Here is a good benchmark to see if your proposed method really works perfectly:
> library(limma) # bioconductor
> debug(read.ilmn)
> read.ilmn("a.txt") # No problem if this file does not exist
Browse[2]> debug(.read.oneilmnfile) # This is the debug browser for read.ilmn()
Browse[2]> Q # To exit debug browser
> undebug.all() # Here run your proposed function to undebug everything!
> read.ilmn("a.txt")
# Now if the debug browser is not started, you are lucky to pass this test!
You may see the accepted answer below. Any case for which this answer does not work, or cleaner versions, are more than welcome.
This was my solution …
edit: revised to deal with finding objects in namespaces. The code is already getting a little bit crufty, since I don’t really understand the methods for manipulating/querying namespaces all that well, and since I was working by trial and error. Cleaner versions would be welcome. There are almost certainly other corner cases that will fail.
The code is also posted at http://www.math.mcmaster.ca/bolker/R/misc/undebug_all.R
Example:
In this case
lmeruns without entering the debugger.Another, harder example:
Note that
read.ilmn()andread.ilmn("a.txt")appear to behave differently from a debugging standpoint (I don’t understand why …)