From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 01F676EC55; Wed, 14 Jul 2021 12:42:17 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 01F676EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626255737; bh=8K86wDkoVduht+8Xr7s0Fgzhg3Wh6UxQbqm9cityYS4=; h=To:References:Cc:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=xW3lzDyOTmOrZAYsHsg978KZvQk8fEtQNU4iQR/QXh0PtjZR/xfC7TTOt0ddPplsG Wu+csL25wcng4YjEnWboNbVrSS6oZsfwu84mCDNKToyiFc8OLbIHpg8NzlxYGrErym bMB80NEk0UBKvWRrQPZ947XmK19K3ol34jEJklxY= Received: from smtp31.i.mail.ru (smtp31.i.mail.ru [94.100.177.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 0CA736EC55 for ; Wed, 14 Jul 2021 12:42:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0CA736EC55 Received: by smtp31.i.mail.ru with esmtpa (envelope-from ) id 1m3bPD-0000XP-GT; Wed, 14 Jul 2021 12:42:15 +0300 To: Cyrill Gorcunov References: <731388d8274f1c36107202cd419516d44c7e3453.1625827535.git.elchinov.es@gmail.com> Cc: tarantool-patches@dev.tarantool.org Message-ID: Date: Wed, 14 Jul 2021 12:42:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD97BB0EF39AD2B33D5CFD6F66580F08A9EEA70CBC893E637A3182A05F538085040CC4E7722247ECEA6C22E12958E3DF4478AB3150ED806AF299327306847B97AE3 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7DB84ED444C624799EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637C8BD49B17AF1FC7C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D84AFB6BA18579A0A1C635415B3D2A44AF117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAA867293B0326636D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8B2EE5AD8F952D28FBA471835C12D1D977C4224003CC836476EB9C4185024447017B076A6E789B0E975F5C1EE8F4F765FC6D0AFCEC082C63FA3AA81AA40904B5D9CF19DD082D7633A078D18283394535A93AA81AA40904B5D98AA50765F7900637B6AA9AC90074E5A0D81D268191BDAD3D698AB9A7B718F8C4D1B931868CE1C5781A620F70A64A45A98AA50765F79006372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89FF841BD135A60A317156CCFE7AF13BCA4B5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A5B06361A47754290CB9D1167706A82E0BECA7DF61EFA14BA8D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA753753CEE10E4ED4A7410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D348D68DCC07DD06FF516541F77DB33A79F5283F654100B7AA59DC260599E45DE4E3EA45FAC4FFFB1221D7E09C32AA3244C06914FA1AF72BA4EB846B59E81A50EE4F165894D92D62706729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojDdSFIg49M1SsemGykK8tew== X-Mailru-Sender: EFA0F3A8419EF2166B053C73E674FFD5FD002FE6573683FBC55D30B8D33B9E5EE2527C969975515C67F54F2D6EFFC80BC77752E0C033A69E17841C44D9B5D58765F2F89A5AFDB6F16C18EFA0BB12DBB0 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 3/4] fiber: refactor lua backtrace routines X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Egor Elchinov via Tarantool-patches Reply-To: Egor Elchinov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On 12.07.2021 15:13, Cyrill Gorcunov via Tarantool-patches wrote: > On Fri, Jul 09, 2021 at 02:03:52PM +0300, Egor Elchinov via Tarantool-patches wrote: >> From: Egor Elchinov >> >> Lua backtrace with callback moved to new routine >> `lua_backtrace_cb()` similar to the `backtrace_cb()` >> for C backtrace. >> >> Needed for: #4002 >> #ifdef ENABLE_BACKTRACE >> static void >> -dump_lua_frame(struct lua_State *L, lua_Debug *ar, int tb_frame) >> +dump_lua_frame(struct lua_State *L, const char *name, const char *src, int line, >> + int tb_frame) >> { >> char buf[512]; >> snprintf(buf, sizeof(buf), "%s in %s at line %i", >> - ar->name != NULL ? ar->name : "(unnamed)", >> - ar->source, ar->currentline); >> + name != NULL ? name : "(unnamed)", src, line); > > Please add explicit \0 here to the buffer > > buf[sizeof(buf)-1] = 0; > > and in other places of this patch as well. > Fixed. >> >> +static int >> +dump_lua_frame_cb(lua_Debug *ar, int tb_frame, void *cb_ctx) >> +{ >> + (void) tb_frame; >> + struct lua_fiber_tb_ctx *tb_ctx = (struct lua_fiber_tb_ctx *)cb_ctx; > > Side note: for plain C you don't need to put explicit type conversion > from void, iow > > struct lua_fiber_tb_ctx *tb_ctx = cb_ctx; > > ie enough, but up to you. The rest is ok to me, thanks! > Thanks for this observation. Although, it seems to me that in this case it's better to make an explicit cast for consistency with other similar cases and C++ rules.