Re: Variable objects and STL containers

Vladimir Prus
2008-02-05T06:56:56Z

Nick Roberts wrote:

> > > 2) _M_impl, _M_start are gcc internals and I guess they could change (like
> > > CLI!) Is it meaningful to ask on the gcc list for a formal interface
> > > to these details?
> >
> > Technically, there is formal interface, called iterators, provided by the
> > C++ standard. I don't have the slightest confidence in gdb not falling over
> > if you try to use them, though.
>
> Are iterators available to GDB, or just the executable? I only seem able to
> access those methods which are used by my program, e.g.,
>
> (gdb) p v.size ()
> $3 = 3
>
> but
>
> (gdb) p v.rbegin ()
> Cannot evaluate function -- may be inlined

Well, that what I mean by 'falling over', in part ;-) I would not
be suprised if attempt to increment an iterator, using the overloaded
operator++, also will fail.

> > We discussed using Python scripting for that; in fact, I have a patch locally
> > that will make
> >
> > -var-evaluate-expression V
> >
> > for a vector print something like:
> >
> > [1,2,3]
>
> Does this work for programs compiled by any compiler, or just gcc?

For each different STL implementation, you'd need different Python code
to render vector.

- Volodya