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]

exp/2037: -var-create on typedef'ed array fails


>Number:         2037
>Category:       exp
>Synopsis:       -var-create on typedef'ed array fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 28 06:48:01 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     rabanerjee@nvidia.com
>Release:        6.3
>Organization:
>Environment:
CPU: P4 HT (Dual-Core)
linux kernel: 2.4.20-8 (RedHat 9)
gdb built with gcc: version 3.2.2 20030222
>Description:
Doing a -var-create on a typedef'ed array results in an error message from gdb.

This failure seems to be resulting from gdb thinking the typedef'ed array to be an illegal (non-pointer) expression.

Of course, as with all illegal expressions, this failure is accompanied by the null-pointer bug (#1873), which causes gdb to seg fault later, when attempting to print the individual elements of the array.
>How-To-Repeat:
Source Code to repro bug:
-------------------------
typedef int Matrix[4];
typedef float Vector[4];
int main()
{
int t1[4];
Matrix t2;
float f1[4];
Vector f2;
return 0;
}


launching gdb:
--------------
gdb ./gdbc


gdb instructions to repro bug:
------------------------------
(gdb) b 9
Breakpoint 1 at 0x8048304: file gdbc.cpp, line 9.
(gdb) r
Starting program: /.../.../gdbc
                                                                                                                                                             
Breakpoint 1, main () at gdbc.cpp:9
9       return 0;
(gdb) interpret mi -var-create' - * *((t1))@4
^done,name="var1",numchild="4",type="int [4]"
(gdb)
(gdb) interpret mi -var-create' - * *((t2))@4
&"Attempt to take contents of a non-pointer value.\n"
^done,name="var2",numchild="4",type="int [4]"
(gdb)
(gdb) interpret mi -var-create' - * *((f1))@4
^done,name="var3",numchild="4",type="float [4]"
(gdb)
(gdb) interpret mi -var-create' - * *((f2))@4
&"Attempt to take contents of a non-pointer value.\n"
^done,name="var4",numchild="4",type="float [4]"
(gdb)
(gdb) interpret mi -var-list-children' var1
^done,numchild="4",children=[child={name="var1.0",exp="0",numchild="0",type="int"},child={name="var1.1",exp="1",numchild="0",type="int"},child={name="var1.2",exp="2",numchild="0",type="int"},child={name="var1.3",exp="3",numchild="0",type="int"}]
(gdb)
(gdb) interpret mi -var-list-children' var2
Segmentation fault
^^^^^^^^^^^^^^^^^^

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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