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 B68BB6EC55; Mon, 12 Jul 2021 15:13:13 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B68BB6EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1626091993; bh=4Ur3ab8tV+VRrQUBDpVAAvPKay8emVslhHaW6ZXeuRI=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Ex5SI+sLotJmU/f02vTJ5zMXhnVxjlRKCpG3Xt1Odc6OrX6+Argzae70E6dpwKWs4 38XuNNo0T9NE5QKbATSg2zJNX18gKoFo3eG1B9keaPV6xLJBr/7DTKYna1aBixdBYc IQagQbz62lad1CIQFreoFDNwR34/Pd94jBITk4HM= Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id A11EC6EC55 for ; Mon, 12 Jul 2021 15:13:11 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A11EC6EC55 Received: by mail-lf1-f45.google.com with SMTP id 22so12622754lfy.12 for ; Mon, 12 Jul 2021 05:13:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1vrPwSCSbaJYhW05cvOSd2+/6cky76UxOoV3wpB2LKo=; b=sOz/uQlf6zKPf5pAOyY2DW4NRviPMewyMjl2KvSRdwgomD3oaFDcN38HoTqvIs91Ek IYs79cEwkjZQseYIv5WI2mCXKXGDJ6ocQxcaCqlJvjIbiOmyR5LeYvdFa9xKnSik2vcV ZukKClmmJ8LBxl1O1TTRqhD0HZGFR1eKcFBRFKIUcimlw8zApvcpDtDEGxNhKNdPZlW4 37chD6P3Ax0QPHYQQWJwTnmS2RJFoU6JpwRoFMqHwTRb1H0MCVeTGDuU7RCHgTDwwXnP vHbkEwpNFPqVl96dxR/gZoFUuWoj9O7Rua0Xn4u0fOkl0RK6QwsvwrwFXOOJ+QePi7lN JXWA== X-Gm-Message-State: AOAM531p+rw2FEea3Gd7jqn8g3HC55EW8zdhCXMjpHCwOzkXPJWiRUOH 6GbuT92LCEVIIYbsDRSsSxxHxmwXitbr3A== X-Google-Smtp-Source: ABdhPJx2tXK8LzRhiPRYS4vyXiob2/paZ8uZ+E4XRng+OD2Q5V0pP3ZWPQaS7C7yLsUfvm4ySK6hFQ== X-Received: by 2002:a19:ae0f:: with SMTP id f15mr7057544lfc.117.1626091990562; Mon, 12 Jul 2021 05:13:10 -0700 (PDT) Received: from grain.localdomain ([5.18.199.94]) by smtp.gmail.com with ESMTPSA id l2sm228551ljc.78.2021.07.12.05.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 05:13:09 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id EBDDF5A001E; Mon, 12 Jul 2021 15:13:08 +0300 (MSK) Date: Mon, 12 Jul 2021 15:13:08 +0300 To: Egor Elchinov via Tarantool-patches Message-ID: References: <731388d8274f1c36107202cd419516d44c7e3453.1625827535.git.elchinov.es@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <731388d8274f1c36107202cd419516d44c7e3453.1625827535.git.elchinov.es@gmail.com> User-Agent: Mutt/2.0.7 (2021-05-04) 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: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: Egor Elchinov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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. > > +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!