File tree Expand file tree Collapse file tree 11 files changed +85
-17
lines changed
Expand file tree Collapse file tree 11 files changed +85
-17
lines changed Original file line number Diff line number Diff line change 99# .libPaths() already includes site library for default R version.
1010.libPaths(c(.libPaths(), .Library.site ))
1111
12+ # Source initialization script for VSCode R extension
13+ source(" ~/.vscode-R/init.R" )
14+ .First.sys()
15+
1216# The remotes package is installed to install httpgd from GitHub
1317# The gdiff package is installed to support visual difference testing
1418
Original file line number Diff line number Diff line change 11{
22 "name" : " R-Dev-Env" ,
33 "image" : " ghcr.io/r-devel/r-dev-env:devel" ,
4+ "runArgs" : [" --cap-add=SYS_PTRACE" ],
45 "remoteUser" : " vscode" ,
56 "hostRequirements" : {
67 "cpus" : 4
1011 "settings" : {
1112 "git.ignoredRepositories" : [" ." ],
1213 "files.exclude" : {
13- "**/.vscode" : true ,
1414 "**/.devcontainer" : true ,
1515 "**/.git" : true ,
1616 "**/.github" : true ,
4444 " johnstoncode.svn-scm" ,
4545 " ms-vscode.cpptools" ,
4646 " MS-vsliveshare.vsliveshare" ,
47- " natqe.reload"
47+ " natqe.reload" ,
48+ " vadimcn.vscode-lldb"
4849 ]
4950 }
5051 },
51- "postCreateCommand" : " sh /workspaces/r-dev-env /scripts/localscript.sh"
52+ "postCreateCommand" : " bash . /scripts/localscript.sh"
5253}
Original file line number Diff line number Diff line change 1+ {
2+ "version" : " 0.2.0" ,
3+ "configurations" : [
4+ {
5+ "name" : " (lldb) Attach to R" ,
6+ "type" : " lldb" ,
7+ "request" : " attach" ,
8+ "pid" : " ${command:pickMyProcess}" ,
9+ "stopOnEntry" : false
10+ }
11+ ]
12+ }
Original file line number Diff line number Diff line change 1- R-4.1.3 /
2- R-4.1.3.tar.gz
3- R-devel /
4- R-devel.tar.gz
1+ /build
2+ /svn
53/venv
64.cache /
7- .Rproj.user
85.vscode /
6+ .Rhistory
7+ .Rproj.user
8+ * .Rproj
9+ * /allow_ptrace
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -61,8 +61,7 @@ cd $BUILDDIR
6161directory. This step takes ~ 1 minute on the codespace.
6262
6363` ` ` bash
64- $TOP_SRCDIR /configure --with-valgrind-instrumentation=1
65-
64+ $TOP_SRCDIR /configure --with-valgrind-instrumentation=1 CFLAGS=" -g -O0"
6665` ` `
6766
6867< ! -- markdownlint-disable MD046 -->
@@ -71,6 +70,9 @@ $TOP_SRCDIR/configure --with-valgrind-instrumentation=1
7170 of valgrind. See the [Using
7271 valgrind](https://cran.r-project.org/doc/manuals/R-exts.html#Using-valgrind)
7372 section of the R-admin manual for more information.
73+ The ` CFLAGS=" -g -O0" ` setting compiles C code with debugging symbols
74+ (` -g` ) and disables optimization (` -O0` ) so the compiled code closely
75+ matches the original source, which aids debugging.
7476< ! -- markdownlint-enable MD046 -->
7577
7678- The configure cmd prepares for building R, creating files and folders inside
Original file line number Diff line number Diff line change 1+ #include <sys/prctl.h>
2+ #include <unistd.h>
3+ #include <stdio.h>
4+
5+ int main (int argc , char * * argv ) {
6+ if (argc < 2 ) {
7+ fprintf (stderr , "usage: %s <path-to-R> [args...]\n" , argv [0 ]);
8+ return 2 ;
9+ }
10+ /* allow ptrace for this process (persists across exec) */
11+ prctl (PR_SET_PTRACER , PR_SET_PTRACER_ANY );
12+ /* exec the provided R binary with the remaining args */
13+ execv (argv [1 ], & argv [1 ]);
14+ perror ("execv" );
15+ return 1 ;
16+ }
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # `which_r.sh` sets the R binary used in the command below
4+ exec ./scripts/allow_ptrace /usr/bin/R " $@ "
Original file line number Diff line number Diff line change @@ -27,11 +27,28 @@ cat $WORK_DIR/scripts/welcome_msg.sh >> ~/.bashrc
2727# Remove git directory if it exists
2828# rm -rf .git
2929
30+ # copy launch.json for debugging config if present
31+ if [ -f " $WORK_DIR /.devcontainer/launch.json" ]; then
32+ cp " $WORK_DIR /.devcontainer/launch.json" " $VSCODE_DIR /launch.json"
33+ fi
34+
3035# copying vscode extension settings from devcontainer json to vscode settings json using jq
3136if [ -f " $DEVCONTAINER_JSON " ]; then
3237 jq ' .customizations.vscode.settings' " $DEVCONTAINER_JSON " > " $VSCODE_DIR /settings.json"
3338fi
3439
40+ # Update r.rterm.linux setting to use the launch_r.sh script with full dynamic path
41+ if [ -f " $VSCODE_DIR /settings.json" ]; then
42+ tmpfile=" ${VSCODE_DIR/ settings.json} .tmp.$$ "
43+ jq --arg rterm " $WORK_DIR /scripts/launch_r.sh" ' ."r.rterm.linux"=$rterm' " $VSCODE_DIR /settings.json" > " $tmpfile " && mv " $tmpfile " " $VSCODE_DIR /settings.json"
44+ fi
45+
46+ # Compile the ptrace helper executable
47+ gcc -O2 -o " $WORK_DIR /scripts/allow_ptrace" " $WORK_DIR /scripts/allow_ptrace.c"
48+ chmod +x " $WORK_DIR /scripts/allow_ptrace"
49+
50+ # Mark the wrapper executable
51+ chmod +x " $WORK_DIR /scripts/launch_r.sh"
3552
3653}
3754
Original file line number Diff line number Diff line change @@ -28,9 +28,8 @@ PATCHDIR = \"$PATCHDIR\"
2828Have fun \U0001F601
2929"
3030
31- # open INDEX.md if INIT file exists
31+ # open INDEX.md if svn and build directories do not exist
3232if [ ! -d " svn" ] && [ ! -d " build" ]; then
3333 sleep 2
3434 code INDEX.md
35- rm INIT
3635fi
You can’t perform that action at this time.
0 commit comments