rstudio/rstudio — pull request #68 by jmcphers (2013-10-24 16:20:36+00:00)
Title: Fix bug: debugger can show base environment on launch

This bug occurs when no function on the callstack has source references; the easiest way to repro is to call debug(foo::bar); foo::bar(), where foo is a package for which source references are not available, and bar is a function in that package.

The problem is that RStudio walks the callstack looking for a function containing source references, and when it reaches the end and still hasn't found one, it returns the last function it examined. In this specific case what we actually want it to do is to return the top of the stack, so that the user has some context for the debugger (even if they don't have sources available).

The fix is to detect when we're in this case (no sourcerefs anywhere), and to:

a) debug in the context of the top function on the stack, and

b) show internal functions in the UI (since there are no other kind on the stack)