[DAP] Add option to launch gdb with args to the binary
This commit is contained in:
@@ -17,6 +17,29 @@ dap.configurations.c = {
|
|||||||
cwd = "${workspaceFolder}",
|
cwd = "${workspaceFolder}",
|
||||||
stopAtBeginningOfMainSubprogram = false,
|
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",
|
name = "Select and attach to process",
|
||||||
type = "gdb",
|
type = "gdb",
|
||||||
|
|||||||
Reference in New Issue
Block a user