public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <derodat@adacore.com>
To: David Malcolm <dmalcolm@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/2] Introduce Python testcases to check DWARF output
Date: Thu, 27 Jul 2017 08:59:00 -0000	[thread overview]
Message-ID: <4b1b35ea-533c-8ea9-c49b-ec508242ef8f@adacore.com> (raw)
In-Reply-To: <1501088996.10760.78.camel@redhat.com>

On 07/26/2017 07:09 PM, David Malcolm wrote:
>> +    If `single_cu` is True, make sure there is exactly one
>> compilation unit and
> 
> "is True" -> "is true"

Fixed.

>> +        :param bool or_error: When True, if `single` is True and no
>> attribute
> 
> "True" -> "true" in two places

Fixed.

>> +        :param None|(DIE) -> bool predicate: If provided, function
>> that filters
>> +            out DIEs when it returns False.

You did not suggested, but I replaced “False” with “false” to be 
consistent. ;-)

>> +        :param bool single: If True, look for a single DIE and raise
>> a
> 
> "True" -> "true", I suppose

Fixed.

>> +        If left to None, the match succeded. Otherwise, must be set
> 
> 
> "succeded" -> "succeeded"

Fixed.

>> +        This is valid iff the match succeded.
> 
> here again.

Likewise.

>> +    In Python 2, just return the input. In Python 3, decode the
>> input as ASCII.
>> +    """
>> +    return (str_or_byte if sys.version_info.major < 3 else
>> +            str_or_byte.decode('ascii'))
> 
> Aha!  Python 2 and Python 3.
> 
> 
> Presumably this all runs with LANG=C so that there's no danger of any
> non-ASCII bytes?  (bytes.decode('ascii' will raise a UnicodeDecodeError
> if any byte >=128).

I’m not sure about the interaction with the locale. What I thought was: 
I’ve never seen non-ASCII strings in DWARF, nor in objdump’s output. I 
know it’s theorically possible: if that happens in the future (like some 
language allows non-ASCII identifier and yield non-ASCII names in 
DWARF), we’ll only have this function to fix.

> There's a fair amount of non-trivial parsing going on here.
> I wonder if it would be helpful to add a "unittest" suite for the
> parsing?
> (e.g. to have some precanned fragments of objdump output as strings,
> and to verify that they're parsed as expected).
> 
> Note that I'm not a reviewer for the testsuite, so this is just a
> suggestion.

That’s a good idea. Actually I think it will be very easy to write such 
tests *and* to assess Python code coverage for them. I’ll do this if 
this proposal is in good way to be accepted.

> Hope this is constructive

It totally was: thank you very much!

-- 
Pierre-Marie de Rodat

  reply	other threads:[~2017-07-27  8:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26 16:01 [PATCH 0/2] " Pierre-Marie de Rodat
2017-07-26 16:01 ` [PATCH 2/2] Introduce " Pierre-Marie de Rodat
2017-07-26 17:10   ` David Malcolm
2017-07-27  8:59     ` Pierre-Marie de Rodat [this message]
2017-07-27  8:36   ` Richard Biener
2017-07-27 10:09     ` Pierre-Marie de Rodat
2017-07-26 16:01 ` [PATCH 1/2] Introduce testsuite support to run Python tests Pierre-Marie de Rodat
2017-07-26 16:25   ` David Malcolm
2017-07-26 16:35     ` Pierre-Marie de Rodat
2017-07-26 16:48       ` David Malcolm
2017-07-27  8:49         ` Pierre-Marie de Rodat
2017-07-27 13:40           ` David Malcolm
2017-08-02 18:43         ` Jeff Law
2017-08-03  8:27           ` Pierre-Marie de Rodat
2017-07-27  8:50   ` Matthias Klose
2017-07-27 10:09     ` Pierre-Marie de Rodat
2017-07-26 16:16 ` [PATCH 0/2] Python testcases to check DWARF output David Malcolm
2017-07-26 16:26   ` Pierre-Marie de Rodat
2017-07-26 21:25 ` Mike Stump
2017-07-27  7:52   ` Richard Biener
2017-07-27  9:09     ` Pierre-Marie de Rodat
2017-08-03 22:23       ` Mike Stump
2017-08-06 14:35         ` Iain Buclaw
2017-08-02 15:44     ` Jeff Law
2017-08-02 15:43 ` Jeff Law
2017-08-03  8:27   ` Pierre-Marie de Rodat
2017-08-03 16:13     ` Jeff Law

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=4b1b35ea-533c-8ea9-c49b-ec508242ef8f@adacore.com \
    --to=derodat@adacore.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).