Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Egor Elchinov via Tarantool-patches
	<tarantool-patches@dev.tarantool.org>
Cc: Egor Elchinov <elchinov.es@gmail.com>
Subject: Re: [Tarantool-patches] [PATCH v2 3/4] fiber: refactor lua backtrace routines
Date: Mon, 12 Jul 2021 15:13:08 +0300	[thread overview]
Message-ID: <YOwx1PRfwpKoIJw7@grain> (raw)
In-Reply-To: <731388d8274f1c36107202cd419516d44c7e3453.1625827535.git.elchinov.es@gmail.com>

On Fri, Jul 09, 2021 at 02:03:52PM +0300, Egor Elchinov via Tarantool-patches wrote:
> From: Egor Elchinov <elchinov.es@gmail.com>
> 
> 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!

  reply	other threads:[~2021-07-12 12:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-09 11:03 [Tarantool-patches] [PATCH v2 0/4] fiber: introduce creation backtrace Egor Elchinov via Tarantool-patches
2021-07-09 11:03 ` [Tarantool-patches] [PATCH v2 1/4] fiber: add PoC for fiber " Egor Elchinov via Tarantool-patches
2021-07-12 11:42   ` Cyrill Gorcunov via Tarantool-patches
2021-07-09 11:03 ` [Tarantool-patches] [PATCH v2 2/4] fiber: add option and PoC for Lua parent backtrace Egor Elchinov via Tarantool-patches
2021-07-12 12:09   ` Cyrill Gorcunov via Tarantool-patches
2021-07-14  9:29     ` Egor Elchinov via Tarantool-patches
2021-07-09 11:03 ` [Tarantool-patches] [PATCH v2 3/4] fiber: refactor lua backtrace routines Egor Elchinov via Tarantool-patches
2021-07-12 12:13   ` Cyrill Gorcunov via Tarantool-patches [this message]
2021-07-14  9:42     ` Egor Elchinov via Tarantool-patches
2021-07-09 11:03 ` [Tarantool-patches] [PATCH v2 4/4] fiber: refactor C backtrace and add changelog Egor Elchinov via Tarantool-patches
2021-07-12 12:35   ` Cyrill Gorcunov via Tarantool-patches
2021-07-14  9:42     ` Egor Elchinov via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YOwx1PRfwpKoIJw7@grain \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=elchinov.es@gmail.com \
    --cc=gorcunov@gmail.com \
    --subject='Re: [Tarantool-patches] [PATCH v2 3/4] fiber: refactor lua backtrace routines' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox