diff options
| author | ruki <[email protected]> | 2025-02-03 23:45:10 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-02-03 23:45:10 +0800 |
| commit | 5e865e25fc58773ab0194084b6f6506f463e68e4 (patch) | |
| tree | 1a693bf1bed6e164b070c9e2519a9f896a35f0e1 | |
| parent | fffc4190d7c706156e8421a7381c0bb62ae90cc8 (diff) | |
| parent | 6e24f29490f494edba9b56d635f2fd79fe03dcba (diff) | |
Merge pull request #6130 from Gaweringo/add-raddbg-debugger
feat(debugger): add raddbg as a debugger option
| -rw-r--r-- | xmake/modules/detect/tools/find_raddbg.lua | 47 | ||||
| -rw-r--r-- | xmake/modules/devel/debugger/run.lua | 18 |
2 files changed, 65 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..c6a573574 --- /dev/null +++ b/xmake/modules/detect/tools/find_raddbg.lua @@ -0,0 +1,47 @@ +--!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) + opt = opt or {} + local program = find_program(opt.program or "raddbg", opt) + local version = nil + if program and opt and opt.version then + version = find_programver(program, opt) + end + return program, version +end diff --git a/xmake/modules/devel/debugger/run.lua b/xmake/modules/devel/debugger/run.lua index 72e06a2e7..ae13455f6 100644 --- a/xmake/modules/devel/debugger/run.lua +++ b/xmake/modules/devel/debugger/run.lua @@ -292,6 +292,23 @@ function _run_seergdb(program, argv, opt) return true end +-- run rad debugger +function _run_raddbg(program, argv, opt) + opt = opt or {} + local raddbg = find_tool("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.program, argv, table.join(opt, {exclusive = true})) + return true +end + -- run program with debugger -- -- @param program the program name @@ -327,6 +344,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 |
