lua-users home
lua-l archive

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

Am 25.02.2014 11:14 schröbte Dirk Laurie:
2014-02-25 11:51 GMT+02:00 Ico <>:

Are there other people out there who are having issues with tail call stack
traces, and if so, how dow you handle this in real life debugging?

You could avoid tail calls until the program is debugged.

A tail call arises in this situation:

    return func(x,y,z)

If you don't know how many values func will return, you're stuck with
the tail call.

Otherwise you can do:

    local a,b,c = func(x,y,z)
    return a,b,c

Well, you could do something like this:

    return notail( func( x, y, z ) )

where `notail` is

    function notail( ... )
      return ...

to avoid the original tail call, but this also requires an application restart. It could still be useful if you only want to disable a single tail call site. There is a Lua 5.2 parser in the rocks repository, so maybe one could write a script that adds/removes the `notail` instrumentation automatically ...

Personally, I haven't had the problem yet. I usually don't have multiple different tail calls per function, so the stack traces are still non-ambiguous.