{"id":13895444,"url":"https://github.com/jonboh/nvim-dap-rr","last_synced_at":"2025-09-06T17:45:51.975Z","repository":{"id":193897486,"uuid":"689655827","full_name":"jonboh/nvim-dap-rr","owner":"jonboh","description":"Dap configuration for the record and replay debugger. Supports Rust, C++ and C.","archived":false,"fork":false,"pushed_at":"2025-03-20T15:34:48.000Z","size":5011,"stargazers_count":38,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-20T16:37:41.874Z","etag":null,"topics":["c","cpp","nvim","rr","rust"],"latest_commit_sha":null,"homepage":"https://jonboh.dev/posts/rr/","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonboh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-10T13:59:10.000Z","updated_at":"2025-03-20T15:34:53.000Z","dependencies_parsed_at":"2023-09-10T17:29:30.826Z","dependency_job_id":"7e4bebb8-9367-4aaf-854a-f422f433529f","html_url":"https://github.com/jonboh/nvim-dap-rr","commit_stats":null,"previous_names":["jonboh/nvim-dap-rr"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonboh%2Fnvim-dap-rr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonboh%2Fnvim-dap-rr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonboh%2Fnvim-dap-rr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonboh%2Fnvim-dap-rr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonboh","download_url":"https://codeload.github.com/jonboh/nvim-dap-rr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248703199,"owners_count":21148118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpp","nvim","rr","rust"],"created_at":"2024-08-06T18:02:13.354Z","updated_at":"2025-04-13T11:10:16.435Z","avatar_url":"https://github.com/jonboh.png","language":"Lua","readme":"# nvim-dap-rr\nAn extension for [nvim-dap](https://github.com/mfussenegger/nvim-dap) to generate ready to go rr dap configurations.\n\n![example](./assets/example.gif)\n\nThe rr debugger allows you to record an execution and later replay it. In replay mode you\nget deterministic execution, and the ability to \"time travel\" in your debugging, going backwards\nand forwards tracking the state of your program.\n\nWith this plugin you can connect to a replay session and debug it as any other DAP compatible debugger.\n\n## Installation\nRequirements:\n- A reasonably modern neovim (tested on v0.9.2, but older versions should work as well)\n- [rr](https://github.com/rr-debugger/rr) (tested on 5.6.0)\n- [cpptools](https://github.com/Microsoft/vscode-cpptools)\n    - [mason.nvim](https://github.com/williamboman/mason.nvim) makes the installation trivial (see [minimal configuration](#minimal-configuration))\n\nYou can skip these next dependencies if you provide an alternative program picker, see [Debugger Configuration](#debugger-configuration) but they are required by default:\n- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim)\n- [fd](https://github.com/sharkdp/fd)\n\nYou don't need [nvim-dap-ui](https://github.com/rcarriga/nvim-dap-ui) to run nvim-dap-rr,\nbut if you want a debugger UI it is a good default.\n\n**Lazy.nvim**:\n```lua\n    {\"jonboh/nvim-dap-rr\", dependencies = {\"nvim-dap\", \"telescope.nvim\"}},\n```\n\nNOTE: remember that you need to provide an `rr` session to which dap will connect. You can see an example of how to do this [here](https://jonboh.dev/posts/rr/#rr-basics).\n\n## Minimal Configuration\n```lua\nlocal dap = require('dap')\n\n-- point dap to the installed cpptools, if you don't use mason, you'll need to change `cpptools_path`\nlocal cpptools_path = vim.fn.stdpath(\"data\")..\"/mason/packages/cpptools/extension/debugAdapters/bin/OpenDebugAD7\"\ndap.adapters.cppdbg = {\n    id = 'cppdbg',\n    type = 'executable',\n    command = cpptools_path,\n}\n\n-- these mappings represent the maps that you usually use for dap. Change them according to your preference\nvim.keymap.set(\"n\", \"\u003cF1\u003e\", dap.terminate)\nvim.keymap.set(\"n\", \"\u003cF6\u003e\", dap.toggle_breakpoint)\nvim.keymap.set(\"n\", \"\u003cF7\u003e\", dap.continue)\nvim.keymap.set(\"n\", \"\u003cF8\u003e\", dap.step_over)\nvim.keymap.set(\"n\", \"\u003cF9\u003e\", dap.step_out)\nvim.keymap.set(\"n\", \"\u003cF10\u003e\", dap.step_into)\nvim.keymap.set(\"n\", \"\u003cF11\u003e\", dap.pause)\nvim.keymap.set(\"n\", \"\u003cF56\u003e\", dap.down) -- \u003cA-F8\u003e\nvim.keymap.set(\"n\", \"\u003cF57\u003e\", dap.up) -- \u003cA-F9\u003e\n\nlocal rr_dap = require(\"nvim-dap-rr\")\nrr_dap.setup({\n    mappings = {\n        -- you will probably want to change these defaults to that they match\n        -- your usual debugger mappings\n        continue = \"\u003cF7\u003e\",\n        step_over = \"\u003cF8\u003e\",\n        step_out = \"\u003cF9\u003e\",\n        step_into = \"\u003cF10\u003e\",\n        reverse_continue = \"\u003cF19\u003e\", -- \u003cS-F7\u003e\n        reverse_step_over = \"\u003cF20\u003e\", -- \u003cS-F8\u003e\n        reverse_step_out = \"\u003cF21\u003e\", -- \u003cS-F9\u003e\n        reverse_step_into = \"\u003cF22\u003e\", -- \u003cS-F10\u003e\n        -- instruction level stepping\n        step_over_i = \"\u003cF32\u003e\", -- \u003cC-F8\u003e\n        step_out_i = \"\u003cF33\u003e\", -- \u003cC-F8\u003e\n        step_into_i = \"\u003cF34\u003e\", -- \u003cC-F8\u003e\n        reverse_step_over_i = \"\u003cF44\u003e\", -- \u003cSC-F8\u003e\n        reverse_step_out_i = \"\u003cF45\u003e\", -- \u003cSC-F9\u003e\n        reverse_step_into_i = \"\u003cF46\u003e\", -- \u003cSC-F10\u003e\n    }\n})\ndap.configurations.rust = { rr_dap.get_rust_config() }\ndap.configurations.cpp = { rr_dap.get_config() }\n```\nTo append the rr configuration to an already existing `dap.configurations.\u003clang\u003e` table substitute\n```lua\ndap.configurations.rust = { rr_dap.get_rust_config() }\ndap.configurations.cpp = { rr_dap.get_config() }\n```\nfor\n```lua\ntable.insert(dap.configurations.rust, rr_dap.get_rust_config())\ntable.insert(dap.configurations.cpp, rr_dap.get_config())\n```\n\nThe `get_rust_config` function works as the `get_config` one, but makes sure to source the `rust-gdb`, which\nwill allow you to see sources related to rustc (some basic stuff like Option and Result would raise\n\"Sourcefile Not Found\" errors otherwise).\n\nThe demo configuration can be found in my [dotfiles](https://github.com/jonboh/dotfiles/tree/16e89dc50bb31f911a5636d5735f558f6d7c4583/.config/nvim/lua/jonbo/debugger)\n\n## Debugger Configuration\nTo change the debugger configuration you can use `get_config(debuggerOpts)`:\n```lua\ntable.insert(dap.configurations.cpp, rr_dap.get_config(\n    {\n        miDebuggerPath = \"\u003cpath\u003e\",\n        miDebuggerServerAddress = \"\u003cremote_address:port\u003e\"\n        program = \u003cmy_own_program_picker\u003e,\n        args = {\"\u003cargument\u003e\"},\n        stopAtEntry = false,\n        environment = {\"\u003cenv_var\u003e\"},\n    }\n))\n```\nThe entries you specify will overwrite the defaults:\n```lua\nlocal default_rr_config = {\n        name= \"rr\",\n        type= \"cppdbg\",\n        request= \"launch\",\n        program = find_program,\n        args= {},\n        miDebuggerServerAddress= \"127.0.0.1:50505\",\n        stopAtEntry= true,\n        cwd= vim.fn.getcwd,\n        environment= {},\n        externalConsole= true,\n        MIMode= \"gdb\",\n        setupCommands= {\n            {\n                description= \"Setup to resolve symbols\",\n                text= \"set sysroot /\",\n                ignoreFailures= false\n            },\n            {\n               description= \"Enable pretty-printing for gdb\",\n               text= \"-enable-pretty-printing\",\n               ignoreFailures= false\n            }\n        },\n    }\n```\nThe `program` entry expects a function that will return the program that the debugger should run.\nYou can learn more about these options in the [nvim-dap](https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#ccrust-via-vscode-cpptools) documentation.\n**Warning:**\nThe plugin uses the name of the configuration to setup the mappings of its dap functions.\nYou are not supposed to change the name of a config once it is returned to you.\n\nAlso it is expected that configs not generated by the plugin will have different names that\nthose that are generated by the plugin.\n\nIf you have an unrelated dap config with the same name as a rr config, it will make sessions\nof that unrelated config to trigger the mappings of this plugin possibly breaking its\nfuncionality if the adapter is not based on gdb.\n\n## Rewinding a finished session\nWhen the replay session gets to the end of a recording the DAP will generally automatically close,\nnot allowing you to go back. Running again a debugging session will immediately close the DAP\nsession as it spawns (as it will detect that the program has terminated).\n\nYou can fix this by telling the replay session to go back one instruction.\n\nThe plugin includes a helper function `ReverseNextiNoDAP` for this purpose, it will ask you\nthe address and port of the debugging session (by default `127.0.0.1:50505`),\nconnect to it and rewind the replay session by one instruction.\n\nAt this point you should be able to connect to the replay session as usual.\n","funding_links":[],"categories":["Lua"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonboh%2Fnvim-dap-rr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonboh%2Fnvim-dap-rr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonboh%2Fnvim-dap-rr/lists"}