public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Robert Lupton the Good <rhl@astro.princeton.edu>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb@sourceware.org
Subject: Re: Option parsing in gdb python
Date: Tue, 25 Oct 2011 02:58:00 -0000	[thread overview]
Message-ID: <755BDB90-D687-4CA4-86B6-EF1A02E7F2EE@astro.princeton.edu> (raw)
In-Reply-To: <20111024212805.GP335@adacore.com>

> The part that I don't get at the moment is how this is all going to be useful in general. Can you give some example of how you want to use this class?

Oh, sorry.  I have an image class, and I want to support
	show image img
but I also want to specify the format width, the part of the image to show, etc.  So

	show image -a img		# print it all
	show image -o 10 20 img 5 5	# print the 5x5 subimage starting at (10, 20)
	show image -o 10 20 -c img 5 5	# print the 5x5 subimage centred at (10, 20)
	show image -f 4 -a img		# print it all, using a field width of 4 chars

That last one looks like:
> (gdb) show image -f 4 -a idImage
>      0 1 2 3 4 5 6 7 8 9 10 11 
> 7    0x0 0x0 0x0 0x3 0x0 0x0 0x0 0x0 0x2 0x2 0x0 0x0 
> 6    0x0 0x0 0x3 0x3 0x3 0x0 0x0 0x2 0x2 0x2 0x2 0x0 
> 5    0x0 0x0 0x0 0x3 0x0 0x0 0x2 0x2 0x2 0x2 0x2 0x2 
> 4    0x0 0x0 0x0 0x0 0x1 0x0 0x0 0x2 0x2 0x0 0x2 0x0 
> 3    0x0 0x0 0x0 0x1 0x1 0x1 0x0 0x0 0x0 0x0 0x0 0x0 
> 2    0x0 0x0 0x1 0x1 0x1 0x1 0x1 0x0 0x0 0x0 0x0 0x0 
> 1    0x0 0x0 0x0 0x1 0x1 0x1 0x0 0x0 0x0 0x0 0x0 0x0 
> 0    0x0 0x0 0x0 0x0 0x1 0x0 0x0 0x0 0x0 0x0 0x0 0x0 

I also have similar needs for eigen::Matrix, and ...

So I call GdbArgumentParse in the invoke method of a subclass of gdb.Command.

					R

  reply	other threads:[~2011-10-24 21:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1319403653.11425.ezmlm@sourceware.org>
2011-10-24 21:28 ` Robert Lupton the Good
2011-10-24 21:35   ` Joel Brobecker
2011-10-25  2:58     ` Robert Lupton the Good [this message]
2011-10-27 17:01     ` Tom Tromey
2011-10-27 19:32   ` Tom Tromey
2011-10-22  1:22 Robert Lupton the Good
2011-10-23 21:00 ` Paul_Koning

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=755BDB90-D687-4CA4-86B6-EF1A02E7F2EE@astro.princeton.edu \
    --to=rhl@astro.princeton.edu \
    --cc=brobecker@adacore.com \
    --cc=gdb@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).