public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug mi/16084] New: -var-info-path-expression fails for nested structs
@ 2013-10-25 11:47 m.maghoerndl at bachmann dot info
  2013-10-25 11:52 ` [Bug mi/16084] " m.maghoerndl at bachmann dot info
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: m.maghoerndl at bachmann dot info @ 2013-10-25 11:47 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 16084
           Summary: -var-info-path-expression fails for nested structs
           Product: gdb
           Version: 7.6
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mi
          Assignee: unassigned at sourceware dot org
          Reporter: m.maghoerndl at bachmann dot info

-var-info-path-expression does not take into account the type tag of a nested
struct.

Environment:
GDB 7.6 "--host=i686-pc-mingw32 --target=i386-wrs-vxworks".
No Python

Code to reproduce:
struct
{
    int a;
    struct _B
    {
         int b [4];
     } B;
} A[] = {1, { 2,3,4,5 } };

MI log from a CDT Session:
105,320 44-var-create --thread 3 --frame 0 - * A
105,323 44^done,name="var1",numchild="1",value="[1]",type="struct {...}
[1]",has_more="0"
105,323 (gdb) 
105,324 45-var-create --thread 3 --frame 0 - * &(A)
105,333 45^done,name="var2",numchild="1",value="0x35ff4ec <A>",type="struct
{...} (*)[1]",has_more="\
0"
105,333 (gdb) 
109,995 46-var-create --thread 3 --frame 0 - * A[0]
110,003 46^done,name="var3",numchild="2",value="{...}",type="struct
{...}",has_more="0"
110,003 (gdb) 
112,040 47-var-list-children var3
112,069
47^done,numchild="2",children=[child={name="var3.a",exp="a",numchild="0",type="int"},child={\
name="var3.B",exp="B",numchild="1",type="struct _B"}],has_more="0"
112,082 (gdb) 
112,083 48-var-info-path-expression var3.a
112,083 49-var-info-path-expression var3.B
112,084 48^done,path_expr="(A[0]).a"
112,084 (gdb) 
112,084 49^done,path_expr="(A[0]).B"
112,084 (gdb) 
112,087 50-var-evaluate-expression var3.a
112,094 50^done,value="1"
112,094 (gdb) 
113,344 51-var-list-children var3.B
113,354
51^done,numchild="1",children=[child={name="var3.B.b",exp="b",numchild="4",type="char
[4]"}]\
,has_more="0"
113,354 (gdb) 
113,355 52-var-info-path-expression var3.B.b
113,364 52^done,path_expr="(A[0]).b"
113,364 (gdb) 
113,368 53-var-create --thread 3 --frame 0 - * &((A[0]).b)
113,374 53^error,msg="Type struct {...} has no component named b."
113,374 (gdb) 


Expected Behaviour:
-var-info-path-expression var3.B.b should return the following(full path):
52^done,path_expr="((A[0]).B).b"

The following Patch fixes that behaviour, but I don't know what it might cause
for sideefects:

Index: varobj.c
===================================================================
--- varobj.c    (revision 43031)
+++ varobj.c    (working copy)
@@ -1385,7 +1385,7 @@
   /* Anonymous unions and structs are also not path_expr parents.  */
   return !((TYPE_CODE (type) == TYPE_CODE_STRUCT
         || TYPE_CODE (type) == TYPE_CODE_UNION)
-       && TYPE_NAME (type) == NULL);
+       && TYPE_NAME (type) == NULL && TYPE_TAG_NAME (type) == NULL);
 }

 /* Return the path expression parent for VAR.  */

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-31 19:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-25 11:47 [Bug mi/16084] New: -var-info-path-expression fails for nested structs m.maghoerndl at bachmann dot info
2013-10-25 11:52 ` [Bug mi/16084] " m.maghoerndl at bachmann dot info
2014-07-16 17:52 ` marc.khouzam at ericsson dot com
2014-10-31 19:13 ` marc.khouzam at ericsson 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).