This is the mail archive of the gdb-prs@sources.redhat.com 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]

gdb-MI/720: GDB/MI -var-list-children can cause gdb to coredumps


>Number:         720
>Category:       gdb-MI
>Synopsis:       GDB/MI -var-list-children can cause gdb to coredumps
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 20 19:58:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     alainm@qnx.com
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
When asking the children of an object that was initialized to
null, gdb core dumps.  Example/test attach
>How-To-Repeat:
[mikhailk@node627 types]$ gdb -i mi types
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb)
b main
&"b main\n"
^done
(gdb)
r
&"r\n"
^done,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x08048496",func="main",args=[],file="types.c",line="17"}
(gdb)
print p
&"print p\n"
~"$1 = (astruct *) 0x8048260\n"
^done
(gdb)
n
&"n\n"
^done,reason="end-stepping-range",thread-id="0",frame={addr="0x0804849d",func="main",args=[],file="types.c",line="18"}
(gdb)
p p
&"p p\n"
~"$2 = (astruct *) 0x0\n"
^done
(gdb)
-var-create - * p
^done,name="var1",numchild="3",type="astruct *"
(gdb)
-var-evaluate-expression var1
^done,value="0x0"
(gdb)
-var-list-children var1
&"Cannot access memory at address 0x0\n"
&"Cannot access memory at address 0x4\n"
&"Cannot access memory at address 0x8\n"
^done,numchild="3",children={child={name="var1.x",exp="x",numchild="3",type="astruct"},child={name="var1.y",exp="y",numchild="3",type="astruct"},child={name="var1.z",exp="z",numchild="3",type="astruct"}}
(gdb)
-var-list-children var1.x
&"warning: Child of parent whose type does not allow children\n"
&"warning: Child of parent whose type does not allow children\n"
&"warning: Child of parent whose type does not allow children\n"
Segmentation fault (core dumped)
=============================
#include <stdio.h>

struct a
{
        int x;
        int y;
        int z;
} point;

typedef struct a astruct;

int main()
{
        int i;
        char buffer[10];
        astruct b;
        astruct* p = NULL;
        i = 0;
        strcpy( buffer, "types" );
        b.x = 0;
        b.y = 1;
        printf( "Types\n" );
        return 10;
}

>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]