Two apparent C++ bugs concerning Containers Library objects: vectors, deques etc. - Codelite & NetBeans affected
Robin Whittle <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
I have spent the last few days characterizing two apparent problems with gdb's MI behavior regarding C++ Containers Library objects. https://sourceware.org/bugzilla/show_bug.cgi?id=18623 MI -var-update problems with vector of vectors https://sourceware.org/bugzilla/show_bug.cgi?id=18627 MI -var-list-children on not-yet-created vector crashes gdb and/or provides invalid list of children and their values These both have example programs and detailed instructions on recreating the problem in a command line session of gdb. The first problem prevents me from using gdb under Codelite for any program using vectors of vectors and the like. The second prevents me from using gdb under NetBeans for any program containing even a vector or deque of ints. I discovered the problems with gdb 7.7.1 and they are still present in the recent trunk snapshot (2015-07-02) on which I based the above problem reports. The first problem also occurred for me and Codelite's developer under Windows - and he was using gdb 7.8.1. I guess that these problems are confusing lots of people, who generally don't have the patience to narrow down the cause to gdb specifically. It is difficult to drill down to this level with certainty, since a programer might suspect trouble could be in the IDE's code or configuration or how they have lashed the IDE, libstdc++, compiler, printers.py etc. together. In the first case, gdb can pretty print vectors of vectors etc. just fine, unless particular commands are used - and then there is a distinctive pattern of correct results for elements 1 and 2 of the outer vector, null results for element 0, and an unrecoverable error for all other elements: c-varobj.c:893: internal-error: cplus_describe_child: Assertion `access' failed. In the second case, gdb is perfectly capable of pretty printing these objects once they are created. So in both cases I think I have printers.py working correctly - it is the one which matches the libstdc++. Hopefully an experienced gdb developer will be able to fix these, or advise what might be wrong with my setup. I am not game to get into the gdb code itself - and even if I did succeed in finding the fault, I would not be confident that my fix would not upset something else. Thanks for gdb, gcc and libstdc++! - Robin