public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "zaskar_84 at yahoo dot com.ar" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/18905] New: Wrong value displayed when dereferencing list<T>::iterators
Date: Tue, 01 Sep 2015 14:10:00 -0000	[thread overview]
Message-ID: <bug-18905-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2015-09-01 14:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01 14:10 zaskar_84 at yahoo dot com.ar [this message]
2024-01-03 14:08 ` [Bug gdb/18905] " ssbssa at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-18905-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).