Bad call stack (tree?) display in RStudio

Hi. I often come across cases where the traceback pane shows wrong call locations - or missing calls altogether. I'm using RStudio 1.2.1335, below is a small repro.

#file test3.R
test3 <- function() {
x<-42
x # set a breakpoint here
}

#file test2.R
test2 <- function(arg1 = test3()) {
x <- arg1 + 1
x
}

#file test1.R
test1 <- function() {
x<-test2()
x
}

When stopping at the breakpoint, the traceback pane shows:
image

Note that -
(1) The test1 call is shown only when 'Shown Internals' is checked,
(2) The test2 call is shown without line number.
(3) Double clicking the test2 line does not navigate to test2.R - and in real life, sometimes jump to a random location in the file.

Getting the stack through code, at the same breakpoint location, shows much better results:

Browse[2]> lobstr::cst()

  1. └─global::test1()
  2. └─global::test2() ~/repoSanity/R/test1.R:3:2
  3. └─global::test3() ~/repoSanity/R/test2.R:8:2
    
  4.   └─lobstr::cst() ~/repoSanity/R/test3.R:4:2
    

So it seems the information is available to R itself.
Is this fixable?

Please check the RStudio Issues on GitHub.
I see there some (long outstanding :sob:) issues about stack tracing e.g. issue 4917

Right, thanks. I'll form a repro and open a new bug.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.