[Tarantool-patches] [PATCH 0/2] Minor enhancements in luajit-gdb.py
Igor Munkin
imun at tarantool.org
Tue Feb 1 00:33:53 MSK 2022
This series provides several minor but vital enhancements for <lj-gc>
and <lj-stack> commands. For more info please proceed to the particular
commit message.
Branch: https://github.com/tarantool/luajit/tree/imun/luajit-gdb-minor-enhancements
CI is red[1], but... em... I didn't dig the particular reasons for its
failure, since all of them looks to be related to our infra.
Since we have no CI for luajit-gdb.py, one can try the following test
scenario:
| $ ./tarantool -v
| Tarantool 2.10.0-beta2-73-g10acda7b5
| Target: Linux-x86_64-Debug
| Build options: cmake . -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_BACKTRACE=ON
| Compiler: /usr/bin/cc /usr/bin/c++
| C_FLAGS: -fexceptions -funwind-tables -fno-omit-frame-pointer -fno-stack-protector -fno-common -fopenmp -msse2 -std=c11 -Wall -Wextra -Wno-strict-aliasing -Wno-char-subscripts -Wno-format-truncation -Wno-gnu-alignof-expression -fno-gnu89-inline -Wno-cast-function-type -Werror
| CXX_FLAGS: -fexceptions -funwind-tables -fno-omit-frame-pointer -fno-stack-protector -fno-common -fopenmp -msse2 -std=c++11 -Wall -Wextra -Wno-strict-aliasing -Wno-char-subscripts -Wno-format-truncation -Wno-invalid-offsetof -Wno-gnu-alignof-expression -Wno-cast-function-type -Werror
| $ gdb ./tarantool
| GNU gdb (Gentoo 11.1 vanilla) 11.1
|
| <snipped>
|
| Reading symbols from ./tarantool...
| (gdb) r
| Starting program: /tarantool/src/tarantool
| [Thread debugging using libthread_db enabled]
| Using host libthread_db library "/lib64/libthread_db.so.1".
| Tarantool 2.10.0-beta2-73-g10acda7b5
| type 'help' for interactive help
| tarantool> ffi = require 'ffi'
| ---
| ...
|
| tarantool> ffi.cdef('struct x { int i; };')
| ---
| ...
|
| tarantool> a = ffi.gc(ffi.new('struct x', { i = 1 }), function(self) self.i = 0 end)
| ---
| ...
|
| tarantool> b = ffi.gc(ffi.new('struct x', { i = 2 }), function(self) self.i = 0 end)
| ---
| ...
|
| tarantool> a = nil
| ---
| ...
|
| tarantool> b = nil
| ---
| ...
|
| tarantool>
| Program received signal SIGINT, Interrupt.
| 0x00007ffff5684536 in epoll_wait () from /lib64/libc.so.6
| (gdb) b lj_cf_collectgarbage
| Breakpoint 1 at 0x55555583468f: file /tarantool/third_party/luajit/src/lib_base.c, line 437.
| (gdb) c
| Continuing.
| collectgarbage()
|
| Breakpoint 1, lj_cf_collectgarbage (L=0x400004a0) at /tarantool/third_party/luajit/src/lib_base.c:437
| 437 {
| (gdb) s
| 438 int opt = lj_lib_checkopt(L, 1, LUA_GCCOLLECT, /* ORDER LUA_GC* */
| (gdb) source ../third_party/luajit/src/luajit-gdb.py
| 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-stack L
| ----------- Red zone: 5 slots -----------
| 0x40047fc0 [ ] VALUE: nil
| 0x40047fb8 [ ] VALUE: nil
| 0x40047fb0 [ ] VALUE: nil
| 0x40047fa8 [ ] VALUE: nil
| 0x40047fa0 [ ] VALUE: nil
| ----------- Stack: 168 slots -----------
| 0x40047f98 [ M] VALUE: nil
| 0x40047ae0:0x40047f90 [ ] 151 slots: Free stack slots
| 0x40047ad8 [ BT ] VALUE: number 2.3873090119523254e-313
| 0x40047ad0 [ ] FRAME: [PP] delta=1, fast function #27
| 0x40047ac8 [ ] FRAME: [L] delta=7, fast function #20
| 0x40047ac0 [ ] VALUE: Lua function @ 0x400c00b0, 2 upvalues, "@builtin/box/console.lua":243
| 0x40047ab8 [ ] VALUE: nil
| 0x40047ab0 [ ] VALUE: Lua function @ 0x4013b010, 0 upvalues, "return collectgarbage()":0
| 0x40047aa8 [ ] VALUE: nil
| 0x40047aa0 [ ] VALUE: string "collectgarbage()" @ 0x40149538
| 0x40047a98 [ ] VALUE: table @ 0x400c0f88 (asize: 0, hmask: 0x1)
| 0x40047a90 [ ] FRAME: [LP] delta=3, Lua function @ 0x4014fe30, 3 upvalues, "@builtin/box/console.lua":379
| 0x40047a88 [ ] VALUE: string "collectgarbage()" @ 0x40149538
| 0x40047a80 [ ] VALUE: table @ 0x400c0f88 (asize: 0, hmask: 0x1)
| 0x40047a78 [ ] FRAME: [L] delta=3, Lua function @ 0x40075aa8, 1 upvalues, "@builtin/box/console.lua":701
| 0x40047a70 [ ] VALUE: string "/home/imun" @ 0x400ff388
| 0x40047a68 [ ] VALUE: table @ 0x400c0f88 (asize: 0, hmask: 0x1)
| 0x40047a60 [ ] FRAME: [CP] delta=1, Lua function @ 0x4014d0c8, 5 upvalues, "@builtin/box/console.lua":746
| 0x40047a58 [S ] FRAME: dummy L
| (gdb) lj-gc
| GC stats: PAUSE
| total: 1211508
| threshold: 1977000
| debt: 0
| estimate: 988555
| stepmul: 200
| pause: 200
| sweepstr: 8192/8192
| root: 6774 objects
| gray: 0 objects
| grayagain: 21 objects
| weak: 20 objects
| mmudata: 0 objects
| (gdb) b gc_finalize
| Breakpoint 2 at 0x55555581d67b: file /tarantool/third_party/luajit/src/lj_gc.c, line 511.
| (gdb) c
| Continuing.
|
| Breakpoint 2, gc_finalize (L=0x4019a6b8) at /tarantool/third_party/luajit/src/lj_gc.c:511
| 511 {
| (gdb) lj-gc
| GC stats: FINALIZE
| total: 1055138
| threshold: 1977000
| debt: 0
| estimate: 1055138
| stepmul: 200
| pause: 200
| sweepstr: 8192/8192
| root: 6468 objects
| gray: 0 objects
| grayagain: 1120 objects
| weak: 20 objects
| mmudata: 2 objects
Igor Munkin (2):
gdb: unwind Lua stack top part
gdb: add mmudata value to lj-gc output
src/luajit-gdb.py | 67 +++++++++++++++++++++++++++++++----------------
1 file changed, 44 insertions(+), 23 deletions(-)
[1]: https://github.com/tarantool/tarantool/tree/imun/luajit-gdb-minor-enhancements-full-ci
--
2.34.0
More information about the Tarantool-patches
mailing list