Got something working finally.

This commit is contained in:
FlightControl_Master 2017-11-09 21:36:11 +01:00
parent 0a819f254a
commit f65238efe6
2 changed files with 25 additions and 25 deletions

View File

@ -2121,11 +2121,15 @@ end
function M.get_uri (source)
-- search in cache
if string.sub(1,1) ~= "@" then
source = source:match( "(.*\.lua)$")
if source then
source = "@" .. source
end
BASE:E( { source=source, uri_cache = uri_cache } )
end
if source then
local uri = uri_cache[source]
BASE:E( { uri=uri } )
if uri ~= nil then return uri end
-- not found, create uri
@ -2135,11 +2139,11 @@ function M.get_uri (source)
else
uri = get_abs_file_uri (source)
end
BASE:E( { uri=uri } )
uri_cache[source] = uri
return uri
else
return nil
end
end
-- get path file from uri
@ -2931,8 +2935,6 @@ do
filereg[bp.lineno] = linereg
end
BASE:E( { "Breakpoint", bp } )
table.insert(linereg, bp)
id_mapping[bpid] = bp
@ -2943,14 +2945,9 @@ do
-- and returns whether a breakpoint has matched (boolean)
function core.breakpoints.at(file, line)
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
if bp.state == "enabled" then
@ -3168,7 +3165,6 @@ local function line_hook(line)
--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

View File

@ -110,10 +110,14 @@ routines.utils.oneLineSerialize = function(tbl) -- serialization of a table all
end
tbl_str[#tbl_str + 1] = '}'
return table.concat(tbl_str)
else
if type(tbl) == 'string' then
return tbl
else
return tostring(tbl)
end
end
end
local objectreturn = _Serialize(tbl)
return objectreturn
@ -127,7 +131,7 @@ routines.utils.basicSerialize = function(s)
if ((type(s) == 'number') or (type(s) == 'boolean') or (type(s) == 'function') or (type(s) == 'table') or (type(s) == 'userdata') ) then
return tostring(s)
elseif type(s) == 'string' then
s = string.format('%q', s)
s = string.format('%s', s:gsub( "%%", "%%%%" ) )
return s
end
end