Tarantool development patches archive
 help / color / mirror / Atom feed
From: Egor Elchinov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 3/4] fiber: refactor lua backtrace routines
Date: Wed, 14 Jul 2021 12:42:15 +0300
Message-ID: <a0214869-c633-22aa-d0ee-ae34d1335c48@tarantool.org> (raw)
In-Reply-To: <YOwx1PRfwpKoIJw7@grain>



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 <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.
> 
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.

  reply	other threads:[~2021-07-14  9:42 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
2021-07-14  9:42     ` Egor Elchinov via Tarantool-patches [this message]
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=a0214869-c633-22aa-d0ee-ae34d1335c48@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=eelchinov@tarantool.org \
    --cc=gorcunov@gmail.com \
    /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

Tarantool development patches archive

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lists.tarantool.org/tarantool-patches/0 tarantool-patches/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 tarantool-patches tarantool-patches/ https://lists.tarantool.org/tarantool-patches \
		tarantool-patches@dev.tarantool.org.
	public-inbox-index tarantool-patches

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git