- Display debug mode in lualine
- DAP config to debug neovim in two keypress
- Reverse debugging c++, rust, c
To display debug mode in your status line, you first need to learn how to determine whether this mode is enabled. You can do this in two ways:
--Firt way
require("debugmaster.debug.mode").is_active()
--Second way (recommended)
local dmode_enabled = false
vim.api.nvim_create_autocmd("User", {
pattern = "DebugModeChanged",
callback = function(args)
dmode_enabled = args.data.enabled
end
})
Now that you know how to track debug mode status, the next step is to write a statusline component for your statusline plugin. An example for lualine can be found here
- Install one-small-step-for-vimkind.
- Enable osv integration
dm.plugins.osv_integration.enabled = true- Open any neovim file. Enable debug mode (
leader + d). - Set breakpoint (
t). Launch debugging (c). - Do actions that trigger breakpoints in the neovim instance opened in the [T]erminal section
TODO: Add video
-
Install and configure cpptools adapter using this for reference: https://github.com/jonboh/nvim-dap-rr
-
Add keymap to change direction:
dm.keys.add {
key = "p",
action = (function()
local dir = "forward"
return function()
local s = require("dap").session()
if not s then
return print "Can't change execution direction. Session isn't enabled"
end
dir = (dir == "forward" and "reverse" or "forward")
s:evaluate("-exec set exec-direction " .. dir)
print("new direction: " .. dir)
end
end)()
}
-- This approach is arguably better than creating 5 new additional keymaps for reverse (M, O, C, Q, R)- Record session using
rrguide and start replay server - Step over through session changing direction using
p