This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug mi/18582] New: Cannot inspect vector elements - GDB MI shows Duplicate variable object name error.


https://sourceware.org/bugzilla/show_bug.cgi?id=18582

            Bug ID: 18582
           Summary: Cannot inspect vector elements - GDB MI shows
                    Duplicate variable object name error.
           Product: gdb
           Version: 7.9
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mi
          Assignee: unassigned at sourceware dot org
          Reporter: xhpohanka at gmail dot com
  Target Milestone: ---

I'm not sure whether it is problem of Eclipse CDT or GDB, but following code
causes problems to debugger. Using CDT 8.6 and gdb 7.9.1 on Archlinux I cannot
inspect elements of both vectors v and v2.

#include <vector>

using namespace std;

struct Test {
    int x;
    int y;
};

int main() {
        vector<shared_ptr<Test>> v;

        v.push_back(make_shared<Test>());
        v.push_back(make_shared<Test>());

        auto v2 = v;

        for (size_t i = 0; i < v.size(); i++)
            v[i]->x = i;

        return 0;
}

I was not able to isolate single line or declaration that causes problems, it
appear in many variants of such code.
Gdb traces follows...


223,700 73-stack-list-locals --thread 1 --frame 0 1
223,703 73^done,locals=[{name="i",value="4196992"},{name="v",value="std::vector
of length 2, capacit\
y 2 = {std::shared_ptr (count 2, weak 0) 0x616c30, std::shared_ptr (count 2,
weak 0) 0x616c70}"},{na\
me="v2",value="std::vector of length 2, capacity 2 = {std::shared_ptr (count 2,
weak 0) 0x616c30, st\
d::shared_ptr (count 2, weak 0) 0x616c70}"}]
223,703 (gdb) 
223,706 74-stack-info-depth --thread 1 11
223,706 74^done,depth="1"
223,707 (gdb) 
223,756 75-stack-info-depth --thread 1
223,757 75^done,depth="1"
223,757 (gdb) 
223,757 76-var-create --thread 1 --frame 0 - * i
223,758 77-var-update 1 var1
223,758 78-var-update 1 var2
223,758
76^done,name="var3",numchild="0",value="4196992",type="size_t",thread-id="1",has_more="0"
223,758 (gdb) 
223,768 77^error,msg="Duplicate variable object name"
223,768 (gdb) 
223,772 79-thread-info 1
223,772 80-list-thread-groups
223,778 78^error,msg="Duplicate variable object name"
223,778 (gdb) 
223,778 79^done,threads=[{id="1",target-id="process
28990",name="test",frame={level="0",addr="0x0000\
000000400d0c",func="main",args=[],file="../src/test.cpp",fullname="/home/work/dev/work_test/test/src\
/test.cpp",line="20"},state="stopped",core="2"}]
223,778 (gdb) 
223,778
80^done,groups=[{id="i1",type="process",pid="28990",executable="/home/work/dev/work_test/tes\
t/Debug/test",cores=["2"]}]
223,779 (gdb) 
223,779 81-var-list-children var2 0 1
223,779 81^error,msg="Duplicate variable object name"
223,779 (gdb)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]