public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "xhpohanka at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug mi/18582] New: Cannot inspect vector elements - GDB MI shows Duplicate variable object name error.
Date: Tue, 23 Jun 2015 09:17:00 -0000	[thread overview]
Message-ID: <bug-18582-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2015-06-23  9:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-23  9:17 xhpohanka at gmail dot com [this message]
2022-05-25 18:49 ` [Bug mi/18582] " tromey at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-18582-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).