]> git.e2factory.org Git - e2factory.git/commitdiff
Improve module guessing
authorTobias Ulmer <tu@emlix.com>
Tue, 10 Jul 2012 14:09:32 +0000 (16:09 +0200)
committerTobias Ulmer <tu@emlix.com>
Tue, 10 Jul 2012 14:09:32 +0000 (16:09 +0200)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua

index 8007870d8ed20ed21a6d7e98bdaacda9e28cb323..bdc1d7679b541b5ae92f50951b21aea13a7c1226 100644 (file)
@@ -316,11 +316,20 @@ function tracer(event, line)
   end
 
   -- approximate module name, not always accurate but good enough
-  local module = string.match(ftbl.short_src, "(%w+)")
-  module = module or "<unknown module>"
+  local module
+  if ftbl.source == nil or ftbl.source == "=[C]" then
+    module = ""
+  else
+    module = string.match(ftbl.source, "(%w+)%.lua$")
+    module = module .. "."
+  end
+
+  if module == nil then
+    module "<unknown module>."
+  end
 
   if event == "call" then
-    local out = string.format("%s.%s(", module, ftbl.name)
+    local out = string.format("%s%s(", module, ftbl.name)
     for lo = 1, 10 do
       local name, value = debug.getlocal(2, lo)
       if name == nil or name == "(*temporary)" then
@@ -335,7 +344,7 @@ function tracer(event, line)
     out = out .. ")'"
     e2lib.log(4, out)
   else
-    e2lib.log(4, string.format("< %s.%s", module, ftbl.name))
+    e2lib.log(4, string.format("< %s%s", module, ftbl.name))
   end
 end