Roman Luštrik
Roman Luštrik

Reputation: 70643

quitting browser call with a twist

Imagine you're debugging a function within a function. You would be on level 2 (Browser [2]). Is there a way to quit level 2 and go to level 1? Q will drop you out of any debugging, so I'm looking for something that would just quit the current level.

Upvotes: 5

Views: 2998

Answers (2)

Gavin Simpson
Gavin Simpson

Reputation: 174813

Is c what you are looking for? It will continue execution of the current level and return you to level 1. Presumably you want whatever was running at level 2 to finish so level 1 is in a consistent state?

Upvotes: 2

Richie Cotton
Richie Cotton

Reputation: 121077

If you can change to the level 2 function body, then get it to throw an error. Then set the error option to recover. Now you can move between functions as you please.

foo <- function() bar()
bar <- function() stop("start debug here")

options(error = recover)
foo()

Upvotes: 2

Related Questions