Title: | Portable Native and Joint Stack Traces |
---|---|
Description: | Obtain the native stack trace and fuse it with R's stack trace for easier debugging of R packages with native code. |
Authors: | Kirill Müller [aut, cre] , R Consortium [fnd], Ian Lance Taylor [aut] (Bundled libbacktrace library), Free Software Foundation [cph] (Bundled libbacktrace library) |
Maintainer: | Kirill Müller <[email protected]> |
License: | GPL-3 |
Version: | 0.1.1.9000 |
Built: | 2024-11-21 06:44:50 UTC |
Source: | https://github.com/r-prof/winch |
Returns TRUE
if winch_trace_back()
is supported on this platform.
winch_available()
winch_available()
A scalar logical.
winch_available()
winch_available()
Primarily intended for testing.
winch_call(fun, env = parent.frame())
winch_call(fun, env = parent.frame())
fun |
A function callable without arguments. |
env |
The environment in which to evaluate the function call. |
The return value of fun()
.
foo <- function() { winch_call(bar) } bar <- function() { writeLines("Hi!") } foo()
foo <- function() { winch_call(bar) } bar <- function() { writeLines("Hi!") } foo()
On Windows, function names in native stack traces can be obtained for only one library at a time. Call this function to set the library for which to obtain symbols.
winch_init_library(path = NULL, force = FALSE)
winch_init_library(path = NULL, force = FALSE)
path |
Path to the DLL. |
force |
Reinitialize even if the path to the DLL is unchanged from the last call. |
This function is called for its side effects.
winch_init_library(getLoadedDLLs()[["rlang"]][["path"]])
winch_init_library(getLoadedDLLs()[["rlang"]][["path"]])
Primarily intended for testing.
winch_stop(message)
winch_stop(message)
message |
The error message. |
This function throws an error and does not return.
try(winch_stop("Test"))
try(winch_stop("Test"))
This function returns the native stack trace as a data frame. Each native stack frame corresponds to one row in the returned data frame. Deep function calls come first, the last row corresponds to the running process's entry point.
winch_trace_back()
winch_trace_back()
On Windows, call winch_init_library()
to return function names
for a specific package.
A data frame with the columns:
func
: function name
ip
: instruction pointer
pathname
: path to shared library
is_libr
: a logical, TRUE
if this entry is from R's shared library,
determined via procmaps::path_is_libr()
on the pathname
component
sys.calls()
for the R equivalent.
winch_trace_back() foo <- function() { winch_call(bar) } bar <- function() { winch_trace_back() } foo()
winch_trace_back() foo <- function() { winch_call(bar) } bar <- function() { winch_trace_back() } foo()