Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Vrany <jan.vrany@fit.cvut.cz>
To: Simon Marchi <simark@simark.ca>,
	gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH v2 3/5] Create MI commands using python.
Date: Tue, 28 May 2019 20:35:00 -0000	[thread overview]
Message-ID: <eaac252dbc7ff2d38c2281eb80627e0e602547ae.camel@fit.cvut.cz> (raw)
In-Reply-To: <128d0fc3-4364-0cab-f03d-45ed7d3eda32@simark.ca>

Hi,

thanks a lot! I agree with most of comments and fixed 
them already in upcoming v3 patch. 

For the rest, sae below. 

> > > +    {
> > > +      /* Since PyList_SetItem steals the reference, we don't use
> > > +       * gdbpy_ref<> to hold on arg string. */
> > > +      PyObject *str = PyUnicode_Decode (parse->argv[i], strlen (parse->argv[i]),
> > > +                                     host_charset (), NULL);
> > > +      if (PyList_SetItem (argobj.get (), i, str) != 0)
> > 
> > Just wondering, because I know that unicode handling is very different between
> > Python 2 and 3: did you test with both Python versions?
> > 

No. I will do that before sending v3. 

> > > +  gdbpy_ref<> result (
> > > +    PyObject_CallMethodObjArgs (obj, invoke_cst, argobj.get (), NULL));
> > > +  if (PyErr_Occurred () != NULL)
> > > +    {
> > > +      gdbpy_err_fetch ex;
> > > +      gdb::unique_xmalloc_ptr<char> ex_msg (ex.to_string ());
> > > +
> > > +      if (ex_msg == NULL || *ex_msg == '\0')
> > > +     error (_("-%s: failed to execute command"), name ().c_str ());
> > > +      else
> > > +     error (_("-%s: %s"), name ().c_str (), ex_msg.get ());
> > > +    }
> > > +  else if (result != nullptr)
> > > +    {
> > > +      if (Py_None != result)
> > > +     parse_mi_result (result.get (), "result");
> > > +    }
> > > +  else
> > > +    {
> > > +      error (
> > > +     _("-%s: command invoke() method returned NULL but no python exception "
> > > +       "is set"),
> > > +     name ().c_str ());
> > 
> > I am curious, did you actually hit this case, where no Python exception was
> > raised and invoke returned NULL?  I thought the two were pretty coupled
> > (if return value is NULL, it means there's an exception raise and vice versa).
> > 

Yes, it looks like. I guess I took this code from Didier. I removed the else
branch in v3. 

> > > +  void invoke (struct mi_parse *parse) override;
> > 
> > This should be private, like in the previous patch.
> > 

Ah, this is "bigger" problem, we should override 
do_invoke() which is declared protected in superclass. Again,fixed in v3. 

Thanks a lot!

Jan


  reply	other threads:[~2019-05-28 20:35 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18 15:23 [RFC 0/8] " Jan Vrany
2019-04-18 15:23 ` [RFC 1/8] Use std::map for MI commands in mi-cmds.c Jan Vrany
2019-04-25 19:13   ` Tom Tromey
2019-04-25 19:15   ` Tom Tromey
2019-04-25 19:34     ` Jan Vrany
2019-05-03 22:40   ` Simon Marchi
2019-05-03 22:45     ` Simon Marchi
2019-04-18 15:24 ` [RFC 4/8] mi/python: C++ify python MI command handling code Jan Vrany
2019-04-25 19:43   ` Tom Tromey
2019-04-18 15:24 ` [RFC 8/8] mi/python: Allow redefinition of python MI commands Jan Vrany
2019-04-25 19:50   ` Tom Tromey
2019-05-03 15:26     ` Jan Vrany
2019-05-06 21:40       ` Tom Tromey
2019-05-07 11:26         ` Jan Vrany
2019-05-07 13:09           ` Simon Marchi
2019-05-07 13:19             ` Jan Vrany
2019-05-08  0:10               ` Simon Marchi
2019-05-08 18:00                 ` Tom Tromey
2019-04-18 15:24 ` [RFC 3/8] Create MI commands using python Jan Vrany
2019-04-25 19:42   ` Tom Tromey
2019-04-18 15:24 ` [RFC 7/8] mi/python: Add tests for python-defined MI commands Jan Vrany
2019-04-25 19:48   ` Tom Tromey
2019-04-18 15:24 ` [RFC 6/8] mi/python: Handle python exception when executiong " Jan Vrany
2019-04-25 19:46   ` Tom Tromey
2019-04-26 10:19     ` Jan Vrany
2019-04-18 15:24 ` [RFC 2/8] Use classes to represent MI Command instead of structures Jan Vrany
2019-04-25 19:25   ` Tom Tromey
2019-05-03 22:49     ` Simon Marchi
2019-05-03 22:57       ` Simon Marchi
2019-04-18 16:03 ` [RFC 0/8] Create MI commands using python Simon Marchi
2019-04-20  7:20   ` Jan Vrany
2019-04-18 16:12 ` [RFC 5/8] mi/python: Polish MI output of python commands Jan Vrany
2019-04-25 19:50   ` Tom Tromey
2019-04-25 18:03 ` [RFC 0/8] Create MI commands using python Tom Tromey
2019-04-25 19:00   ` Simon Marchi
2019-04-25 19:01     ` Simon Marchi
2019-05-14 11:24 ` [PATCH v2 3/5] " Jan Vrany
2019-05-17  4:29   ` Simon Marchi
2019-05-28 20:35     ` Jan Vrany [this message]
2019-05-14 11:24 ` [PATCH v2 1/5] Use std::map for MI commands in mi-cmds.c Jan Vrany
2019-05-14 11:24 ` [PATCH v2 2/5] Use classes to represent MI Command instead of structures Jan Vrany
2019-05-17  3:12   ` Simon Marchi
2019-05-14 11:24 ` [PATCH v2 0/5] Create MI commands using python Jan Vrany
2019-05-14 11:24 ` [PATCH v2 5/5] mi/python: Add tests for python-defined MI commands Jan Vrany
2019-05-14 11:57 ` [PATCH v2 4/5] mi/python: Allow redefinition of python " Jan Vrany

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=eaac252dbc7ff2d38c2281eb80627e0e602547ae.camel@fit.cvut.cz \
    --to=jan.vrany@fit.cvut.cz \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /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