lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Aug 25, 2011 at 7:18 PM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>> It seems to have only one filename per Proto.
> That's the real problem. Line numbers are not hard.

Does your debugger utilize debug.getinfo and debug.traceback?  If so,
could you replace those functions at run-time with ones that remap the
file names?  It may go roughly like this:

local old_getinfo = debug.getinfo
function debug.getinfo(...)
  ........
  local t = old_getinfo(........)
  if t.source:match'^@.*%.preprocessed$' then
    <read source file or byte code with specially encoded source/line
info in comments or debug info>
    t.source = translated_source
    t.currentline = translated_line
    ......
  end
  ........
  return t
end