public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/18584] New: "Duplicate variable object name" using pretty-printing when variable not initialized
@ 2015-06-23 17:28 marc.khouzam at ericsson dot com
2015-06-23 19:10 ` [Bug gdb/18584] " marc.khouzam at ericsson dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: marc.khouzam at ericsson dot com @ 2015-06-23 17:28 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18584
Bug ID: 18584
Summary: "Duplicate variable object name" using pretty-printing
when variable not initialized
Product: gdb
Version: 7.9
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: marc.khouzam at ericsson dot com
Target Milestone: ---
A bug was opened on CDT (http://eclip.se/470761) about GDB reporting "Duplicate
variable object name" when trying to inspect a vector using pretty-printing.
163-var-update 1 var1
163^error,msg="Duplicate variable object name"
What seems to happen is that the variable object is created for a vector that
has not been initialized yet, but after the initialization of the vector, it
seems too late and GDB does not recover when trying to update the variable.
Below is a session to reproduce the problem. Note that the program used needs
to be compiled with -std=c++11:
> gdb.master a.out
GNU gdb (GDB) 7.9.50.20150623-cvs
(gdb) source /home/lmckhou/prettyPrint/gdbinit
(gdb) l
1 #include <vector>
2 #include <memory>
3
4 using namespace std;
5
6 struct Test {
7 int x;
8 int y;
9 };
10
11 int main() {
12 vector<shared_ptr<Test>> v;
13
14 v.push_back(make_shared<Test>());
15 v.push_back(make_shared<Test>());
16
17 auto v2 = v;
18
19 for (size_t i = 0; i < v.size(); i++)
20 v[i]->x = i;
21
22 return 0;
23 }
(gdb) interpreter-exec mi -enable-pretty-printing
^done
(gdb) start
Temporary breakpoint 1 at 0x400ba9: file test.cc, line 12.
Starting program: /home/lmckhou/testing/a.out
Temporary breakpoint 1, main () at test.cc:12
12 vector<shared_ptr<Test>> v;
(gdb) interpreter-exec mi "-var-create - * v2"
^done,name="var1",numchild="0",value="{...}",type="std::vector<std::shared_ptr<Test>,
std::allocator<std::shared_ptr<Test> >
>",thread-id="1",displayhint="array",dynamic="1",has_more="1"
(gdb) interpreter-exec mi "-var-list-children var1"
^error,msg="Cannot access memory at address 0x0"
(gdb) until 22
main () at test.cc:22
22 return 0;
(gdb) interpreter-exec mi "-var-update var1"
^error,msg="Duplicate variable object name
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/18584] "Duplicate variable object name" using pretty-printing when variable not initialized
2015-06-23 17:28 [Bug gdb/18584] New: "Duplicate variable object name" using pretty-printing when variable not initialized marc.khouzam at ericsson dot com
@ 2015-06-23 19:10 ` marc.khouzam at ericsson dot com
2015-06-24 7:34 ` xhpohanka at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: marc.khouzam at ericsson dot com @ 2015-06-23 19:10 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18584
Marc Khouzam <marc.khouzam at ericsson dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simon.marchi at ericsson dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/18584] "Duplicate variable object name" using pretty-printing when variable not initialized
2015-06-23 17:28 [Bug gdb/18584] New: "Duplicate variable object name" using pretty-printing when variable not initialized marc.khouzam at ericsson dot com
2015-06-23 19:10 ` [Bug gdb/18584] " marc.khouzam at ericsson dot com
@ 2015-06-24 7:34 ` xhpohanka at gmail dot com
2025-02-20 14:33 ` tromey at sourceware dot org
2025-10-28 13:57 ` daniel.knezevic at htecgroup dot com
3 siblings, 0 replies; 5+ messages in thread
From: xhpohanka at gmail dot com @ 2015-06-24 7:34 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18584
Jan Pohanka <xhpohanka at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xhpohanka at gmail dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/18584] "Duplicate variable object name" using pretty-printing when variable not initialized
2015-06-23 17:28 [Bug gdb/18584] New: "Duplicate variable object name" using pretty-printing when variable not initialized marc.khouzam at ericsson dot com
2015-06-23 19:10 ` [Bug gdb/18584] " marc.khouzam at ericsson dot com
2015-06-24 7:34 ` xhpohanka at gmail dot com
@ 2025-02-20 14:33 ` tromey at sourceware dot org
2025-10-28 13:57 ` daniel.knezevic at htecgroup dot com
3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2025-02-20 14:33 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18584
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |32726
CC| |tromey at sourceware dot org
Referenced Bugs:
https://sourceware.org/bugzilla/show_bug.cgi?id=32726
[Bug 32726] [meta] Pretty printing
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/18584] "Duplicate variable object name" using pretty-printing when variable not initialized
2015-06-23 17:28 [Bug gdb/18584] New: "Duplicate variable object name" using pretty-printing when variable not initialized marc.khouzam at ericsson dot com
` (2 preceding siblings ...)
2025-02-20 14:33 ` tromey at sourceware dot org
@ 2025-10-28 13:57 ` daniel.knezevic at htecgroup dot com
3 siblings, 0 replies; 5+ messages in thread
From: daniel.knezevic at htecgroup dot com @ 2025-10-28 13:57 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18584
Daniel Knezevic <daniel.knezevic at htecgroup dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.knezevic at htecgroup dot c
| |om
--- Comment #1 from Daniel Knezevic <daniel.knezevic at htecgroup dot com> ---
I tried to reproduce this issue with the latest master with no success. It
seems like this is no longer an issue and the bug can be closed.
Here is the output from the reported program:
GNU gdb (GDB) 18.0.50.20251023-git
Copyright (C) 2025 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...
(gdb) l
6 struct Test {
7 int x;
8 int y;
9 };
10
11 int main() {
12 vector<shared_ptr<Test>> v;
13
14 v.push_back(make_shared<Test>());
15 v.push_back(make_shared<Test>());
(gdb)
16
17 auto v2 = v;
18
19 for (size_t i = 0; i < v.size(); i++)
20 v[i]->x = i;
21
22 return 0;
23 }
(gdb)
❌️ End of the file was already reached, use "list ." to list the current
location again
(gdb) interpreter-exec mi -enable-pretty-printing
^done
(gdb) start
Temporary breakpoint 1 at 0x1296: file test.cpp, line 11.
Starting program: /home/dknezevic/work/duplicateVarName/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Temporary breakpoint 1, main () at test.cpp:11
11 int main() {
(gdb) interpreter-exec mi "-var-create - * v2"
^done,name="var1",numchild="1",value="{...}",type="std::vector<std::shared_ptr<Test>,
std::allocator<std::shared_ptr<Test> > >",thread-id="1",has_more="0"
(gdb) interpreter-exec mi "-var-list-children var1"
^done,numchild="1",children=[child={name="var1.std::_Vector_base<std::shared_ptr<Test>,
std::allocator<std::shared_ptr<Test> >
>",exp="std::_Vector_base<std::shared_ptr<Test>,
std::allocator<std::shared_ptr<Test> >
>",numchild="1",type="std::_Vector_base<std::shared_ptr<Test>,
std::allocator<std::shared_ptr<Test> > >",thread-id="1"}],has_more="0"
(gdb) until 22
main () at test.cpp:22
22 return 0;
(gdb) interpreter-exec mi "-var-update var1"
^done,changelist=[]
(gdb)
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-10-28 13:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23 17:28 [Bug gdb/18584] New: "Duplicate variable object name" using pretty-printing when variable not initialized marc.khouzam at ericsson dot com
2015-06-23 19:10 ` [Bug gdb/18584] " marc.khouzam at ericsson dot com
2015-06-24 7:34 ` xhpohanka at gmail dot com
2025-02-20 14:33 ` tromey at sourceware dot org
2025-10-28 13:57 ` daniel.knezevic at htecgroup dot com
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).