Fix debug information about finalizers

The flag CIST_FIN does not mark a finalizer, but the function that was
running when the finalizer was called. (So, the function did not call
the finalizer, but it looks that way in the stack.)
This commit is contained in:
Roberto Ierusalimschy
2021-12-14 12:50:05 -03:00
parent 0bfc572e51
commit 066e0f93c4
5 changed files with 35 additions and 27 deletions

View File

@@ -887,7 +887,7 @@ do -- testing debug info for finalizers
-- create a piece of garbage with a finalizer
setmetatable({}, {__gc = function ()
local t = debug.getinfo(2) -- get callee information
local t = debug.getinfo(1) -- get function information
assert(t.namewhat == "metamethod")
name = t.name
end})

View File

@@ -371,7 +371,7 @@ if T then
warn("@on"); warn("@store")
collectgarbage()
assert(string.find(_WARN, "error in __gc metamethod"))
assert(string.find(_WARN, "error in __gc"))
assert(string.match(_WARN, "@(.-)@") == "expected"); _WARN = false
for i = 8, 10 do assert(s[i]) end