summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorGaweringo <[email protected]>2025-01-31 22:52:46 +0100
committerGaweringo <[email protected]>2025-01-31 22:52:46 +0100
commit9afa188316f3a94e70f7643dc3ea41d46df8f03e (patch)
tree310d198966df5d342053b21c37ff73e5daf7c497 /xmake/modules
parent1c95d287f8bf7b80afc30e68ceb7f438afcccb7a (diff)
feat(debugger): add raddbg as a debugger option
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/detect/tools/find_raddbg.lua55
-rw-r--r--xmake/modules/devel/debugger/run.lua21
2 files changed, 76 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_raddbg.lua b/xmake/modules/detect/tools/find_raddbg.lua
new file mode 100644
index 000000000..faa310663
--- /dev/null
+++ b/xmake/modules/detect/tools/find_raddbg.lua
@@ -0,0 +1,55 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki, gaweringo
+-- @file find_raddbg.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find raddbg
+--
+-- @param opt the argument options, e.g. {version = true, program="raddbg"}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local raddbg = find_raddbg()
+-- local raddbg, version = find_raddbg({version = true})
+-- local raddbg, version = find_raddbg({version = true, program = "raddbg"})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- init options
+ opt = opt or {}
+
+ -- find program
+ local program = find_program(opt.program or "raddbg", opt)
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program, opt)
+ end
+
+ -- ok?
+ return program, version
+end
diff --git a/xmake/modules/devel/debugger/run.lua b/xmake/modules/devel/debugger/run.lua
index 29c3f8c45..09d8641c8 100644
--- a/xmake/modules/devel/debugger/run.lua
+++ b/xmake/modules/devel/debugger/run.lua
@@ -32,6 +32,7 @@ import("detect.tools.find_ollydbg")
import("detect.tools.find_devenv")
import("detect.tools.find_vsjitdebugger")
import("detect.tools.find_renderdoc")
+import("detect.tools.find_raddbg")
import("lib.detect.find_tool")
import("private.action.run.runenvs")
@@ -330,6 +331,25 @@ function _run_seergdb(program, argv, opt)
return true
end
+-- run rad debugger
+function _run_raddbg(program, argv, opt)
+
+ -- find raddbg
+ opt = opt or {}
+ local raddbg = find_raddbg({program = config.get("debugger")})
+ if not raddbg then
+ return false
+ end
+
+ -- patch arguments
+ argv = argv or {}
+ table.insert(argv, 1, program)
+
+ -- run it
+ os.execv(raddbg, argv, table.join(opt, {exclusive = true}))
+ return true
+end
+
-- run program with debugger
--
-- @param program the program name
@@ -365,6 +385,7 @@ function main(program, argv, opt)
table.insert(debuggers, 1, {"x64dbg", _run_x64dbg})
table.insert(debuggers, 1, {"vsjitdebugger", _run_vsjitdebugger})
table.insert(debuggers, 1, {"devenv", _run_devenv})
+ table.insert(debuggers, 1, {"raddbg", _run_raddbg})
end
-- get debugger from configuration