Closed kyrillh closed 3 months ago
In pid = require("dap.utils").pick_process
you're passing along a function reference. This function then gets called whenever you start a debug session using that particular configuration.
In require("dap.utils").pick_process({ filter = "foo" })
you're calling the function immediately. The result of that first call is then frozen in the configuration definition.
You need to wrap the pick_process
call in a function block to get the same kind of behaviour and have lazy evaluation.
Okay, thanks a lot for the explanation. I replaced the line with
pid = function()
require("dap.utils").pick_process({ filter = "foo" })
end,
but am still getting the same behaviour.
pid = function()
return require("dap.utils").pick_process({ filter = "foo" })
end,
Works like a charm now. Thanks for the noob lua tips!
Debug adapter definition and debug configuration
Debug adapter version
1.10.0
Steps to Reproduce
require("dap").continue()
to select debugging profilesExpected Result
A list of running processes filtered according to "foo" from which a process to attach to can be selected.
Actual Result
Debugger aborts printing the error message "Error on attach: no process specified, create a target with a file, or specify the --pid or --name". If the filter is left out i.e.
then a process can be selected from a list as would be expected.