public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/18149] New: The gdb cannot evaluate a C++ expression generated by the "-var-info-path-expression" for member of class.
@ 2015-03-20 3:06 mihail.nistor at freescale dot com
2020-04-06 18:07 ` [Bug gdb/18149] " ssbssa at sourceware dot org
0 siblings, 1 reply; 2+ messages in thread
From: mihail.nistor at freescale dot com @ 2015-03-20 3:06 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18149
Bug ID: 18149
Summary: The gdb cannot evaluate a C++ expression generated by
the "-var-info-path-expression" for member of class.
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: mihail.nistor at freescale dot com
Created attachment 8199
--> https://sourceware.org/bugzilla/attachment.cgi?id=8199&action=edit
an example, gdb and gcc information
The Eclipse CDT C++ uses the "-var-info-path-expression" command from “mi” to
obtain the expression for a certain variable. After that the expression is
evaluated by using the "-data-evaluate-expression" command from mi and finally
the result will be displayed in the detail panel from Variable/Expression View.
Let's have an example:
class A
{
public:
A():_a(1) {}
private:
int _a;
};
class B: public A
{
public:
B(double b);
private:
double _b;
};
B::B(double b):A()
{
_b = b; // line 23 in test.cpp is here !
}
The reproducible steps are below:
1) The command line to compile the test case
g++ -O0 -g -o test.elf test.cpp
2) Start the gdb
gdb test.elf
3) Set a break-point at line 23 in the test.cpp file
(gdb) b test.cpp:23
4) run
(gdb) run
5) Create a variable for "this" and explore the member of class;
after that try to evaluate the expression obtained
from the "-var-info-path-expression" command
(gdb) interpreter-exec mi "-var-create --thread 1 --frame 0 - * this"
response from gdb == >
^done,name="var1",numchild="2",value="0x7fffffffe860",type="B *
const",thread-id="1",has_more="0"
(gdb) interpreter-exec mi "-var-list-children var1"
response from gdb == >
^done,numchild="2",children=[child={name="var1.A",exp="A",numchild="1",type="A",thread-id="1"},child={name="var1.private",exp="private",numchild="1",thread-id="1"}],has_more="0"
(gdb) interpreter-exec mi "-var-list-children var1.A"
response from gdb == >
^done,numchild="1",children=[child={name="var1.A.private",exp="private",numchild="1",thread-id="1"}],has_more="0"
(gdb) interpreter-exec mi "-var-info-path-expression var1.A"
response from gdb == > ^done,path_expr="(*(class A*) this)"
(gdb) print (*(class A*) this)
response from gdb == > This context has class, union or enum A, not a struct.
(gdb) print (*(struct A*) this)
response from gdb == > This context has class, union or enum A, not a struct.
(gdb) interpreter-exec mi '-data-evaluate-expression --thread 1 --frame 0
"(*(struct A*) this)"'
response from gdb == > ^error,msg="This context has class, union or enum A, not
a struct."
Here you can see the first type of C++ expression that cannot be evaluated!
(gdb) interpreter-exec mi "-var-list-children var1.A.private"
response from gdb == >
^done,numchild="1",children=[child={name="var1.A.private._a",exp="_a",numchild="0",type="int",thread-id="1"}],has_more="0"
(gdb) interpreter-exec mi "-var-list-children var1.A.private._a"
response from gdb == > ^done,numchild="0",has_more="0"
(gdb) interpreter-exec mi "-var-info-path-expression var1.A.private._a"
response from gdb == > ^done,path_expr="(((*(class A*) this))._a)"
(gdb) print (((*(class A*) this))._a)
response from gdb == > This context has class, union or enum A, not a struct.
(gdb) print (((*(struct A*) this))._a)
response from gdb == > This context has class, union or enum A, not a struct.
(gdb) interpreter-exec mi '-data-evaluate-expression --thread 1 --frame 0
"(((*(class A*) this))._a)"'
response from gdb == > ^error,msg="This context has class, union or enum A, not
a struct."
Here you can see the second type of C++ expression that cannot be evaluated!
--
You are receiving this mail because:
You are on the CC list for the bug.
>From gdb-prs-return-17707-listarch-gdb-prs=sources.redhat.com@sourceware.org Fri Mar 20 03:06:43 2015
Return-Path: <gdb-prs-return-17707-listarch-gdb-prs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-prs@sources.redhat.com
Received: (qmail 102709 invoked by alias); 20 Mar 2015 03:06:42 -0000
Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-prs.sourceware.org>
List-Subscribe: <mailto:gdb-prs-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-prs/>
List-Post: <mailto:gdb-prs@sourceware.org>
List-Help: <mailto:gdb-prs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: gdb-prs-owner@sourceware.org
Delivered-To: mailing list gdb-prs@sourceware.org
Received: (qmail 102684 invoked by uid 48); 20 Mar 2015 03:06:41 -0000
From: "dje at google dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/18150] New: Review testsuite results with removal of
expansion of main's symtab
Date: Mon, 23 Mar 2015 04:59:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gdb
X-Bugzilla-Component: symtab
X-Bugzilla-Version: HEAD
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dje at google dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at sourceware dot org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status
bug_severity priority component assigned_to reporter
Message-ID: <bug-18150-4717@http.sourceware.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://sourceware.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-q1/txt/msg00472.txt.bz2
Content-length: 1249
https://sourceware.org/bugzilla/show_bug.cgi?id\x18150
Bug ID: 18150
Summary: Review testsuite results with removal of expansion of
main's symtab
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: symtab
Assignee: unassigned at sourceware dot org
Reporter: dje at google dot com
As a followup to bug 18148, I see several testsuite regressions when I apply
the appended patch. I haven't put any time into root causing them, some
mightn't be bugs at all. But I think it will be a useful exercise.
diff --git a/gdb/symfile.c b/gdb/symfile.c
index ba099d3..96baf21 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1693,7 +1693,7 @@ set_initial_language (void)
{
enum language lang = main_language ();
- if (lang == language_unknown)
+ if (0 && lang == language_unknown)
{
char *name = main_name ();
struct symbol *sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL);
The point of the patch is to stop the expansion of the symtab with main,
which for many tests is the only useful symtab.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug gdb/18149] The gdb cannot evaluate a C++ expression generated by the "-var-info-path-expression" for member of class.
2015-03-20 3:06 [Bug gdb/18149] New: The gdb cannot evaluate a C++ expression generated by the "-var-info-path-expression" for member of class mihail.nistor at freescale dot com
@ 2020-04-06 18:07 ` ssbssa at sourceware dot org
0 siblings, 0 replies; 2+ messages in thread
From: ssbssa at sourceware dot org @ 2020-04-06 18:07 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=18149
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
Resolution|--- |FIXED
Status|NEW |RESOLVED
Target Milestone|--- |7.10
--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
This is fixed since 7.10:
(gdb) interpreter-exec mi '-data-evaluate-expression --thread 1 --frame 0
"(*(struct A*) this)"'
^done,value="{_a = 1}"
(gdb) interpreter-exec mi '-data-evaluate-expression --thread 1 --frame 0
"(((*(class A*) this))._a)"'
^done,value="1"
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-06 18:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-20 3:06 [Bug gdb/18149] New: The gdb cannot evaluate a C++ expression generated by the "-var-info-path-expression" for member of class mihail.nistor at freescale dot com
2020-04-06 18:07 ` [Bug gdb/18149] " ssbssa at sourceware dot org
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).