rstudio/rstudio — pull request #87 by jmcphers (2014-01-21 04:25:16+00:00)
Title: Support for debugging without source references

This change introduces the ability to use the source debugger on functions that don't have source references. In most cases, it can show and step through code just as if the code had references.

Showing deparsed functions requires few changes, but simulating source references for those functions to create accurate debug highlighting and stepping is a little more involved. There are two distinct strategies used to simulate references for functions whose content is deparsed rather than derived from actual source references:

1. For the currently executing function, the debug outputs from R (i.e. the statements printed at the console) are captured and located in the deparsed function representation. In nearly all cases this enough to uniquely identify the executing segment; in cases where it is not, an educated guess is made--i.e. when stepping, the next statement is the most likely target, and closer statements are preferred.

2. For all other functions, the highlighting is derived from deparsed calls--we look for the call object that invoked the next context, deparse it, and find it in the deparsed invoker.

No change has been made to which functions are considered "internal" (even though these are debuggable now). Because there are pathological cases in which the highlight matching could be off, we also now show a warning bar when debugging in deparsed code.