summaryrefslogtreecommitdiff
path: root/xmake/modules/detect
diff options
context:
space:
mode:
authorruki <[email protected]>2017-05-29 22:12:48 +0800
committerruki <[email protected]>2017-05-29 22:12:48 +0800
commitaf5040e4c197ce261062b925743201358dc5e43c (patch)
treed67339b77b9ac1bb4e26c0a8d7607389a32483d7 /xmake/modules/detect
parent3e8ade50a1bab7031860b3ae6615c828ee1fd448 (diff)
add find lldb, gdb modules and rewrite debugger
Diffstat (limited to 'xmake/modules/detect')
-rw-r--r--xmake/modules/detect/tool/find_gdb.lua59
-rw-r--r--xmake/modules/detect/tool/find_lldb.lua59
-rw-r--r--xmake/modules/detect/tool/find_ollydbg.lua61
-rw-r--r--xmake/modules/detect/tool/find_vsjitdebugger.lua61
-rw-r--r--xmake/modules/detect/tool/find_windbg.lua61
-rw-r--r--xmake/modules/detect/tool/find_x64dbg.lua61
6 files changed, 362 insertions, 0 deletions
diff --git a/xmake/modules/detect/tool/find_gdb.lua b/xmake/modules/detect/tool/find_gdb.lua
new file mode 100644
index 000000000..37b84e647
--- /dev/null
+++ b/xmake/modules/detect/tool/find_gdb.lua
@@ -0,0 +1,59 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you 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 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_gdb.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find gdb
+--
+-- @param opt the argument options, .e.g {version = true, program="/usr/bin/gdb"}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local gdb = find_gdb()
+-- local gdb, version = find_gdb({version = true})
+-- local gdb, version = find_gdb({version = true, program = "/usr/bin/gdb"})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- init options
+ opt = opt or {}
+
+ -- find program
+ local program = find_program(opt.program or "gdb", { "/usr/bin", "/usr/local/bin"})
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program)
+ end
+
+ -- ok?
+ return program, version
+end
diff --git a/xmake/modules/detect/tool/find_lldb.lua b/xmake/modules/detect/tool/find_lldb.lua
new file mode 100644
index 000000000..32d4ff735
--- /dev/null
+++ b/xmake/modules/detect/tool/find_lldb.lua
@@ -0,0 +1,59 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you 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 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_lldb.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find lldb
+--
+-- @param opt the argument options, .e.g {version = true, program="/usr/bin/lldb"}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local lldb = find_lldb()
+-- local lldb, version = find_lldb({version = true})
+-- local lldb, version = find_lldb({version = true, program = "/usr/bin/lldb"})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- init options
+ opt = opt or {}
+
+ -- find program
+ local program = find_program(opt.program or "lldb", { "/usr/bin", "/usr/local/bin"})
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program)
+ end
+
+ -- ok?
+ return program, version
+end
diff --git a/xmake/modules/detect/tool/find_ollydbg.lua b/xmake/modules/detect/tool/find_ollydbg.lua
new file mode 100644
index 000000000..0075e9eb8
--- /dev/null
+++ b/xmake/modules/detect/tool/find_ollydbg.lua
@@ -0,0 +1,61 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you 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 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_ollydbg.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find ollydbg
+--
+-- @param opt the argument options, .e.g {version = true, program = "c:\xxx\ollydbg.exe"}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local ollydbg = find_ollydbg()
+-- local ollydbg, version = find_ollydbg({version = true})
+-- local ollydbg, version = find_ollydbg({version = true, program = "c:\xxx\ollydbg.exe"})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- not on windows?
+ if os.host() ~= "windows" then
+ return
+ end
+
+ -- find program, TODO from winreg
+ local program = find_program(opt.program or "ollydbg", {})
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program)
+ end
+
+ -- ok?
+ return program, version
+end
diff --git a/xmake/modules/detect/tool/find_vsjitdebugger.lua b/xmake/modules/detect/tool/find_vsjitdebugger.lua
new file mode 100644
index 000000000..bc7b12144
--- /dev/null
+++ b/xmake/modules/detect/tool/find_vsjitdebugger.lua
@@ -0,0 +1,61 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you 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 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_vsjitdebugger.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find vsjitdebugger
+--
+-- @param opt the argument options, .e.g {version = true, program = "c:\xxx\vsjitdebugger.exe"}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local vsjitdebugger = find_vsjitdebugger()
+-- local vsjitdebugger, version = find_vsjitdebugger({version = true})
+-- local vsjitdebugger, version = find_vsjitdebugger({version = true, program = "c:\xxx\vsjitdebugger.exe"})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- not on windows?
+ if os.host() ~= "windows" then
+ return
+ end
+
+ -- find program, TODO from winreg
+ local program = find_program(opt.program or "vsjitdebugger", {})
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program)
+ end
+
+ -- ok?
+ return program, version
+end
diff --git a/xmake/modules/detect/tool/find_windbg.lua b/xmake/modules/detect/tool/find_windbg.lua
new file mode 100644
index 000000000..89d9e2563
--- /dev/null
+++ b/xmake/modules/detect/tool/find_windbg.lua
@@ -0,0 +1,61 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you 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 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_windbg.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find windbg
+--
+-- @param opt the argument options, .e.g {version = true, program = "c:\xxx\windbg.exe"}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local windbg = find_windbg()
+-- local windbg, version = find_windbg({version = true})
+-- local windbg, version = find_windbg({version = true, program = "c:\xxx\windbg.exe"})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- not on windows?
+ if os.host() ~= "windows" then
+ return
+ end
+
+ -- find program, TODO from winreg
+ local program = find_program(opt.program or "windbg", {})
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program)
+ end
+
+ -- ok?
+ return program, version
+end
diff --git a/xmake/modules/detect/tool/find_x64dbg.lua b/xmake/modules/detect/tool/find_x64dbg.lua
new file mode 100644
index 000000000..be6c73155
--- /dev/null
+++ b/xmake/modules/detect/tool/find_x64dbg.lua
@@ -0,0 +1,61 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you 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 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_x64dbg.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find x64dbg
+--
+-- @param opt the argument options, .e.g {version = true, program = "c:\xxx\x64dbg.exe"}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local x64dbg = find_x64dbg()
+-- local x64dbg, version = find_x64dbg({version = true})
+-- local x64dbg, version = find_x64dbg({version = true, program = "c:\xxx\x64dbg.exe"})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- not on windows?
+ if os.host() ~= "windows" then
+ return
+ end
+
+ -- find program, TODO from winreg
+ local program = find_program(opt.program or "x64dbg", {})
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ version = find_programver(program)
+ end
+
+ -- ok?
+ return program, version
+end