[Tarantool-patches] [PATCH luajit 16/15] gdb: fix Python <assert> statement usage

Maxim Kokryashkin m.kokryashkin at tarantool.org
Sun Aug 13 23:24:32 MSK 2023


Hi!
Thanks for the patch!
LGTM
--
Best regards,
Maxim Kokryashkin
 
 
> 
>>This <assert> misuse was introduced in the initial implementation of GDB
>>extension within the commit 58790750b9c4bd4c21d883f109ab552a2e202a15
>>("gdb: introduce luajit-gdb extension") and also propagated to the
>>initial implementation of LLDB extension by copy-pasting in scope of the
>>commit 62fc84a8f89b8e5650162ba1c7696b0f84cf5c25 ("lldb: introduce
>>luajit-lldb"). However, <assert> is not a function, but statement, so
>>parenthesis around the condition are considered as a tuple constructor.
>>This patch simply removes the excess parenthesis to finally follow
>>Python semantics of the <assert> statement.
>>
>>Signed-off-by: Igor Munkin < imun at tarantool.org >
>>---
>>
>>**NB**: This patch will be placed before "[PATCH luajit 01/15] test: fix
>>E122 errors by pycodestyle" on the branch.
>>
>>CI:  https://github.com/tarantool/luajit/actions/runs/5785962723/job/15679677849
>>
>> src/luajit-gdb.py | 2 +-
>> src/luajit_lldb.py | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>>diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>>index 9075e99f..b7902d53 100644
>>--- a/src/luajit-gdb.py
>>+++ b/src/luajit-gdb.py
>>@@ -327,7 +327,7 @@ def itypemap(o):
>> 
>> 
>> def funcproto(func):
>>- assert(func['ffid'] == 0)
>>+ assert func['ffid'] == 0
>> 
>>     return cast('GCproto *',
>>                 mref('char *', func['pc']) - gdb.lookup_type('GCproto').sizeof)
>>diff --git a/src/luajit_lldb.py b/src/luajit_lldb.py
>>index 85c0dcb9..94f54a59 100644
>>--- a/src/luajit_lldb.py
>>+++ b/src/luajit_lldb.py
>>@@ -516,7 +516,7 @@ def strx64(val):
>> 
>> 
>> def funcproto(func):
>>- assert(func.ffid == 0)
>>+ assert func.ffid == 0
>>     proto_size = sizeof('GCproto')
>>     value = cast('uintptr_t', vtou64(mref('char *', func.pc)) - proto_size)
>>     return cast(GCprotoPtr, value)
>>--
>>2.30.2
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20230813/c4aaf880/attachment.htm>


More information about the Tarantool-patches mailing list