This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: GDB pretty printers for iterators


On 17 March 2010 04:23, Joe Buck wrote:
>> (gdb) p j
>> $1 = 2
>>
>> I think I'd rather have iterators print something like "iterator
>> pointing to 2" or even "-> 2"
>
> Even that is going to be a problem, if for example you're
> debugging code that computes distances between random iterators,
> for example.
>
> (gdb) p *j
> should print 2, but printing the iterator should reveal the internals,
> I think. ?If gdb has special knowledge of the meaning of the interals,
> that can be reported, but if any information is left out, you'll
> hamper debugging.

There's always print/r for the raw output, but I do think the pretty
output needs to find a middle ground between automatic dereferencing
(which falsely implies the iterator is nothing more than the thing it
points to) and printing the impenetrable internals of iterators and
containers.


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