public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Alexander Smundak <asmundak@google.com>
Cc: Tom Tromey <tromey@redhat.com>, gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Add Frame.read_register to Python API
Date: Thu, 24 Jul 2014 17:45:00 -0000	[thread overview]
Message-ID: <CADPb22TXqVUnkJheMt6byCChS8G=La+=pFZdAa=7HjDKUvcoug@mail.gmail.com> (raw)
In-Reply-To: <CAHQ51u5nGtgAT_h=CZ=U1jkeHbq==_iZH_YAXThJA9utcPk70g@mail.gmail.com>

On Mon, Jul 14, 2014 at 9:13 AM, Alexander Smundak <asmundak@google.com> wrote:
> Ping.
> It has been a month since I have responded to the reviewer's comments.
> Perhaps someone can take a look at this patch?
>
> On Mon, Jul 7, 2014 at 1:59 PM, Alexander Smundak <asmundak@google.com> wrote:
>> Ping.
>>
>> On Mon, Jun 30, 2014 at 9:22 AM, Alexander Smundak <asmundak@google.com> wrote:
>>> Ping
>>>
>>> On Mon, Jun 23, 2014 at 3:46 PM, Alexander Smundak <asmundak@google.com> wrote:
>>>> Ping
>>>>
>>>> On Wed, Jun 18, 2014 at 10:18 AM, Alexander Smundak <asmundak@google.com> wrote:
>>>>> Ping.
>>>>>
>>>>> On Wed, Jun 11, 2014 at 4:52 PM, Alexander Smundak <asmundak@google.com> wrote:
>>>>>>> Alexander>      def __init__(self, fobj):
>>>>>>> Alexander>          super(InlinedFrameDecorator, self).__init__(fobj)
>>>>>>> Alexander> +        self.fobj = fobj
>>>>>>>
>>>>>>> Alexander>      def function(self):
>>>>>>> Alexander> -        frame = fobj.inferior_frame()
>>>>>>> Alexander> +        frame = self.fobj.inferior_frame()
>>>>>>> Alexander>          name = str(frame.name())
>>>>>>>
>>>>>>> I think this is a nice fix but it seems unrelated to the patch at hand.
>>>>>>>
>>>>>>> Alexander>  @defun Frame.find_sal ()
>>>>>>> Alexander> -Return the frame's symtab and line object.
>>>>>>> Alexander> +Return the frame's @code{gdb.Symtab_and_line} object.
>>>>>>>
>>>>>>> Likewise.
>>>>>>
>>>>>> Should I mail these two as a single patch or as two separate patches?
>>>>>>
>>>>>>> Alexander> +      FRAPY_REQUIRE_VALID (self, frame);
>>>>>>> Alexander> +      if (!PyArg_ParseTuple (args, "i", &regnum))
>>>>>>> Alexander> +    {
>>>>>>> Alexander> +      const char *regnum_str;
>>>>>>> Alexander> +      PyErr_Clear();  /* Clear PyArg_ParseTuple failure above.  */
>>>>>>> Alexander> +      if (PyArg_ParseTuple (args, "s", &regnum_str))
>>>>>>> Alexander> +        {
>>>>>>> Alexander> +          regnum = user_reg_map_name_to_regnum (get_frame_arch (frame),
>>>>>>> Alexander> +                                                regnum_str,
>>>>>>> Alexander> +                                                strlen (regnum_str));
>>>>>>> Alexander> +        }
>>>>>>> Alexander> +    }
>>>>>>>
>>>>>>> I tend to think this would be clearer if the arguments were only parsed
>>>>>>> once and then explicit type checks were applied to the resulting object.
>>>>>>
>>>>>> Did that, and then started doubting whether it is really necessary to read
>>>>>> a register by its (very arch-specific) number. The new version supports
>>>>>> reading the register by the name. Another change is that it now throws
>>>>>> an exception if the name is wrong.
>>>>>>
>>>>>>> Alexander> +# On x86-64, PC is register 16.
>>>>>>> Alexander> +gdb_test "python print ('result = %s' % ((f0.architecture().name() != 'i386:x86-64') or f0.read_register('pc') == f0.read_register(16)))" \
>>>>>>> Alexander> +  "True" \
>>>>>>> Alexander> +  "test Frame.read_register(regnum)"
>>>>>>>
>>>>>>> A test that is arch-specific needs to be conditionalized somehow.
>>>>>> IMHO it's borderline arch-specific -- it is runnable on any platform,
>>>>>> although it will not be testing much on any but x86-64. There hasn't
>>>>>> been any arch-specific tests for Python so far, so I am not sure what to do.
>>>>>>
>>>>>> Here's the new version (style violations have been addressed, too):
>>>>>>
>>>>>> The ability to read registers is needed to use Frame Filter API to
>>>>>> display the frames created by JIT compilers.
>>>>>>
>>>>>> gdb/Changelog
>>>>>> 2014-06-11  Sasha Smundak  <asmundak@google.com>
>>>>>>
>>>>>> * python/py-frame.c (frapy_read_register): New function.
>>>>>>
>>>>>> 2014-06-11  Sasha Smundak  <asmundak@google.com>
>>>>>>
>>>>>> * python.texi (Frames in Python): Add read_register description.
>>>>>>
>>>>>> 2014-06-11  Sasha Smundak  <asmundak@google.com>
>>>>>>
>>>>>> * gdb.python/py-frame.exp: Test Frame.read_register.

Hi.

For myself, I don't like to step in once another reviewer has engaged the patch.
[Not that I won't.  Only that I don't want to usurp someone else's
review - it's hard to make sure one has sufficiently covered
everything the other reviewer raised as issues.]

Eli, I realize the doc parts are ok.  Thanks!

Tom: Anything else that needs to be done?

  reply	other threads:[~2014-07-24 16:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09 19:15 Alexander Smundak
2014-06-09 19:26 ` Eli Zaretskii
2014-06-09 21:16   ` Alexander Smundak
2014-06-11 19:11     ` Tom Tromey
2014-06-11 23:52       ` Alexander Smundak
2014-06-18 17:18         ` Alexander Smundak
2014-06-18 17:33           ` Eli Zaretskii
2014-06-23 22:46           ` Alexander Smundak
2014-06-30 16:22             ` Alexander Smundak
2014-07-07 20:59               ` Alexander Smundak
2014-07-14 16:24                 ` Alexander Smundak
2014-07-24 17:45                   ` Doug Evans [this message]
2014-07-31 18:53                     ` Doug Evans
2014-07-31 20:05                       ` Tom Tromey
2014-08-21 18:44         ` Doug Evans
2014-08-26 20:31           ` Alexander Smundak
2014-08-29 13:39             ` Doug Evans
2014-08-29 23:32               ` Sasha Smundak
2014-08-29 23:36                 ` Doug Evans
2014-09-03 23:46                   ` Doug Evans

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='CADPb22TXqVUnkJheMt6byCChS8G=La+=pFZdAa=7HjDKUvcoug@mail.gmail.com' \
    --to=dje@google.com \
    --cc=asmundak@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).