Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Mikhail Shishatskiy <m.shishatskiy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit] gdb: fix misalignment in lj-stack for LJ_GC64
Date: Thu, 22 Jul 2021 16:35:32 +0300	[thread overview]
Message-ID: <20210722133532.GO11494@tarantool.org> (raw)
In-Reply-To: <20210707071046.649107-1-m.shishatskiy@tarantool.org>

Misha,

I've checked the patch into all long-term branches in tarantool/luajit
and bumped a new version in 1.10, 2.7, 2.8 and master.

On 07.07.21, Mikhail Shishatskiy wrote:
> Since commit 58790750b9c4bd4c21d883f109ab552a2e202a15 ('gdb: introduce
> luajit-gdb extension') when luajit-gdb.py is introduced, Lua stack
> slots printed by lj-stack command are misaligned, when LJ_GC64 is
> enabled. The issue is that PADDING variable used for aligning single
> slots in the output is initialized before LuaJIT build mode is
> defined in <init> function, so the result was the following:
> 
> | 0x7ffff7fb0d90:0x7ffff7fb0dc0 [    ] 7 slots: Red zone
> | 0x7ffff7fb0d88            [   M]
> | 0x7ffff7fb0cc0:0x7ffff7fb0d80 [    ] 25 slots: Free stack slots
> | 0x7ffff7fb0cb8            [  T ]
> | ...
> 
> In scope of this patch, PADDING initialization is also moved to
> <init> function right after all commands are loaded. As a result, the
> output looks as expected:
> 
> | 0x7ffff7fb0d90:0x7ffff7fb0dc0 [    ] 7 slots: Red zone
> | 0x7ffff7fb0d88                [   M]
> | 0x7ffff7fb0cc0:0x7ffff7fb0d80 [    ] 25 slots: Free stack slots
> | 0x7ffff7fb0cb8                [  T ]
> | ...
> 
> Fixes tarantool/tarantool#5876
> ---
> 
> Branch: https://github.com/tarantool/luajit/tree/shishqa/gh-5876
> 
> To test changes do the following:
> 
> | $ gdb -q --args ./luajit -e 'print("QQ")'
> | Reading symbols from ./luajit...
> | lj-arch command initialized
> | lj-tv command initialized
> | lj-str command initialized
> | lj-tab command initialized
> | lj-stack command initialized
> | lj-state command initialized
> | lj-gc command initialized
> | luajit-gdb.py is successfully loaded
> | (gdb) lj-arch
> | LJ_64: True, LJ_GC64: True
> | (gdb) b lj_cf_print
> | Breakpoint 1 at 0x298b0: file /mnt/WorkDisk/share/dev/__tarantool/lj-tarantool/src/lib_base.c, line 485.
> | (gdb) r
> | Starting program: /mnt/WorkDisk/share/dev/__tarantool/lj-tarantool/src/luajit -e print\(\"QQ\"\)
> |
> | Breakpoint 1, lj_cf_print (L=0x0)
> |     at /mnt/WorkDisk/share/dev/__tarantool/lj-tarantool/src/lib_base.c:485
> | 485	{
> | (gdb) s
> | 486	  ptrdiff_t i, nargs = L->top - L->base;
> | (gdb) lj-stack L
> | 0x7ffff7fa8d90:0x7ffff7fa8dc0 [    ] 7 slots: Red zone
> | 0x7ffff7fa8d88                [   M]
> | 0x7ffff7fa8cc0:0x7ffff7fa8d80 [    ] 25 slots: Free stack slots
> | 0x7ffff7fa8cb8                [  T ]
> | 0x7ffff7fa8cb0                [ B  ] VALUE: string "QQ" @ 0x7ffff7fb1178
> | 0x7ffff7fa8ca0:0x7ffff7fa8ca8 [    ] FRAME: [L] delta=2, fast function #29
> | 0x7ffff7fa8c90:0x7ffff7fa8c98 [    ] FRAME: [V] delta=2, Lua function @ 0x7ffff7fb1240, 0 upvalues, "=(command line)":0
> | 0x7ffff7fa8c80:0x7ffff7fa8c88 [    ] FRAME: [CP] delta=4, Lua function @ 0x7ffff7fb1240, 0 upvalues, "=(command line)":0
> | 0x7ffff7fa8c78                [    ] VALUE: C function @ 0x55555555c962
> | 0x7ffff7fa8c70                [    ] VALUE: light userdata @ 0x0
> | 0x7ffff7fa8c60:0x7ffff7fa8c68 [    ] FRAME: [CP] delta=2, C function @ 0x55555555df1c
> | 0x7ffff7fa8c58:0x7ffff7fa8c60 [S   ] FRAME: dummy L
> 
> 
>  src/luajit-gdb.py | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 

<snipped>

> -- 
> 2.32.0
> 

-- 
Best regards,
IM

      parent reply	other threads:[~2021-07-22 13:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07  7:10 Mikhail Shishatskiy via Tarantool-patches
2021-07-07 18:35 ` Igor Munkin via Tarantool-patches
2021-07-22 13:35 ` Igor Munkin via Tarantool-patches [this message]

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=20210722133532.GO11494@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=m.shishatskiy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit] gdb: fix misalignment in lj-stack for LJ_GC64' \
    /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