From d7e7aa275a686d025188840a9720c7ff05812c8b Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 6 Nov 2017 02:02:16 +0100 Subject: [PATCH] Fix handling of unnamed functions. --- TracyLua.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TracyLua.hpp b/TracyLua.hpp index 9da88628..0cab28d9 100644 --- a/TracyLua.hpp +++ b/TracyLua.hpp @@ -68,7 +68,8 @@ static inline int LuaZoneBegin( lua_State* L ) lua_getinfo( L, "Snl", &dbg ); const uint32_t line = dbg.currentline; - const auto fsz = strlen( dbg.name ); + const auto name = dbg.name ? dbg.name : dbg.short_src; + const auto fsz = strlen( name ); const auto ssz = strlen( dbg.source ); // Data layout: @@ -83,7 +84,7 @@ static inline int LuaZoneBegin( lua_State* L ) memcpy( ptr, &sz, 4 ); memcpy( ptr + 4, &color, 4 ); memcpy( ptr + 8, &line, 4 ); - memcpy( ptr + 12, dbg.name, fsz+1 ); + memcpy( ptr + 12, name, fsz+1 ); memcpy( ptr + 12 + fsz + 1, dbg.source, ssz ); Magic magic;