Debugging compiled code in R with lldb
Channel: Jim Hester
Date: 2019-04-05

In this video I will show how I debugged a real world issue in the vroom package with the lldb debugger and successfully submitted a pull request to dplyr with a fix. The debugging cheat-sheet I showed in the video is in the details below.

# start lldb
R -d lldb

# clang commands
Ctrl-C to interrupt execution

r[estart] / c[continue]
up / down
bt
b
br list
br di
br en
br de

## All exceptions
break set -E c++

## Particular exception
break set -F std::range_error

# R funs

## Print value of object
Rf_PrintValue() / R_PV

## Inspect SEXP
R_inspect() / R_inspect3() # to limit the amount of recursion

## Print R Traceback from C
Rf_PrintValue(R_GetTraceback(0))

## Print Rcpp vector
Rf_PrintValue(vec.data)