[DAP] Add option to launch gdb with args to the binary

This commit is contained in:
janishutz committed 2025-10-29 15:15:21 +01:00
1 parent d9febc4783
commit 9074bbff08
1 file changed
+23
@@ -17,6 +17,29 @@ dap.configurations.c = {
cwd = "${workspaceFolder}",
stopAtBeginningOfMainSubprogram = false,
},
{
name = "Launch (with args)",
type = "gdb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
args = function()
local arguments = vim.fn.input("Arguments: ")
if string.len(arguments) < 1 then
return {}
end
local table = { "--args" }
local index = 1
for arg in string.gmatch(arguments, "[^%s]+") do
table[index] = arg
index = index + 1
end
return table
end,
cwd = "${workspaceFolder}",
stopAtBeginningOfMainSubprogram = false,
},
{
name = "Select and attach to process",
type = "gdb",