Skip to content

Instantly share code, notes, and snippets.

@avinab-neogy
Last active September 1, 2025 16:22
Show Gist options
  • Select an option

  • Save avinab-neogy/c7b9b1bb53f000894633e0129aa93ffb to your computer and use it in GitHub Desktop.

Select an option

Save avinab-neogy/c7b9b1bb53f000894633e0129aa93ffb to your computer and use it in GitHub Desktop.

Rlogo GSoC 

Google Summer of Code 2025: Work Product Submission

Avinab Neogy(@avinab-neogy)

Project Abstract

The R Dev Container is an actively developed environment aimed at streamlining contribution to the R language and its core codebase. Historically, debugging R’s C code and building the development version locally have posed challenges—especially for new contributors and those working on macOS or Windows rather than Linux.

This project focuses on Refining the R Dev Container for Debugging and Local Use, addressing three core goals:

  1. Integrating LLDB for powerful C debugging, letting contributors easily track down bugs and understand core R internals.
  2. Expanding compatibility to macOS and Windows, so more developers can use the dev container efficiently on their own machines, without requiring cloud services or Linux VMs.
  3. Enhancing IDE support, including seamless integration with editors like Positron, to give R developers more choice in their workflows.

Throughout the summer, the container was improved to support better debugging, flexible configuration, and a documented workflow. New documentation guides users through building R from source, performing local development, and using advanced debugging in the container. These changes will make the R Dev Container even more helpful for contributors of all experience levels.

GSoC Project: Refining the R Dev Container for debugging and local use

Mentors: Heather Turner (@hturner), Iain Emsley (@iaine), Atharva Shirdhankar (@StarTrooper08)

Work Done

The Project began with discussing the different approaches that can be taken while implementing the lldb debugger into the container and how we could go about making the docker image size smaller. Once the approach was ready we started implementing the solution and Heather documented the steps and tasks on a weekly basis in a Google Doc). I had weekly meets with both my mentors where I showcased my progress. All my work was done on the devel branch of the parent repository from which pull requests were created. Link: r-dev-env/devel

LLDB Debugging steps involved:

  • Added "runArgs": ["--cap-add=SYS_PTRACE"] to the devcontainer configuration to enable ptrace capabilities required for debugging.
  • Configured VS Code launch settings (launch.json) to attach LLDB to a running R process
  • Developed a helper shared library (allow_ptrace.c) that uses prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY) to allow the debugger to attach by relaxing kernel ptrace restrictions.
  • This library is loaded with LD_PRELOAD via a wrapper script launch_r to enable ptrace for the R binary at runtime.
  • Compiling the helper library.
  • Managing file permissions and copying debug configurations.
  • Dynamically updating VS Code settings to point to the correct R binary.
  • These changes collectively enable setting breakpoints and stepping through R’s C source code inside the container, improving debugging capabilities for contributors.

Pull Requests:

Pull Request Description Status
#251 Add ImageMagick and Magick++ support for graphical testing in Dockerfile Merged
#255 Fix: Ensure VS Code uses r-devel help docs when switched with which_r Merged
#257 Add instructions for renaming and managing codespaces Merged
#266 Updated welcome message: remove init flag tracking to open index Merged
#272 Improve chown calls in container setup Merged
#274 Add gdiff workflow support and install httpgd from GitHub with remotes Merged
#275 Fix general documentation formatting issues Merged
#267 LLDB debugging implementation Open
#268 LLDB debugging help documentation Open
#276 Enable git-r workflow integration Open
#279 Add build flag and setup script for positron Draft

Contributions Prior to GSoC

Pull Request Description Status
#77 grid::dataViewport() bug Patch Merged

Current State and Future Improvements

The LLDB debugging integration in the R Dev Container is almost completed, providing a robust foundation for C code debugging within R’s core development environment. This milestone marks significant progress in enhancing the developer experience for R contributors across platforms. Moving forward, efforts will focus on expanding cross-platform optimizations, and Positron compatibility.

Acknowledgement

I am deeply thankful to Heather Turner for the entire opportunity to work on this project, for her continuous guidance, support, and encouragement throughout my journey. Her mentorship has been invaluable in helping me grow as a contributor and developer within the R community.

I also sincerely thank Iain Emsley for his technical guidance, which really meant a lot in overcoming challenges during the project. Special thanks to Atharva Shirdhankar, whose deep knowledge as a previous contributor provided invaluable help whenever I needed assistance.

I am grateful for the incredible opportunity to speak at the R Dev Day event (watch here), and I look forward to participating in the upcoming RSECon 25 specially the R Dev Day satellite event, ideally in person at University of Warwick but prepared to join remotely if necessary. I remain deeply committed to contributing to this project and the repository long-term, with a particular focus on completing the Positron IDE integration by the end of this year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment