vcDebug {BuildSys} | R Documentation |
Debug the Shared Library
Description
Calling vcDebug
will initiate a debug enabled Microsoft Visual Code instance
that can be use as a GUI debugger of your C/C++ code.
Usage
## S4 method for signature 'BSysProject'
vcDebug(.Object, LaunchEditor=TRUE)
Arguments
.Object |
|
LaunchEditor |
|
Details
vcDebug
creates the necessary c_cpp_properties.json
and launch.json
files needed for Microsoft Visual Code
to effectively debug the project dynamic library and launches an instance of Visual Code. It is assumed that the dynamic
library has already been compiled with make
and Debug
support enabled. R needs to be configured to be able to build
C/C++ libraries (RTools installed on Windows) and it is assumed that Microsoft Visual Code is installed. These requirements
are discussed at length in BuildSys-package
.
Within Visual Code you can open the source file/s of your library, set breakpoints and run a debug session. To run a debug
session select the run/Start Debugging menu item. Doing so will result in a new instance of R being launched which contains
the same environment (including loaded packages and loaded dynamic libraries) as the parent R session where vcDebug
was first
called. This R session is your sandbox to safely debug your library in and leaves the parent R session safe from loss should
your code crash R completely.
Debugging a new library will typically require some R setup code to be executed before using and/or testing it. With BuildSys
you
should perform this initial setup of R in the parent R session before calling vcDebug
so that you never have to initialise
R in your debug session. The debug R session will inherit the state of the parent R session at the time that vcDebug
was called.
Value
this method returns no value.
Note
see BuildSys-package
for examples of use.
If the absolute path to source and dynamic library files contains spaces then debugging in Visual Code fails to function correctly. To ensure code is debuggable users will need to avoid putting code in folders with whitespace in the folder names.
Author(s)
Paavo Jumppanen [aut, cre]
Maintainer: Paavo Jumppanen <paavo.jumppanen@csiro.au>
See Also
initProjectFromFolder
make
BuildSys-package