Tarantool development patches archive
 help / color / mirror / Atom feed
From: Mikhail Elhimov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Igor Munkin <imun@tarantool.org>, Mikhail Elhimov <elhimov@gmail.com>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/2] gdb: adjust to support python2 (centos 7)
Date: Thu, 1 Sep 2022 02:17:02 +0300	[thread overview]
Message-ID: <e015ccd7-aa73-f478-d055-d84d491deee6@vk.team> (raw)
In-Reply-To: <Yw90dHw3HgRaRUbM@tarantool.org>

Hi, Igor!

Thanks for the review!

On 31.08.2022 17:47, Igor Munkin wrote:
> Misha,
>
> Thanks for the patch! Almost LGTM after your fixes for Sergey comments:
> please, consider the last nit, I found.
>
> On 23.07.22, Mikhail Elhimov via Tarantool-patches wrote:
>> Stop using unpacking arguments within list initialization as python2
>> only supports it in function call
>>
>> fixes tarantool/luajit#7458
>> ---
>>   src/luajit-gdb.py | 22 ++++++++++++----------
>>   1 file changed, 12 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
>> index baf66f66..1e9a96fb 100644
>> --- a/src/luajit-gdb.py
>> +++ b/src/luajit-gdb.py
>> @@ -432,15 +432,16 @@ def dump_stack(L, base=None, top=None):
>>       maxstack = mref('TValue *', L['maxstack'])
>>       red = 5 + 2 * LJ_FR2
>>   
>> -    dump = '\n'.join([
>> -        '{padding} Red zone: {nredslots: >2} slots {padding}'.format(
>> -            padding = '-' * len(PADDING),
>> -            nredslots = red,
>> -        ),
>> -        *(
>> -            dump_stack_slot(L, maxstack + offset, base, top, '')
>> -                for offset in range(red, 0, -1)
>> -        ),
>> +    dump = []
> Please move this line to the "definition" section above to save the
> original structure.

Fixed.

I personally prefer to do similar operations (populating of `dump` list) 
in a similar way (call appropriate "populating" method). For me 
populating-over-initialization is not the "similar" way here, and I'd 
use it here only if I could initialize whole list at once (as it was 
before). Anyway, if you find that it saves the original structure then 
let it be )

>> +    dump.append('{padding} Red zone: {nredslots: >2} slots {padding}'.format(
>> +        padding = '-' * len(PADDING),
>> +        nredslots = red,
>> +    ))
>> +    dump.extend([
>> +        dump_stack_slot(L, maxstack + offset, base, top, '')
>> +            for offset in range(red, 0, -1)
>> +    ])
>> +    dump.extend([
>>           '{padding} Stack: {nstackslots: >5} slots {padding}'.format(
>>               padding = '-' * len(PADDING),
>>               nstackslots = int((tou64(maxstack) - tou64(stack)) >> 3),
>> @@ -451,7 +452,8 @@ def dump_stack(L, base=None, top=None):
>>               end = strx64(maxstack - 1),
>>               nfreeslots = int((tou64(maxstack) - tou64(top) - 8) >> 3),
>>           ),
>> -    ]) + '\n'
>> +    ])
>> +    dump = '\n'.join(dump) + '\n'
>>   
>>       slot = top
>>       framelink = base - (1 + LJ_FR2)
>> -- 
>> 2.34.1
>>
===================================================

diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py
index baf66f66..9846f3a2 100644
--- a/src/luajit-gdb.py
+++ b/src/luajit-gdb.py
@@ -432,15 +432,17 @@ def dump_stack(L, base=None, top=None):
      maxstack = mref('TValue *', L['maxstack'])
      red = 5 + 2 * LJ_FR2

-    dump = '\n'.join([
+    dump = [
          '{padding} Red zone: {nredslots: >2} slots {padding}'.format(
              padding = '-' * len(PADDING),
              nredslots = red,
          ),
-        *(
-            dump_stack_slot(L, maxstack + offset, base, top, '')
-                for offset in range(red, 0, -1)
-        ),
+    ]
+    dump.extend([
+        dump_stack_slot(L, maxstack + offset, base, top, '')
+            for offset in range(red, 0, -1)
+    ])
+    dump.extend([
          '{padding} Stack: {nstackslots: >5} slots {padding}'.format(
              padding = '-' * len(PADDING),
              nstackslots = int((tou64(maxstack) - tou64(stack)) >> 3),
@@ -451,7 +453,8 @@ def dump_stack(L, base=None, top=None):
              end = strx64(maxstack - 1),
              nfreeslots = int((tou64(maxstack) - tou64(top) - 8) >> 3),
          ),
-    ]) + '\n'
+    ])
+    dump = '\n'.join(dump) + '\n'

      slot = top
      framelink = base - (1 + LJ_FR2)

===================================================

-- 
Best regards,
Mikhail Elhimov


  reply	other threads:[~2022-08-31 23:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-23  0:11 [Tarantool-patches] [PATCH 0/2] gdb: adjust to support Python 2 + refactoring of stack dumping Mikhail Elhimov via Tarantool-patches
2022-07-23  0:11 ` [Tarantool-patches] [PATCH 1/2] gdb: adjust to support python2 (centos 7) Mikhail Elhimov via Tarantool-patches
2022-08-20  6:26   ` Sergey Kaplun via Tarantool-patches
2022-08-22 13:00     ` Mikhail Elhimov via Tarantool-patches
2022-08-22 17:46     ` Mikhail Elhimov via Tarantool-patches
2022-08-31 14:47   ` Igor Munkin via Tarantool-patches
2022-08-31 23:17     ` Mikhail Elhimov via Tarantool-patches [this message]
2022-07-23  0:11 ` [Tarantool-patches] [PATCH 2/2] gdb: refactor iteration over frames while dumping stack Mikhail Elhimov via Tarantool-patches
2022-08-20  6:28   ` Sergey Kaplun via Tarantool-patches
2022-08-23  9:13     ` Mikhail Elhimov via Tarantool-patches
2022-08-31 14:47   ` Igor Munkin via Tarantool-patches
2022-08-31 23:20     ` Mikhail Elhimov via Tarantool-patches
2022-09-14 21:28       ` Igor Munkin via Tarantool-patches
2022-11-11  8:53 ` [Tarantool-patches] [PATCH 0/2] gdb: adjust to support Python 2 + refactoring of stack dumping Igor Munkin 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=e015ccd7-aa73-f478-d055-d84d491deee6@vk.team \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=elhimov@gmail.com \
    --cc=imun@tarantool.org \
    --cc=m.elhimov@vk.team \
    --subject='Re: [Tarantool-patches] [PATCH 1/2] gdb: adjust to support python2 (centos 7)' \
    /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