From f65238efe605e67b2a672259f3cbdb252a7a574c Mon Sep 17 00:00:00 2001 From: FlightControl_Master Date: Thu, 9 Nov 2017 21:36:11 +0100 Subject: [PATCH] Got something working finally. --- Moose Development/Debugger/debugger.lua | 44 +++++++++---------- .../Moose/Utilities/Routines.lua | 6 ++- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Moose Development/Debugger/debugger.lua b/Moose Development/Debugger/debugger.lua index 1c99354ad..a03dcb68b 100644 --- a/Moose Development/Debugger/debugger.lua +++ b/Moose Development/Debugger/debugger.lua @@ -2121,25 +2121,29 @@ end function M.get_uri (source) -- search in cache if string.sub(1,1) ~= "@" then - source = "@" .. source - end - BASE:E( { source=source, uri_cache = uri_cache } ) - local uri = uri_cache[source] - BASE:E( { uri=uri } ) - if uri ~= nil then return uri end - - -- not found, create uri - if util.features.uri == "module" then - uri = get_module_uri(source) - if not uri then uri = get_abs_file_uri (source) end - else - uri = get_abs_file_uri (source) + source = source:match( "(.*\.lua)$") + if source then + source = "@" .. source + end end - BASE:E( { uri=uri } ) - uri_cache[source] = uri - return uri + if source then + local uri = uri_cache[source] + if uri ~= nil then return uri end + + -- not found, create uri + if util.features.uri == "module" then + uri = get_module_uri(source) + if not uri then uri = get_abs_file_uri (source) end + else + uri = get_abs_file_uri (source) + end + 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 diff --git a/Moose Development/Moose/Utilities/Routines.lua b/Moose Development/Moose/Utilities/Routines.lua index 3743752b3..508a35ed5 100644 --- a/Moose Development/Moose/Utilities/Routines.lua +++ b/Moose Development/Moose/Utilities/Routines.lua @@ -111,7 +111,11 @@ routines.utils.oneLineSerialize = function(tbl) -- serialization of a table all 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 @@ -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