@@ -144,13 +144,13 @@ use_release_issue(version = NULL) # https://usethis.r-lib.org/reference/use_rele
144144# just follow tasks in there;)
145145```
146146
147- ## Setup
147+ ## Dev tools setup / use
148148
149149```
150150install.packages(c("usethis", "devtools"))
151151```
152152
153- ## Code testing coverage with covr
153+ ### Code testing coverage with covr
154154
155155https://covr.r-lib.org
156156
@@ -187,7 +187,37 @@ To ignore multiple lines use `# nocov start/stop`.
187187
188188In ` Rcpp ` code use ` // # nocov ... ` .
189189
190- ## Air formatter of R code
190+ ### Debugging C/C++
191+
192+ In ` src/Makevars.in ` uncomment debug flags ...
193+
194+ From terminal run:
195+
196+ ```
197+ # Go to package folder
198+ R_HOME="/Library/Frameworks/R.framework/Resources"
199+ R_BIN="$R_HOME/bin/exec/R"
200+ ASAN="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/lib/darwin/libclang_rt.asan_osx_dynamic.dylib"
201+ UBSAN="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib"
202+
203+ env R_HOME="$R_HOME" \
204+ DYLD_INSERT_LIBRARIES="$ASAN:$UBSAN" \
205+ ASAN_OPTIONS="abort_on_error=1,detect_leaks=0,verbosity=1" \
206+ UBSAN_OPTIONS="print_stacktrace=1" \
207+ "$R_BIN" --vanilla
208+ ```
209+
210+ In the R session (not from Rstudio/Positron!):
211+
212+ ```
213+ # Load + compile into the current ASan session (no child R load)
214+ devtools::load_all()
215+
216+ # Run tests in the same process
217+ devtools::test()
218+ ```
219+
220+ ### Air formatter of R code
191221
192222https://usethis.r-lib.org/reference/use_air.html
193223```
@@ -205,7 +235,7 @@ air format .
205235air format --check .
206236```
207237
208- ## Jarl linter of R code
238+ ### Jarl linter of R code
209239
210240https://jarl.etiennebacher.com
211241
@@ -216,7 +246,7 @@ jarl check .
216246jarl check --fix .
217247```
218248
219- ## clang-format of C/C++ code
249+ ### clang-format of C/C++ code
220250
221251https://clang.llvm.org/docs/ClangFormat.html
222252
@@ -250,7 +280,7 @@ pre-commit run clang-format src/RcppTskit.cpp
250280pre-commit run clang-format --all-files
251281```
252282
253- ## clang-tidy linter of C/C++ code
283+ ### clang-tidy linter of C/C++ code
254284
255285https://clang.llvm.org/extra/clang-tidy/
256286
@@ -270,7 +300,7 @@ pre-commit run clang-tidy src/RcppTskit.cpp
270300pre-commit run clang-tidy --all-files
271301```
272302
273- ## GitHub actions
303+ ### GitHub actions
274304
275305```
276306install.packages("usethis")
0 commit comments