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
  2015-06-24  7:34 ` xhpohanka at gmail dot com
  0 siblings, 2 replies; 3+ 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] 3+ 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
  1 sibling, 0 replies; 3+ 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] 3+ 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
  1 sibling, 0 replies; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2015-06-24  7:34 UTC | newest]

Thread overview: 3+ 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

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).