* FW: Segfault in varobj.c
@ 2007-07-27 17:53 Robert Norton
2007-07-28 20:57 ` Nick Roberts
0 siblings, 1 reply; 3+ messages in thread
From: Robert Norton @ 2007-07-27 17:53 UTC (permalink / raw)
To: gdb
> ----Original Message-----
> From: Daniel Jacobowitz [mailto:drow@false.org]
> Sent: 27 July 2007 15:25
> To: Robert Norton
> Subject: Re: Segfault in varobj.c
>
> On Fri, Jul 27, 2007 at 07:20:50AM -0700, Robert Norton wrote:
> > Ah. Thanks. There doesn't seem to be any equivalent
> function in the 6.6
> > version. Can you remember how this would have been handled then?
>
> Badly, I'm afraid. Vladimir and Nick did a lot of work cleaning this
> stuff up after 6.6.
OK, thanks.
The below was supposed to go the mailing list but I think my question is
largely answered. Here it is for the record:
> No, that won't happen any more. See get_value_type.
Ah. Thanks. There doesn't seem to be any equivalent function in the 6.6
version. Can you remember how this would have been handled then?
Appreciate that you're probably not interested in dredging up the past.
I tried variations on the following code but still wasn't able to
reproduce in 6.6 so there must be something more to my test binary:
typedef int * INT_PTR;
struct test_struct {
INT_PTR x;
};
struct test_struct test;
int main(void) {
int x = 1;
test.x = &x;
return *test.x;
}
rnorton@x-cbga-09:rnorton> gdb --interpreter=mi gdbtestfp
...
^done,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x00
000140",func="main",args=[],file="gdbtest.c",line="10"}
(gdb)
-var-create - * test
^done,name="var1",numchild="1",type="struct test_struct"
(gdb)
-var-list-children test
&"Variable object not found\n"
^error,msg="Variable object not found"
(gdb)
-var-list-children var1
^done,numchild="1",children={child={name="var1.x",exp="x",numchild="1",t
ype="INT_PTR"}}
(gdb)
-var-list-children var1.x
^done,numchild="1",children={child={name="var1.x.*x",exp="*x",numchild="
0",type="int"}}
(gdb)
-var-list-children var1.x.*x
^done,numchild="0"
(gdb)
Suppose I'll just have to go with a workaround until such time as we can
upgrade.
Thanks,
Robert
> --
> Daniel Jacobowitz
> CodeSourcery
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: FW: Segfault in varobj.c
2007-07-27 17:53 FW: Segfault in varobj.c Robert Norton
@ 2007-07-28 20:57 ` Nick Roberts
2007-07-30 11:43 ` Robert Norton
0 siblings, 1 reply; 3+ messages in thread
From: Nick Roberts @ 2007-07-28 20:57 UTC (permalink / raw)
To: Robert Norton; +Cc: gdb
> > No, that won't happen any more. See get_value_type.
>
> Ah. Thanks. There doesn't seem to be any equivalent function in the 6.6
> version. Can you remember how this would have been handled then?
> Appreciate that you're probably not interested in dredging up the past.
> I tried variations on the following code but still wasn't able to
> reproduce in 6.6 so there must be something more to my test binary:
Your example crashes with GDB 6.6 for me in the way you first reported.
> typedef int * INT_PTR;
>
> struct test_struct {
> INT_PTR x;
> };
>
> struct test_struct test;
>
> int main(void) {
> int x = 1;
> test.x = &x;
> return *test.x;
> }
>
> rnorton@x-cbga-09:rnorton> gdb --interpreter=mi gdbtestfp
> ...
> ^done,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x00
> 000140",func="main",args=[],file="gdbtest.c",line="10"}
> (gdb)
> -var-create - * test
> ^done,name="var1",numchild="1",type="struct test_struct"
> (gdb)
> -var-list-children test
> &"Variable object not found\n"
> ^error,msg="Variable object not found"
> (gdb)
> -var-list-children var1
> ^done,numchild="1",children={child={name="var1.x",exp="x",numchild="1",t
> ype="INT_PTR"}}
> (gdb)
> -var-list-children var1.x
> ^done,numchild="1",children={child={name="var1.x.*x",exp="*x",numchild="
> 0",type="int"}}
> (gdb)
> -var-list-children var1.x.*x
> ^done,numchild="0"
> (gdb)
>
> Suppose I'll just have to go with a workaround until such time as we can
> upgrade.
Yes. It appears to be fixed in current CVS but isn't handled by GDB 6.6.
--
Nick http://www.inet.net.nz/~nickrob
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: FW: Segfault in varobj.c
2007-07-28 20:57 ` Nick Roberts
@ 2007-07-30 11:43 ` Robert Norton
0 siblings, 0 replies; 3+ messages in thread
From: Robert Norton @ 2007-07-30 11:43 UTC (permalink / raw)
To: Nick Roberts; +Cc: gdb
> -----Original Message-----
> From: Nick Roberts [mailto:nickrob@snap.net.nz]
> Sent: 28 July 2007 02:41
> To: Robert Norton
> Cc: gdb@sourceware.org
> Subject: Re: FW: Segfault in varobj.c
>
> Your example crashes with GDB 6.6 for me in the way you first
> reported.
Interesting! I think I needed an array of teststructs in the end.
Another one for the test suite?
> > Suppose I'll just have to go with a workaround until such
> time as we can
> > upgrade.
>
> Yes. It appears to be fixed in current CVS but isn't handled
> by GDB 6.6.
OK. I managed to avoid the segfault by backporting get_value_type and
changing the line
switch (TYPE_CODE (parent->type))
In c_type_of_child to
switch (TYPE_CODE (get_value_type(parent)))
This is still not right since the pointer fields which previously caused
a crash can now be expanded twice in eclipse. It seems gdb gets the type
of the child of the pointer wrong (it thinks it is still a pointer) and
allows it to be expanded again, but at least it doesn't crash!
Thanks for your assistance,
Robert
> --
> Nick
> http://www.inet.net.nz/~nickrob
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-30 9:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-27 17:53 FW: Segfault in varobj.c Robert Norton
2007-07-28 20:57 ` Nick Roberts
2007-07-30 11:43 ` Robert Norton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox