This is the mail archive of the gdb-prs@sourceware.org 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]

[Bug gdb/18905] New: Wrong value displayed when dereferencing list<T>::iterators


https://sourceware.org/bugzilla/show_bug.cgi?id=18905

            Bug ID: 18905
           Summary: Wrong value displayed when dereferencing
                    list<T>::iterators
           Product: gdb
           Version: 7.10
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: zaskar_84 at yahoo dot com.ar
  Target Milestone: ---

When trying to inspect two different list's iterators in a Windows system, I
see the same value for both even if the are not pointing to the same element.
Here's an example:

        #include <iostream>
        #include <list>
        int main() {
                std::list<int> l = {1,2,3};
                std::list<int>::iterator it1 = l.begin();
                std::list<int>::iterator it2 = ++l.begin();
                asm("int3"); // breakpoint here
                std::cout << *it1 << *it2 << std::endl; 
        }

If you run this with gdb and then type "p it1" and "p it2" in the pause, you
will see that the two iterators' pointers are different, but if you type "p
*it1" and "p *it2" you will see the same value for both. This is wrong, you can
continue resume to see it.

The example is compiled with mingw32-g++ and the arguments "-static-libstdc++
-static-libgcc -g -pedantic-errors -O0 -std=c++11". I've seen this error in
gdb-7.8.1, and tested with gdb 7.9 and recent 7.10, and it still happens. I've
compiled these versions myself with the same g++ version and msys, just with
"configure" and "make", no special settings. Note that I only see this error in
Windows, but it works ok in GNU/Linux for the same gdb versions (as provided by
Slackware 14 and current).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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