Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Siva Chandra <sivachandra@google.com>
To: gdb-patches@sourceware.org
Subject: [patch 0/2] New 'explore' command
Date: Wed, 07 Mar 2012 11:28:00 -0000	[thread overview]
Message-ID: <CAGyQ6gwrkh_OVr_KTuc5Ne=y5GvZVpiQbeYjuGKT=amEY_OuLg@mail.gmail.com> (raw)

Hi all,

I had, in a different thread, sent different patches for a new
'explore' command implemented in C as well as in Python using the GDB
Python API (see for ref
http://sourceware.org/ml/gdb-patches/2012-02/msg00099.html). There
were a couple of comments about preferring a Python implementation
over a C implementation. However, I have preferred a C implementation
for two reasons: 1. I want this to be available to all GDB builds and
not limited to those built with Python enabled, 2. I could not find a
way to get the 'target' type of a C++ reference value using the Python
API. I am probably missing something here.

Whatever the case, if the community prefers a Python implementation,
then so be it. I will be sending both implementations as different
patches (with docs) in this series. I apologize if this amounts to
being spam!

To help recollect, sample runs of the 'explore' command are as follows:

Example of value exploration:
========================
(gdb) explore cs
The value of 'cs' is of type 'struct ComplexStruct' with the following fields:
  s = <Enter 0 to explore this field of type 'struct SimpleStruct'>
  u = <Enter 1 to explore this field of type 'union SimpleUnion'>
 sa = <Enter 2 to explore this field of type 'SS [10]'>

Enter the field number of choice: 2
'cs.sa' is an array of elements of type 'SS'.
Enter the index you want to explore in 'cs.sa': 1
The value of '(cs.sa)[1]' is of type 'SS' which is a typedef of type
'struct SimpleStruct'.
The value of '(cs.sa)[1]' is of type 'struct SimpleStruct' with the
following fields:
 a = 1 .. (Value of type 'int')
 d = 11.1 .. (Value of type 'double')

Press enter to return to parent value:

Returning to parent value...

'cs.sa' is an array of elements of type 'SS'.
Enter the index you want to explore in 'cs.sa':
Returning to parent value...
The value of 'cs' is of type 'struct ComplexStruct' with the following fields:
  s = <Enter 0 to explore this field of type 'struct SimpleStruct'>
  u = <Enter 1 to explore this field of type 'union SimpleUnion'>
 sa = <Enter 2 to explore this field of type 'SS [10]'>

Enter the field number of choice:
(gdb)

Example of type exploration:
========================
(gdb) explore struct SimpleStruct
'struct SimpleStruct' has the following fields:
 a = <Enter 0 to explore this field of type 'int'>
 d = <Enter 1 to explore this field of type 'double'>

Enter the field number of choice: 1
field 'd' of 'struct SimpleStruct' is of a scalar type 'double'.
Press enter to return to enclosing type:

Returning to parent type...
'struct SimpleStruct' has the following fields:
 a = <Enter 0 to explore this field of type 'int'>
 d = <Enter 1 to explore this field of type 'double'>

Enter the field number of choice:
(gdb)

Thanks,
Siva Chandra


             reply	other threads:[~2012-03-07 11:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07 11:28 Siva Chandra [this message]
2012-03-07 16:24 ` Joel Brobecker
2012-03-07 18:47   ` Siva Chandra

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='CAGyQ6gwrkh_OVr_KTuc5Ne=y5GvZVpiQbeYjuGKT=amEY_OuLg@mail.gmail.com' \
    --to=sivachandra@google.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