"Working assets in prototype version"

This commit is contained in:
FlightControl_Master 2017-11-07 17:56:59 +01:00
parent e9837acda3
commit ac0d2fa92c
6 changed files with 37 additions and 17 deletions

View File

@ -2120,6 +2120,8 @@ function M.get_uri (source)
else
uri = get_abs_file_uri (source)
end
BASE:E( { uri=uri } )
uri_cache[source] = uri
return uri
@ -2157,6 +2159,9 @@ function M.init(executionplatform,workingdirectory)
-- define current platform
--------------------------
-- check parameter
BASE:E({executionplatform=executionplatform, workingdirectory=workingdirectory})
if executionplatform and executionplatform ~= "unix" and executionplatform ~="win" then
error("Unable to initialize platform module : execution platform should be 'unix' or 'win'.")
end
@ -2213,7 +2218,10 @@ function M.init(executionplatform,workingdirectory)
M.to_path = function (parsed_url) return url.unescape(parsed_url.path):gsub("^/", "") end
local unixnormalize = M.normalize
M.normalize = function(path) return unixnormalize(path:gsub("\\","/"):lower()) end
M.normalize = function(path)
local unixnormalpath = unixnormalize(path:gsub("\\","/"):lower())
return unixnormalpath
end
-- determine base dir
local function getworkingdirectory()
@ -2221,6 +2229,7 @@ function M.init(executionplatform,workingdirectory)
if p then
local res = p:read("*l")
p:close()
BASE:E( { res = res } )
return M.normalize(res)
end
end
@ -2414,7 +2423,7 @@ end
function M.log(level, msg, ...)
if (LEVELS[level] or -1) > LOG_LEVEL then return end
if select("#", ...) > 0 then msg = msg:format(...) end
io.base.stderr:write(string.format("DEBUGGER\t%s\t%s\n", level, msg))
env.info(string.format("DEBUGGER\t%s\t%s\n", level, msg))
end
return M
@ -2922,7 +2931,10 @@ do
BASE:E( { "File", file, "Line", line } )
local bps = file_mapping[file] and file_mapping[file][line]
BASE:E( { "Debug", file_mapping[file], bps } )
if not bps then return nil end
BASE:E("matched debug")
local do_break = false
for _, bp in pairs(bps) do
@ -3065,6 +3077,7 @@ end
local function debugger_loop(self, async_packet)
self.skt:settimeout(nil) -- set socket blocking
BASE:E( "in debugger loop" )
-- in async mode, the debugger does not wait for another command before continuing and does not modify previous_context
local async_mode = async_packet ~= nil
@ -3092,7 +3105,9 @@ local function debugger_loop(self, async_packet)
-- invoke function
local func = commands[cmd]
if func then
BASE:E( "before call" )
local ok, cont = xpcall(function() return func(self, args, data) end, debug.traceback)
BASE:E( { "after call", ok } )
if not ok then -- internal exception
local code, msg, attr
if type(cont) == "table" and getmetatable(cont) == dbgp.DBGP_ERR_METATABLE then
@ -3132,8 +3147,13 @@ end
local function line_hook(line)
local do_break, packet = nil, nil
local info = active_session.coro:getinfo(0, "S")
local uri = platform.get_uri(info.source)
--BASE:E( { "Source", info.source, debugger_uri } )
local ModifiedSource = info.source
ModifiedSource = ModifiedSource:match( '^Scripts/Moose/(.*)' ) or ModifiedSource
ModifiedSource = "@"..ModifiedSource
local uri = platform.get_uri(ModifiedSource)
BASE:E( { "Source", info.source, ModifiedSource, uri, debugger_uri } )
if uri and uri ~= debugger_uri and uri ~= transportmodule_uri then -- the debugger does not break if the source is not known
do_break = core.breakpoints.at(uri, line) or core.events.does_match()
if do_break then
@ -3162,7 +3182,6 @@ end)
local function debugger_hook(event, line)
local thread = corunning() or "main"
env.info( "running" )
if event == "call" then
stack_levels[thread] = stack_levels[thread] + 1
elseif event == "tail call" then
@ -3185,7 +3204,6 @@ end
if rawget(_G, "jit") then
debugger_hook = function(event, line)
local thread = corunning() or "main"
env.info( "running" )
if event == "call" then
if debug.getinfo(2, "S").what == "C" then return end
stack_levels[thread] = stack_levels[thread] + 1

View File

@ -11,7 +11,11 @@ _DATABASE = DATABASE:New() -- Core.Database#DATABASE
_SETTINGS = SETTINGS:Set()
local initconnection = require("debugger")
initconnection( "127.0.0.1", 10000, "dcsserver", nil, nil, "C:\Program Files\Eagle Dynamics\DCS World" )
package.path = package.path..";D:\\GitHub\\MOOSE_MISSIONS\\SPA - Spawning\\DEBUG test\\?.lua;"
print("hello")
local initconnection = require("debugger")
initconnection( "127.0.0.1", 10000, "dcsserver", nil, "win", "C:/Users/svenv/AppData/Local/Temp/DCS/Mission/l10n/DEFAULT" )
print("Debugger is configured!")

View File

@ -10,7 +10,7 @@ __Moose.Include = function( LuaPath, IncludeFile )
if f == nil then
error ("Moose: Could not load Moose file " .. IncludeFile )
else
env.info( "Moose: " .. IncludeFile .. " dynamically loaded from " .. __Moose.ProgramPath )
env.info( "Moose: " .. IncludeFile .. " dynamically loaded from " .. LuaPath )
return f()
end
end

View File

@ -78,4 +78,4 @@ Tasking/Task_Cargo.lua
Tasking/TaskZoneCapture.lua
Moose.lua
Mission.lua

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20171105_0627' )
env.info( 'Moose Generation Timestamp: 20171107_1722' )
local base = _G
@ -12,7 +12,7 @@ __Moose.Include = function( LuaPath, IncludeFile )
if f == nil then
error ("Moose: Could not load Moose file " .. IncludeFile )
else
env.info( "Moose: " .. IncludeFile .. " dynamically loaded from " .. __Moose.ProgramPath )
env.info( "Moose: " .. IncludeFile .. " dynamically loaded from " .. LuaPath )
return f()
end
end
@ -94,6 +94,5 @@ __Moose.Include( __Moose.ProgramPath, 'Tasking/Task_A2A.lua' )
__Moose.Include( __Moose.ProgramPath, 'Tasking/Task_Cargo.lua' )
__Moose.Include( __Moose.ProgramPath, 'Tasking/TaskZoneCapture.lua' )
__Moose.Include( __Moose.ProgramPath, 'Moose.lua' )
__Moose.Include( __Moose.ProgramPath, 'Mission.lua' )
BASE:TraceOnOff( true )
env.info( '*** MOOSE INCLUDE END *** ' )

View File

@ -1,5 +1,5 @@
env.info('*** MOOSE DYNAMIC INCLUDE START *** ')
env.info('Moose Generation Timestamp: 20171105_0627')
env.info('Moose Generation Timestamp: 20171107_1722')
local base=_G
__Moose={}
__Moose.Include=function(LuaPath,IncludeFile)
@ -9,7 +9,7 @@ local f=assert(base.loadfile(LuaPath..IncludeFile))
if f==nil then
error("Moose: Could not load Moose file "..IncludeFile)
else
env.info("Moose: "..IncludeFile.." dynamically loaded from "..__Moose.ProgramPath)
env.info("Moose: "..IncludeFile.." dynamically loaded from "..LuaPath)
return f()
end
end
@ -89,6 +89,5 @@ __Moose.Include(__Moose.ProgramPath,'Tasking/Task_A2A.lua')
__Moose.Include(__Moose.ProgramPath,'Tasking/Task_Cargo.lua')
__Moose.Include(__Moose.ProgramPath,'Tasking/TaskZoneCapture.lua')
__Moose.Include(__Moose.ProgramPath,'Moose.lua')
__Moose.Include(__Moose.ProgramPath,'Mission.lua')
BASE:TraceOnOff(true)
env.info('*** MOOSE INCLUDE END *** ')