gdbsource: Source R-script through gdb to get backtrace.

View source: R/gdbsource.R

gdbsourceR Documentation

Source R-script through gdb to get backtrace.

Description

Source R-script through gdb to get backtrace.

If gdbsource is run non-interactively (the default) only the relevant information will be printed.

Usage

gdbsource(file, interactive = FALSE)

## S3 method for class 'backtrace'
print(x, ...)

Arguments

file

Your R script

interactive

Run interactive gdb session?

x

Backtrace from gdbsource

...

Not used

Details

This function is useful for debugging templates. If a script aborts e.g. due to an out-of-bound index operation it should be fast to locate the line that caused the problem by running gdbsource(file). Alternatively, If more detailed debugging is required, then gdbsource(file,TRUE) will provide the full backtrace followed by an interactive gdb session where the individual frames can be inspected. Note that templates should be compiled without optimization and with debug information in order to provide correct line numbers:

  • On Linux/OS X use compile(cppfile,"-O0 -g").

  • On Windows use compile(cppfile,"-O1 -g",DLLFLAGS="") (lower optimization level will cause errors).

Value

Object of class backtrace


TMB documentation built on Nov. 27, 2023, 5:12 p.m.

Related to gdbsource in TMB...