[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gdb and iterators
From: |
Maurizio Loreti |
Subject: |
Re: gdb and iterators |
Date: |
10 May 2004 13:02:44 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
glen_stark <stark@ifh.ee.ethz.ch> writes:
> Hi.
>
> I hope I'm posting in the correct forum. I'm debugging some code
> using iterators, and having trouble getting info on where the iterator
> is pointing to, and what.
>
> i get:
>
> 1: spli = (t_shapePtrListIter &) @0x226b00: {<_List_iterator_base> = {
> _M_node = 0xa042980}, <No data fields>}
>
> When I type "print spli"
>
> and
> Attempt to take contents of a non-pointer value.
>
> for "print *spli". spli should be an list iterator pointing to
> pointer to a Shape (my own class). Can someone tell me what's going
> on?
Simple. Iterators are not pointers; they *may* be implemented as
pointers, but they are not required to be pointers.
> is there a trick to getting iterator info?
This is the tricky part :-) I do not use gdb, but I am surprised that
gdb could not understand how to interpret *spli , since an operator *
must be defined for iterators. Maybe *(spli._M_node)? I am afraid
you should explore how an iterator is defined by your compiler :-(
--
Maurizio Loreti http://www.pd.infn.it/~loreti/mlo.html
Dept. of Physics, Univ. of Padova, Italy ROT13: ybergv@cq.vasa.vg