diff options
| author | SirLynix <[email protected]> | 2023-07-21 17:24:04 +0200 |
|---|---|---|
| committer | SirLynix <[email protected]> | 2023-07-21 17:24:04 +0200 |
| commit | 30f29b8dd316cfee6404b1fa4ca9815a4f02c9a8 (patch) | |
| tree | 25b49be91e2d220c627618a69e92e77aae5bd5ef /xmake/modules/devel/debugger | |
| parent | 56bc58325b10e39b8278e81e1852997334716efb (diff) | |
Refactor runenvs so renderdoc can store envs
Diffstat (limited to 'xmake/modules/devel/debugger')
| -rw-r--r-- | xmake/modules/devel/debugger/run.lua | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/xmake/modules/devel/debugger/run.lua b/xmake/modules/devel/debugger/run.lua index 37ed22d97..ea92ede2c 100644 --- a/xmake/modules/devel/debugger/run.lua +++ b/xmake/modules/devel/debugger/run.lua @@ -33,6 +33,7 @@ import("detect.tools.find_devenv") import("detect.tools.find_vsjitdebugger") import("detect.tools.find_renderdoc") import("lib.detect.find_tool") +import("private.action.run.runenvs") -- run gdb function _run_gdb(program, argv, opt) @@ -49,6 +50,9 @@ function _run_gdb(program, argv, opt) table.insert(argv, 1, program) table.insert(argv, 1, "--args") + -- handle envs + opt.envs = runenvs.join(opt.addrunenvs, opt.setrunenvs) + -- run it os.execv(gdb, argv, table.join(opt, {exclusive = true})) return true @@ -69,6 +73,9 @@ function _run_cudagdb(program, argv, opt) table.insert(argv, 1, program) table.insert(argv, 1, "--args") + -- handle envs + opt.envs = runenvs.join(opt.addrunenvs, opt.setrunenvs) + -- run it os.execv(gdb, argv, table.join(opt, {exclusive = true})) return true @@ -96,6 +103,9 @@ function _run_lldb(program, argv, opt) table.insert(argv, 1, names[i]) end + -- handle envs + opt.envs = runenvs.join(opt.addrunenvs, opt.setrunenvs) + -- run it os.execv(names[1], argv, table.join(opt, {exclusive = true})) return true @@ -114,6 +124,9 @@ function _run_windbg(program, argv, opt) argv = argv or {} table.insert(argv, 1, program) + -- handle envs + opt.envs = runenvs.join(opt.addrunenvs, opt.setrunenvs) + -- run it opt.detach = true os.execv(windbg, argv, opt) @@ -133,6 +146,9 @@ function _run_cudamemcheck(program, argv, opt) argv = argv or {} table.insert(argv, 1, program) + -- handle envs + opt.envs = runenvs.join(opt.addrunenvs, opt.setrunenvs) + -- run it os.execv(cudamemcheck, argv, opt) return true @@ -151,6 +167,9 @@ function _run_x64dbg(program, argv, opt) argv = argv or {} table.insert(argv, 1, program) + -- handle envs + opt.envs = runenvs.join(opt.addrunenvs, opt.setrunenvs) + -- run it opt.detach = true os.execv(x64dbg, argv, opt) @@ -170,6 +189,9 @@ function _run_ollydbg(program, argv, opt) argv = argv or {} table.insert(argv, 1, program) + -- handle envs + opt.envs = runenvs.join(opt.addrunenvs, opt.setrunenvs) + -- run it opt.detach = true os.execv(ollydbg, argv, opt) @@ -189,6 +211,9 @@ function _run_vsjitdebugger(program, argv, opt) argv = argv or {} table.insert(argv, 1, program) + -- handle envs + opt.envs = runenvs.join(opt.addrunenvs, opt.setrunenvs) + -- run it opt.detach = true os.execv(vsjitdebugger, argv, opt) @@ -209,6 +234,9 @@ function _run_devenv(program, argv, opt) table.insert(argv, 1, "/DebugExe") table.insert(argv, 2, program) + -- handle envs + opt.envs = runenvs.join(opt.addrunenvs, opt.setrunenvs) + -- run it opt.detach = true os.execv(devenv, argv, opt) @@ -225,12 +253,35 @@ function _run_renderdoc(program, argv, opt) end -- build capture settings + local environment = {} + if opt.addrunenvs then + for name, values in pairs(opt.addrunenvs) do + table.insert(environment, { + separator = "Platform style", + type = "Append", + value = table.concat(values, path.envsep()), + variable = name + }) + end + end + + if opt.setrunenvs then + for name, values in pairs(opt.setrunenvs) do + table.insert(environment, { + separator = "Platform style", + type = "Set", + value = table.concat(values, path.envsep()), + variable = name + }) + end + end + local settings = { rdocCaptureSettings = 1, settings = { autoStart = false, commandLine = table.concat(table.wrap(argv), " "), - environment = json.mark_as_array({}), + environment = json.mark_as_array(environment), executable = program, inject = false, numQueuedFrames = 0, @@ -258,6 +309,8 @@ function _run_renderdoc(program, argv, opt) -- run renderdoc opt.detach = true + opt.addrunenvs = nil + opt.setrunenvs = nil os.execv(renderdoc, { capturefile }, opt) return true end @@ -279,6 +332,9 @@ function _run_gede(program, argv, opt) table.insert(argv, 1, "--args") table.insert(argv, 1, "--no-show-config") + -- handle envs + opt.envs = runenvs.join(opt.addrunenvs, opt.setrunenvs) + -- run it os.execv(gede.program, argv, table.join(opt, {exclusive = true})) return true @@ -299,6 +355,9 @@ function _run_seergdb(program, argv, opt) table.insert(argv, 1, program) table.insert(argv, 1, "--start") + -- handle envs + opt.envs = runenvs.join(opt.addrunenvs, opt.setrunenvs) + -- run it os.execv(seergdb.program, argv, table.join(opt, {exclusive = true})) return true |
