public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/18905] New: Wrong value displayed when dereferencing list<T>::iterators
@ 2015-09-01 14:10 zaskar_84 at yahoo dot com.ar
2024-01-03 14:08 ` [Bug gdb/18905] " ssbssa at sourceware dot org
0 siblings, 1 reply; 2+ messages in thread
From: zaskar_84 at yahoo dot com.ar @ 2015-09-01 14:10 UTC (permalink / raw)
To: gdb-prs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug gdb/18905] Wrong value displayed when dereferencing list<T>::iterators
2015-09-01 14:10 [Bug gdb/18905] New: Wrong value displayed when dereferencing list<T>::iterators zaskar_84 at yahoo dot com.ar
@ 2024-01-03 14:08 ` ssbssa at sourceware dot org
0 siblings, 0 replies; 2+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-03 14:08 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18905
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |8.0
CC| |ssbssa at sourceware dot org
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
I can reproduce the problem with gdb-7.8.2:
```
(gdb) p it1
$1 = {_M_node = 0x3577c8}
(gdb) p it2
$2 = {_M_node = 0x3577f0}
(gdb) p *it1
$3 = (int &) @0x3577f8: 2
(gdb) p *it2
$4 = (int &) @0x3577f8: 2
```
But no longer with gdb-8.0 or newer:
```
(gdb) p it1
$1 = {_M_node = 0x5477c8}
(gdb) p it2
$2 = {_M_node = 0x5477f0}
(gdb) p *it1
$3 = (int &) @0x5477d0: 1
(gdb) p *it2
$4 = (int &) @0x5477f8: 2
```
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-03 14:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-01 14:10 [Bug gdb/18905] New: Wrong value displayed when dereferencing list<T>::iterators zaskar_84 at yahoo dot com.ar
2024-01-03 14:08 ` [Bug gdb/18905] " ssbssa at sourceware dot org
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).