public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: Chris Moller <cmoller@redhat.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [patch] pr10659  	pretty-printing: Display vectors of vectors as matrix
Date: Thu, 27 May 2010 21:14:00 -0000	[thread overview]
Message-ID: <4BFEDE1E.2080008@redhat.com> (raw)
In-Reply-To: <4BFEA148.7000409@redhat.com>

On 05/27/2010 05:43 PM, Chris Moller wrote:
> This patch adds the mechanism for gdb to respond to "matrix" hints from
> printers.py.  (Just to exercise the testcase, the patch includes a
> patched version of printers.py to src/gdb/testsuite/gdb.python.  It can
> be removed once the patched printers.py is generally available.)

This is not an official review, I just have some questions.

> @@ -397,7 +397,7 @@
> 		struct ui_file *stream, int recurse,
>  		const struct value_print_options *options,
>  		const struct language_defn *language,
> -		int is_py_none)
> +		int is_py_none, int is_matrix)
>  {

I'm not sure why it is necessary to pass the hint in here.  All of the
other hints are parsed internally within the function?


> -         if (is_py_none)
> -           fputs_filtered ("{", stream);
> -         else
> -           fputs_filtered (" = {", stream);
> +	  if (is_matrix && recurse == 0)
> +	    print_spaces_filtered (2 + 2 * recurse, stream);
> +	  if (is_py_none)
> +	    {
> +	      if (is_matrix && strcmp (hint, "array"))
> +		{

I looked at this, and I'm not sure what this means.  Either a hint is
a matrix or an array? Is this trying to deal with children?  I looked
at the modified vector printer and it can return either "array" or
"matrix" depending on the template argument.  


> +gdb_breakpoint [gdb_get_line_number "break"]
> +gdb_continue_to_breakpoint "break"
> +
> +gdb_test "p test1" "vector of length 2, capacity 2 =.*"
> +gdb_test "p test2" "= $nl  {$nl    {.*"
> +gdb_test "p test3" "= $nl  {$nl    {$nl      {.*"
> +

I cannot deduce from this test what the actual content of a vector
printed with the matrix hint should look like beyond the expected
bracket structure.

To be really picky, I'd at least like to see an example of the output
in comments or a more comprehensive test.  I've really gotten into
the idea that tests should also serve as an example of usage somehow.


> Index: testsuite/gdb.python/printers.py
> ===================================================================
> RCS file: testsuite/gdb.python/printers.py
> diff -N testsuite/gdb.python/printers.py

This file cannot exist in the GDB testsuite. It is already hosted
in GCC. You should post any changes to the vector printer there.  
For your testcase, I would write the test so it does not rely on this
file.

Cheers,

Phil

  reply	other threads:[~2010-05-27 21:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 17:46 Chris Moller
2010-05-27 21:14 ` Phil Muldoon [this message]
2010-05-27 22:25   ` Chris Moller
2010-05-27 21:20 ` Tom Tromey
2010-05-31 23:21   ` [patch] pr10659 pretty-printing: Display vectors of vectors as matrix--rev 2 Chris Moller
2010-06-02 22:58     ` Tom Tromey
2010-06-30 12:26     ` Jan Kratochvil

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=4BFEDE1E.2080008@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=cmoller@redhat.com \
    --cc=gdb-patches@sourceware.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).