diff options
| author | ruki <[email protected]> | 2016-07-24 13:45:07 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-24 13:45:07 +0800 |
| commit | 1c42c1e90812ea0da1153f193ea2ce061536187e (patch) | |
| tree | 9db8afa7b4dc53bbe8bd1291a7f42ace141a8166 | |
| parent | 5a3fdfe6b783ff2e0a3878cb84e1775d52d4be38 (diff) | |
add windows debugger
| -rw-r--r-- | xmake/platforms/windows/checker.lua | 59 | ||||
| -rw-r--r-- | xmake/tools/ollydbg.lua | 51 | ||||
| -rw-r--r-- | xmake/tools/vsjitdebugger.lua | 51 | ||||
| -rw-r--r-- | xmake/tools/windbg.lua | 51 |
4 files changed, 212 insertions, 0 deletions
diff --git a/xmake/platforms/windows/checker.lua b/xmake/platforms/windows/checker.lua index a435fa74d..4abfd0ad5 100644 --- a/xmake/platforms/windows/checker.lua +++ b/xmake/platforms/windows/checker.lua @@ -193,6 +193,64 @@ function _check_toolchains(config) environment.leave("toolchains") end +-- check the debugger +function _check_debugger(config) + + -- get debugger + local debugger = config.get("dd") + if debugger then + return + end + + -- query the debugger info for x64 + local info = try + { + function () + return os.iorun("reg query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug\" /v Debugger") + end + } + -- query the debugger info for x86 + if not info then + info = try + { + function () + return os.iorun("reg query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug\" /v Debugger") + end + } + end + + -- parse the debugger path + -- + -- ! REG.EXE VERSION 3.0 + -- + -- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug + -- Debugger REG_SZ "C:\WINDOWS\system32\vsjitdebugger.exe" -p %ld -e %ld + if info then + debugger = info:match("Debugger%s+REG_SZ%s+\"(.+)\"") + if debugger then + debugger = debugger:trim() + end + end + + -- this debugger exists? + if debugger and path.is_absolute(debugger) and not os.isfile(debugger) then + debugger = nil + end + + -- check ok? update it + if debugger then + + -- save it + config.set("dd", debugger) + + -- trace + print("checking for the debugger ... %s", path.filename(debugger)) + else + -- failed + print("checking for the debugger ... no") + end +end + -- init it function init() @@ -202,6 +260,7 @@ function init() { checker.check_arch, "x86" } , _check_vs , _check_toolchains + , _check_debugger } -- init the check list of global diff --git a/xmake/tools/ollydbg.lua b/xmake/tools/ollydbg.lua new file mode 100644 index 000000000..9bd26560f --- /dev/null +++ b/xmake/tools/ollydbg.lua @@ -0,0 +1,51 @@ +--!The Make-like Build Utility based on Lua +-- +-- XMake is free software; you can redistribute it and/or modify +-- it under the terms of the GNU Lesser General Public License as published by +-- the Free Software Foundation; either version 2.1 of the License, or +-- (at your option) any later version. +-- +-- XMake is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public License +-- along with XMake; +-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> +-- +-- Copyright (C) 2015 - 2016, ruki All rights reserved. +-- +-- @author ruki +-- @file ollydbg.lua +-- + +-- init it +function init(shellname) + + -- save name + _g.shellname = shellname or "ollydbg" + +end + +-- get the property +function get(name) + + -- get it + return _g[name] +end + +-- run the debugged program with arguments +function run(shellname, argv) + + -- patch arguments + argv = argv or {} + table.insert(argv, 1, shellname) + + -- run it + os.execv(_g.shellname, argv) +end + +-- check the given flags +function check(flags) +end diff --git a/xmake/tools/vsjitdebugger.lua b/xmake/tools/vsjitdebugger.lua new file mode 100644 index 000000000..d4b7cd0c8 --- /dev/null +++ b/xmake/tools/vsjitdebugger.lua @@ -0,0 +1,51 @@ +--!The Make-like Build Utility based on Lua +-- +-- XMake is free software; you can redistribute it and/or modify +-- it under the terms of the GNU Lesser General Public License as published by +-- the Free Software Foundation; either version 2.1 of the License, or +-- (at your option) any later version. +-- +-- XMake is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public License +-- along with XMake; +-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> +-- +-- Copyright (C) 2015 - 2016, ruki All rights reserved. +-- +-- @author ruki +-- @file vsjitdebugger.lua +-- + +-- init it +function init(shellname) + + -- save name + _g.shellname = shellname or "vsjitdebugger" + +end + +-- get the property +function get(name) + + -- get it + return _g[name] +end + +-- run the debugged program with arguments +function run(shellname, argv) + + -- patch arguments + argv = argv or {} + table.insert(argv, 1, shellname) + + -- run it + os.execv(_g.shellname, argv) +end + +-- check the given flags +function check(flags) +end diff --git a/xmake/tools/windbg.lua b/xmake/tools/windbg.lua new file mode 100644 index 000000000..024f1b34d --- /dev/null +++ b/xmake/tools/windbg.lua @@ -0,0 +1,51 @@ +--!The Make-like Build Utility based on Lua +-- +-- XMake is free software; you can redistribute it and/or modify +-- it under the terms of the GNU Lesser General Public License as published by +-- the Free Software Foundation; either version 2.1 of the License, or +-- (at your option) any later version. +-- +-- XMake is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public License +-- along with XMake; +-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a> +-- +-- Copyright (C) 2015 - 2016, ruki All rights reserved. +-- +-- @author ruki +-- @file windbg.lua +-- + +-- init it +function init(shellname) + + -- save name + _g.shellname = shellname or "windbg" + +end + +-- get the property +function get(name) + + -- get it + return _g[name] +end + +-- run the debugged program with arguments +function run(shellname, argv) + + -- patch arguments + argv = argv or {} + table.insert(argv, 1, shellname) + + -- run it + os.execv(_g.shellname, argv) +end + +-- check the given flags +function check(flags) +end |
