This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to access array elements?




Daniel Jacobowitz wrote:
On Mon, Mar 17, 2003 at 12:02:12PM +0100, Joerg Beyer wrote:

Dear List Reader,

while fiddeling with the gdb-sources, I want to iterate over the
values of an array. I have the "struct value*"-pointer, that is a
TYPE_CODE_ARRAY. How do I get value-pointers to the
entries of the array?


Try value_subscript?

This function is not commented. Is this suggested comment correct?


/* * gdb_value_s returns an array element as value. * val1 is the array * val2 is the index * rval is the result, the array element */

int
gdb_value_subscript (struct value *val1, struct value *val2, struct value **rval)



yours Joerg


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]