Add a dap configuration for assembly (.asm files)

This commit is contained in:
Jiří Štefka 2023-02-17 06:12:59 +01:00
parent 2f8194437a
commit 5cb8ed43b4

@ -5,7 +5,6 @@
-- normal format is "key = value". These also handle array like data structures -- normal format is "key = value". These also handle array like data structures
-- where a value with no key simply has an implicit numeric key -- where a value with no key simply has an implicit numeric key
local config = { local config = {
-- Configure AstroNvim updates -- Configure AstroNvim updates
updater = { updater = {
remote = "origin", -- remote to use remote = "origin", -- remote to use
@ -24,10 +23,8 @@ local config = {
-- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork -- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork
-- }, -- },
}, },
-- Set colorscheme to use -- Set colorscheme to use
colorscheme = "default_theme", colorscheme = "default_theme",
-- Add highlight groups in any theme -- Add highlight groups in any theme
highlights = { highlights = {
-- init = { -- this table overrides highlights in all themes -- init = { -- this table overrides highlights in all themes
@ -37,7 +34,6 @@ local config = {
-- Normal = { bg = "#000000" }, -- Normal = { bg = "#000000" },
-- }, -- },
}, },
-- set vim options here (vim.<first_key>.<second_key> = value) -- set vim options here (vim.<first_key>.<second_key> = value)
options = { options = {
opt = { opt = {
@ -95,7 +91,6 @@ local config = {
" ██  ██ ██  ██  ██  ██ ██  ██  ██", " ██  ██ ██  ██  ██  ██ ██  ██  ██",
" ██   ████   ████   ██ ██  ██", " ██   ████   ████   ██ ██  ██",
}, },
-- Default theme configuration -- Default theme configuration
default_theme = { default_theme = {
-- Modify the color palette for the default theme -- Modify the color palette for the default theme
@ -137,13 +132,11 @@ local config = {
["which-key"] = true, ["which-key"] = true,
}, },
}, },
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
diagnostics = { diagnostics = {
virtual_text = true, virtual_text = true,
underline = true, underline = true,
}, },
-- Extend LSP configuration -- Extend LSP configuration
lsp = { lsp = {
-- enable servers that you already have installed without mason -- enable servers that you already have installed without mason
@ -193,7 +186,36 @@ local config = {
} }
}, },
}, },
dap = {
configurations = {
asm = {
{
name = "Launch file",
type = "cppdbg",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ',
vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopAtEntry = true
},
{
name = 'Attach to gdbserver :1234',
type = 'cppdbg',
request = 'launch',
MIMode = 'gdb',
miDebuggerServerAddress = 'localhost:1234',
miDebuggerPath = '/usr/bin/gdb',
cwd = '${workspaceFolder}',
program = function()
return vim.fn.input('Path to executable: ',
vim.fn.getcwd() .. '/', 'file')
end
}
}
}
},
-- Mapping data with "desc" stored directly by vim.keymap.set(). -- Mapping data with "desc" stored directly by vim.keymap.set().
-- --
-- Please use this mappings table to set keyboard mapping since this is the -- Please use this mappings table to set keyboard mapping since this is the
@ -212,7 +234,7 @@ local config = {
-- Debugger mappings -- Debugger mappings
-- Config loading -- Config loading
["<leader>dlc"] = { function() require("dap.ext.vscode").load_launchjs(nil, { cppdbg = { "c", "cpp" } }) end, desc = "C/C++" }, ["<leader>dlc"] = { function() require("dap.ext.vscode").load_launchjs(nil, { cppdbg = { "c", "cpp", "asm" } }) end, desc = "C/C++/asm" },
-- Function keys mappings -- Function keys mappings
["<F5>"] = { function() require("dap").continue() end, desc = "Debugger: Start" }, ["<F5>"] = { function() require("dap").continue() end, desc = "Debugger: Start" },
@ -223,18 +245,18 @@ local config = {
["<F10>"] = { function() require("dap").step_over() end, desc = "Debugger: Step Over" }, ["<F10>"] = { function() require("dap").step_over() end, desc = "Debugger: Step Over" },
["<F11>"] = { function() require("dap").step_into() end, desc = "Debugger: Step Into" }, ["<F11>"] = { function() require("dap").step_into() end, desc = "Debugger: Step Into" },
["<F23>"] = { function() require("dap").step_out() end, desc = "Debugger: Step Out" }, -- Shift+F11 ["<F23>"] = { function() require("dap").step_out() end, desc = "Debugger: Step Out" }, -- Shift+F11
-- Breakpoints -- Breakpoints
["<leader>db"] = { function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint (F9)" }, ["<leader>db"] = { function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint (F9)" },
["<leader>dB"] = { function() require("dap").clear_breakpoints() end, desc = "Clear Breakpoints" }, ["<leader>dB"] = { function() require("dap").clear_breakpoints() end, desc = "Clear Breakpoints" },
-- Session actions -- Session actions
["<leader>dc"] = { function() require("dap").continue() end, desc = "Start/Continue (F5)" }, ["<leader>dc"] = { function() require("dap").continue() end, desc = "Start/Continue (F5)" },
["<leader>dp"] = { function() require("dap").pause() end, desc = "Pause (F6)" }, ["<leader>dp"] = { function() require("dap").pause() end, desc = "Pause (F6)" },
["<leader>dr"] = { function() require("dap").restart_frame() end, desc = "Restart (C-F5)" }, ["<leader>dr"] = { function() require("dap").restart_frame() end, desc = "Restart (C-F5)" },
["<leader>dq"] = { function() require("dap").close() end, desc = "Close Session" }, ["<leader>dq"] = { function() require("dap").close() end, desc = "Close Session" },
["<leader>dQ"] = { function() require("dap").terminate() end, desc = "Terminate Session (S-F5)" }, ["<leader>dQ"] = { function() require("dap").terminate() end, desc = "Terminate Session (S-F5)" },
-- Step -- Step
["<leader>di"] = { function() require("dap").step_into() end, desc = "Step Into (F11)" }, ["<leader>di"] = { function() require("dap").step_into() end, desc = "Step Into (F11)" },
["<leader>do"] = { function() require("dap").step_over() end, desc = "Step Over (F10)" }, ["<leader>do"] = { function() require("dap").step_over() end, desc = "Step Over (F10)" },
@ -302,7 +324,6 @@ local config = {
-- ["<Tab>"] = { "copilot#Accept('<CR>')", silent = true, expr = true }, -- ["<Tab>"] = { "copilot#Accept('<CR>')", silent = true, expr = true },
} }
}, },
-- Configure plugins -- Configure plugins
plugins = { plugins = {
init = { init = {
@ -393,7 +414,6 @@ local config = {
-- ensure_installed = { "prettier", "stylua" }, -- ensure_installed = { "prettier", "stylua" },
}, },
}, },
-- LuaSnip Options -- LuaSnip Options
luasnip = { luasnip = {
-- Add paths for including more VS Code style snippets in luasnip -- Add paths for including more VS Code style snippets in luasnip
@ -403,7 +423,6 @@ local config = {
-- javascript = { "javascriptreact" }, -- javascript = { "javascriptreact" },
}, },
}, },
-- CMP Source Priorities -- CMP Source Priorities
-- modify here the priorities of default cmp sources -- modify here the priorities of default cmp sources
-- higher value == higher priority -- higher value == higher priority
@ -418,7 +437,6 @@ local config = {
path = 250, path = 250,
}, },
}, },
-- Modify which-key registration (Use this with mappings table in the above.) -- Modify which-key registration (Use this with mappings table in the above.)
["which-key"] = { ["which-key"] = {
-- Add bindings which show up as group name -- Add bindings which show up as group name
@ -444,7 +462,6 @@ local config = {
}, },
}, },
}, },
-- This function is run last and is a good place to configuring -- This function is run last and is a good place to configuring
-- augroups/autocommands and custom filetypes also this just pure lua so -- augroups/autocommands and custom filetypes also this just pure lua so
-- anything that doesn't fit in the normal config locations above can go here -- anything that doesn't fit in the normal config locations above can go here