This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch 0/2] New 'explore' command
- From: Siva Chandra <sivachandra at google dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 7 Mar 2012 16:58:17 +0530
- Subject: [patch 0/2] New 'explore' command
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