diff options
| author | Arthur LAURENT <[email protected]> | 2026-01-29 22:23:52 +0100 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2026-01-29 22:23:52 +0100 |
| commit | f7ee57213edeb8372a6a00407e7899bf62d7897b (patch) | |
| tree | 281a2d039055dfe235733230950d9fb357c292dc | |
| parent | 45f856e3ccdec7da98ac7f07251f30d85640d268 (diff) | |
(debuggers) add support of nnd
| -rw-r--r-- | xmake/modules/detect/tools/find_nnd.lua | 55 | ||||
| -rw-r--r-- | xmake/modules/devel/debugger/run.lua | 22 |
2 files changed, 77 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_nnd.lua b/xmake/modules/detect/tools/find_nnd.lua new file mode 100644 index 000000000..4666a0327 --- /dev/null +++ b/xmake/modules/detect/tools/find_nnd.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, Xmake Open Source Community. +-- +-- @author ruki, Arthapz +-- @file find_nnd.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find nnd +-- +-- @param opt the argument options, e.g. {version = true, program="/usr/bin/nnd"} +-- +-- @return program, version +-- +-- @code +-- +-- local nnd = find_nnd() +-- local nnd, version = find_nnd({version = true}) +-- local nnd, version = find_nnd({version = true, program = "/usr/bin/nnd"}) +-- +-- @endcode +-- +function main(opt) + + -- init options + opt = opt or {} + + -- find program + local program = find_program(opt.program or "nnd", 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 e5cb31b6c..60e2b7b5a 100644 --- a/xmake/modules/devel/debugger/run.lua +++ b/xmake/modules/devel/debugger/run.lua @@ -310,6 +310,23 @@ function _run_raddbg(program, argv, opt) return true end +-- run nnd +function _run_nnd(program, argv, opt) + opt = opt or {} + local nnd = find_tool("nnd", {program = config.get("debugger")}) + if not nnd then + return false + end + + -- patch arguments + argv = argv or {} + table.insert(argv, 1, program) + + -- run it + os.execv(nnd.program, argv, table.join(opt, {exclusive = true})) + return true +end + -- run program with debugger -- -- @param program the program name @@ -339,6 +356,11 @@ function main(program, argv, opt) } -- for windows target or on windows? + if (config.plat() or os.host()) == "linux" then + table.insert(debuggers, 1, {"nnd", _run_nnd}) + end + + -- for windows target or on windows? if (config.plat() or os.host()) == "windows" then table.insert(debuggers, 1, {"windbg", _run_windbg}) table.insert(debuggers, 1, {"ollydbg", _run_ollydbg}) |
