This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/18584] New: "Duplicate variable object name" using pretty-printing when variable not initialized
- From: "marc.khouzam at ericsson dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Tue, 23 Jun 2015 17:28:14 +0000
- Subject: [Bug gdb/18584] New: "Duplicate variable object name" using pretty-printing when variable not initialized
- Auto-submitted: auto-generated
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.