* [rfa/arm] Fix some structs.exp failures
@ 2004-03-02 17:17 Daniel Jacobowitz
2004-03-03 17:29 ` Richard Earnshaw
2004-03-19 0:09 ` Daniel Jacobowitz
0 siblings, 2 replies; 10+ messages in thread
From: Daniel Jacobowitz @ 2004-03-02 17:17 UTC (permalink / raw)
To: gdb-patches; +Cc: rearnsha
structs.exp uses "typedef float tf". A structure type that would otherwise
be returned by reference is returned by value, because GDB doesn't realize
that it counts as a floating-point-like structure.
OK?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2004-03-02 Daniel Jacobowitz <drow@mvista.com>
* arm-tdep.c (arm_use_struct_convention): Look through typedefs.
Index: gdb/arm-tdep.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/gdb/arm-tdep.c,v
retrieving revision 1.164
diff -u -p -r1.164 arm-tdep.c
--- gdb/arm-tdep.c 16 Feb 2004 21:49:21 -0000 1.164
+++ gdb/arm-tdep.c 2 Mar 2004 17:11:25 -0000
@@ -2141,6 +2142,8 @@ arm_use_struct_convention (int gcc_p, st
int nRc;
enum type_code code;
+ CHECK_TYPEDEF (type);
+
/* In the ARM ABI, "integer" like aggregate types are returned in
registers. For an aggregate type to be integer like, its size
must be less than or equal to DEPRECATED_REGISTER_SIZE and the
@@ -2198,7 +2201,7 @@ arm_use_struct_convention (int gcc_p, st
for (i = 0; i < TYPE_NFIELDS (type); i++)
{
enum type_code field_type_code;
- field_type_code = TYPE_CODE (TYPE_FIELD_TYPE (type, i));
+ field_type_code = TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, i)));
/* Is it a floating point type field? */
if (field_type_code == TYPE_CODE_FLT)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/arm] Fix some structs.exp failures
2004-03-02 17:17 [rfa/arm] Fix some structs.exp failures Daniel Jacobowitz
@ 2004-03-03 17:29 ` Richard Earnshaw
2004-03-03 21:35 ` Mark Kettenis
` (2 more replies)
2004-03-19 0:09 ` Daniel Jacobowitz
1 sibling, 3 replies; 10+ messages in thread
From: Richard Earnshaw @ 2004-03-03 17:29 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches, rearnsha
> structs.exp uses "typedef float tf". A structure type that would otherwise
> be returned by reference is returned by value, because GDB doesn't realize
> that it counts as a floating-point-like structure.
>
> OK?
>
> --
> Daniel Jacobowitz
> MontaVista Software Debian GNU/Linux Developer
>
> 2004-03-02 Daniel Jacobowitz <drow@mvista.com>
>
> * arm-tdep.c (arm_use_struct_convention): Look through typedefs.
I think this is OK, but it's hard to be sure: check_typedef is completely
undocumented -- no mention in the internals documentation, and not even a
comment in gdbtypes.[ch].
R.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/arm] Fix some structs.exp failures
2004-03-03 17:29 ` Richard Earnshaw
@ 2004-03-03 21:35 ` Mark Kettenis
2004-03-04 9:58 ` Richard Earnshaw
2004-03-19 0:09 ` Mark Kettenis
2004-03-09 17:11 ` Daniel Jacobowitz
2004-03-19 0:09 ` Richard Earnshaw
2 siblings, 2 replies; 10+ messages in thread
From: Mark Kettenis @ 2004-03-03 21:35 UTC (permalink / raw)
To: rearnsha; +Cc: drow, gdb-patches, rearnsha
Date: Wed, 03 Mar 2004 17:29:44 +0000
From: Richard Earnshaw <rearnsha@arm.com>
> structs.exp uses "typedef float tf". A structure type that would
> otherwise be returned by reference is returned by value, because
> GDB doesn't realize that it counts as a floating-point-like
> structure.
>
> OK?
>
> --
> Daniel Jacobowitz
> MontaVista Software Debian GNU/Linux Developer
>
> 2004-03-02 Daniel Jacobowitz <drow@mvista.com>
>
> * arm-tdep.c (arm_use_struct_convention): Look through typedefs.
I think this is OK, but it's hard to be sure: check_typedef is completely
undocumented -- no mention in the internals documentation, and not even a
comment in gdbtypes.[ch].
There is one comment about check_typedef()/CHECK_TYPEDEF() in
gdbtypes.h. Anyway, Daniels fix is OK. Before you look at a type the
way arm_use_struct_convention does, you should have called
check_typedef(), otherwise you'll look at the typedef itself, and not
its underlying type.
Mark
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/arm] Fix some structs.exp failures
2004-03-03 21:35 ` Mark Kettenis
@ 2004-03-04 9:58 ` Richard Earnshaw
2004-03-19 0:09 ` Richard Earnshaw
2004-03-19 0:09 ` Mark Kettenis
1 sibling, 1 reply; 10+ messages in thread
From: Richard Earnshaw @ 2004-03-04 9:58 UTC (permalink / raw)
To: Mark Kettenis; +Cc: rearnsha, drow, gdb-patches
> check_typedef is completely
> undocumented -- no mention in the internals documentation, and not even a
> comment in gdbtypes.[ch].
>
> There is one comment about check_typedef()/CHECK_TYPEDEF() in
> gdbtypes.h. Anyway, Daniels fix is OK. Before you look at a type the
> way arm_use_struct_convention does, you should have called
> check_typedef(), otherwise you'll look at the typedef itself, and not
> its underlying type.
>
I guess if you call a comment on an (apparently) unrelated macro 400 lines
earlier in the file documentation then I was wrong. However, that still
begs a load of questions:
What are the input parameters?
What is returned?
What is it safe to pass?
Can it be called more than once?
Does it operate recursively?
Does it change the input parameter, or is a new object created?
Some of these may be obvious from analysing the source, but that shouldn't
really be necessary.
R.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/arm] Fix some structs.exp failures
2004-03-03 17:29 ` Richard Earnshaw
2004-03-03 21:35 ` Mark Kettenis
@ 2004-03-09 17:11 ` Daniel Jacobowitz
2004-03-19 0:09 ` Daniel Jacobowitz
2004-03-19 0:09 ` Richard Earnshaw
2 siblings, 1 reply; 10+ messages in thread
From: Daniel Jacobowitz @ 2004-03-09 17:11 UTC (permalink / raw)
To: gdb-patches
On Wed, Mar 03, 2004 at 05:29:44PM +0000, Richard Earnshaw wrote:
> > structs.exp uses "typedef float tf". A structure type that would otherwise
> > be returned by reference is returned by value, because GDB doesn't realize
> > that it counts as a floating-point-like structure.
> >
> > OK?
> >
> > --
> > Daniel Jacobowitz
> > MontaVista Software Debian GNU/Linux Developer
> >
> > 2004-03-02 Daniel Jacobowitz <drow@mvista.com>
> >
> > * arm-tdep.c (arm_use_struct_convention): Look through typedefs.
>
> I think this is OK, but it's hard to be sure: check_typedef is completely
> undocumented -- no mention in the internals documentation, and not even a
> comment in gdbtypes.[ch].
I can take a hint :) Here's what I checked in.
Note that there actually is a comment right above check_typedef. It's
not very clear, though, and another little function has gotten in the
way.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2004-03-09 Daniel Jacobowitz <drow@mvista.com>
* arm-tdep.c (arm_use_struct_convention): Look through typedefs.
* gdbtypes.c (check_typedef): Update comments.
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.81
diff -u -p -r1.81 gdbtypes.c
--- gdbtypes.c 15 Feb 2004 15:22:06 -0000 1.81
+++ gdbtypes.c 9 Mar 2004 17:06:06 -0000
@@ -1343,6 +1343,12 @@ get_destructor_fn_field (struct type *t,
return 0;
}
+static void
+stub_noname_complaint (void)
+{
+ complaint (&symfile_complaints, "stub type has NULL name");
+}
+
/* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989.
If this is a stubbed struct (i.e. declared as struct foo *), see if
@@ -1356,11 +1362,10 @@ get_destructor_fn_field (struct type *t,
This used to be coded as a macro, but I don't think it is called
often enough to merit such treatment. */
-static void
-stub_noname_complaint (void)
-{
- complaint (&symfile_complaints, "stub type has NULL name");
-}
+/* Find the real type of TYPE. This function returns the real type, after
+ removing all layers of typedefs and completing opaque or stub types.
+ Completion changes the TYPE argument, but stripping of typedefs does
+ not. */
struct type *
check_typedef (struct type *type)
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.166
diff -u -p -r1.166 arm-tdep.c
--- arm-tdep.c 9 Mar 2004 15:44:26 -0000 1.166
+++ arm-tdep.c 9 Mar 2004 17:06:07 -0000
@@ -2173,6 +2173,8 @@ arm_use_struct_convention (int gcc_p, st
int nRc;
enum type_code code;
+ CHECK_TYPEDEF (type);
+
/* In the ARM ABI, "integer" like aggregate types are returned in
registers. For an aggregate type to be integer like, its size
must be less than or equal to DEPRECATED_REGISTER_SIZE and the
@@ -2230,7 +2232,7 @@ arm_use_struct_convention (int gcc_p, st
for (i = 0; i < TYPE_NFIELDS (type); i++)
{
enum type_code field_type_code;
- field_type_code = TYPE_CODE (TYPE_FIELD_TYPE (type, i));
+ field_type_code = TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, i)));
/* Is it a floating point type field? */
if (field_type_code == TYPE_CODE_FLT)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/arm] Fix some structs.exp failures
2004-03-03 21:35 ` Mark Kettenis
2004-03-04 9:58 ` Richard Earnshaw
@ 2004-03-19 0:09 ` Mark Kettenis
1 sibling, 0 replies; 10+ messages in thread
From: Mark Kettenis @ 2004-03-19 0:09 UTC (permalink / raw)
To: rearnsha; +Cc: drow, gdb-patches, rearnsha
Date: Wed, 03 Mar 2004 17:29:44 +0000
From: Richard Earnshaw <rearnsha@arm.com>
> structs.exp uses "typedef float tf". A structure type that would
> otherwise be returned by reference is returned by value, because
> GDB doesn't realize that it counts as a floating-point-like
> structure.
>
> OK?
>
> --
> Daniel Jacobowitz
> MontaVista Software Debian GNU/Linux Developer
>
> 2004-03-02 Daniel Jacobowitz <drow@mvista.com>
>
> * arm-tdep.c (arm_use_struct_convention): Look through typedefs.
I think this is OK, but it's hard to be sure: check_typedef is completely
undocumented -- no mention in the internals documentation, and not even a
comment in gdbtypes.[ch].
There is one comment about check_typedef()/CHECK_TYPEDEF() in
gdbtypes.h. Anyway, Daniels fix is OK. Before you look at a type the
way arm_use_struct_convention does, you should have called
check_typedef(), otherwise you'll look at the typedef itself, and not
its underlying type.
Mark
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/arm] Fix some structs.exp failures
2004-03-04 9:58 ` Richard Earnshaw
@ 2004-03-19 0:09 ` Richard Earnshaw
0 siblings, 0 replies; 10+ messages in thread
From: Richard Earnshaw @ 2004-03-19 0:09 UTC (permalink / raw)
To: Mark Kettenis; +Cc: rearnsha, drow, gdb-patches
> check_typedef is completely
> undocumented -- no mention in the internals documentation, and not even a
> comment in gdbtypes.[ch].
>
> There is one comment about check_typedef()/CHECK_TYPEDEF() in
> gdbtypes.h. Anyway, Daniels fix is OK. Before you look at a type the
> way arm_use_struct_convention does, you should have called
> check_typedef(), otherwise you'll look at the typedef itself, and not
> its underlying type.
>
I guess if you call a comment on an (apparently) unrelated macro 400 lines
earlier in the file documentation then I was wrong. However, that still
begs a load of questions:
What are the input parameters?
What is returned?
What is it safe to pass?
Can it be called more than once?
Does it operate recursively?
Does it change the input parameter, or is a new object created?
Some of these may be obvious from analysing the source, but that shouldn't
really be necessary.
R.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/arm] Fix some structs.exp failures
2004-03-09 17:11 ` Daniel Jacobowitz
@ 2004-03-19 0:09 ` Daniel Jacobowitz
0 siblings, 0 replies; 10+ messages in thread
From: Daniel Jacobowitz @ 2004-03-19 0:09 UTC (permalink / raw)
To: gdb-patches
On Wed, Mar 03, 2004 at 05:29:44PM +0000, Richard Earnshaw wrote:
> > structs.exp uses "typedef float tf". A structure type that would otherwise
> > be returned by reference is returned by value, because GDB doesn't realize
> > that it counts as a floating-point-like structure.
> >
> > OK?
> >
> > --
> > Daniel Jacobowitz
> > MontaVista Software Debian GNU/Linux Developer
> >
> > 2004-03-02 Daniel Jacobowitz <drow@mvista.com>
> >
> > * arm-tdep.c (arm_use_struct_convention): Look through typedefs.
>
> I think this is OK, but it's hard to be sure: check_typedef is completely
> undocumented -- no mention in the internals documentation, and not even a
> comment in gdbtypes.[ch].
I can take a hint :) Here's what I checked in.
Note that there actually is a comment right above check_typedef. It's
not very clear, though, and another little function has gotten in the
way.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2004-03-09 Daniel Jacobowitz <drow@mvista.com>
* arm-tdep.c (arm_use_struct_convention): Look through typedefs.
* gdbtypes.c (check_typedef): Update comments.
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.81
diff -u -p -r1.81 gdbtypes.c
--- gdbtypes.c 15 Feb 2004 15:22:06 -0000 1.81
+++ gdbtypes.c 9 Mar 2004 17:06:06 -0000
@@ -1343,6 +1343,12 @@ get_destructor_fn_field (struct type *t,
return 0;
}
+static void
+stub_noname_complaint (void)
+{
+ complaint (&symfile_complaints, "stub type has NULL name");
+}
+
/* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989.
If this is a stubbed struct (i.e. declared as struct foo *), see if
@@ -1356,11 +1362,10 @@ get_destructor_fn_field (struct type *t,
This used to be coded as a macro, but I don't think it is called
often enough to merit such treatment. */
-static void
-stub_noname_complaint (void)
-{
- complaint (&symfile_complaints, "stub type has NULL name");
-}
+/* Find the real type of TYPE. This function returns the real type, after
+ removing all layers of typedefs and completing opaque or stub types.
+ Completion changes the TYPE argument, but stripping of typedefs does
+ not. */
struct type *
check_typedef (struct type *type)
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.166
diff -u -p -r1.166 arm-tdep.c
--- arm-tdep.c 9 Mar 2004 15:44:26 -0000 1.166
+++ arm-tdep.c 9 Mar 2004 17:06:07 -0000
@@ -2173,6 +2173,8 @@ arm_use_struct_convention (int gcc_p, st
int nRc;
enum type_code code;
+ CHECK_TYPEDEF (type);
+
/* In the ARM ABI, "integer" like aggregate types are returned in
registers. For an aggregate type to be integer like, its size
must be less than or equal to DEPRECATED_REGISTER_SIZE and the
@@ -2230,7 +2232,7 @@ arm_use_struct_convention (int gcc_p, st
for (i = 0; i < TYPE_NFIELDS (type); i++)
{
enum type_code field_type_code;
- field_type_code = TYPE_CODE (TYPE_FIELD_TYPE (type, i));
+ field_type_code = TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, i)));
/* Is it a floating point type field? */
if (field_type_code == TYPE_CODE_FLT)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/arm] Fix some structs.exp failures
2004-03-03 17:29 ` Richard Earnshaw
2004-03-03 21:35 ` Mark Kettenis
2004-03-09 17:11 ` Daniel Jacobowitz
@ 2004-03-19 0:09 ` Richard Earnshaw
2 siblings, 0 replies; 10+ messages in thread
From: Richard Earnshaw @ 2004-03-19 0:09 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches, rearnsha
> structs.exp uses "typedef float tf". A structure type that would otherwise
> be returned by reference is returned by value, because GDB doesn't realize
> that it counts as a floating-point-like structure.
>
> OK?
>
> --
> Daniel Jacobowitz
> MontaVista Software Debian GNU/Linux Developer
>
> 2004-03-02 Daniel Jacobowitz <drow@mvista.com>
>
> * arm-tdep.c (arm_use_struct_convention): Look through typedefs.
I think this is OK, but it's hard to be sure: check_typedef is completely
undocumented -- no mention in the internals documentation, and not even a
comment in gdbtypes.[ch].
R.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [rfa/arm] Fix some structs.exp failures
2004-03-02 17:17 [rfa/arm] Fix some structs.exp failures Daniel Jacobowitz
2004-03-03 17:29 ` Richard Earnshaw
@ 2004-03-19 0:09 ` Daniel Jacobowitz
1 sibling, 0 replies; 10+ messages in thread
From: Daniel Jacobowitz @ 2004-03-19 0:09 UTC (permalink / raw)
To: gdb-patches; +Cc: rearnsha
structs.exp uses "typedef float tf". A structure type that would otherwise
be returned by reference is returned by value, because GDB doesn't realize
that it counts as a floating-point-like structure.
OK?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2004-03-02 Daniel Jacobowitz <drow@mvista.com>
* arm-tdep.c (arm_use_struct_convention): Look through typedefs.
Index: gdb/arm-tdep.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/gdb/arm-tdep.c,v
retrieving revision 1.164
diff -u -p -r1.164 arm-tdep.c
--- gdb/arm-tdep.c 16 Feb 2004 21:49:21 -0000 1.164
+++ gdb/arm-tdep.c 2 Mar 2004 17:11:25 -0000
@@ -2141,6 +2142,8 @@ arm_use_struct_convention (int gcc_p, st
int nRc;
enum type_code code;
+ CHECK_TYPEDEF (type);
+
/* In the ARM ABI, "integer" like aggregate types are returned in
registers. For an aggregate type to be integer like, its size
must be less than or equal to DEPRECATED_REGISTER_SIZE and the
@@ -2198,7 +2201,7 @@ arm_use_struct_convention (int gcc_p, st
for (i = 0; i < TYPE_NFIELDS (type); i++)
{
enum type_code field_type_code;
- field_type_code = TYPE_CODE (TYPE_FIELD_TYPE (type, i));
+ field_type_code = TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, i)));
/* Is it a floating point type field? */
if (field_type_code == TYPE_CODE_FLT)
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-03-09 17:11 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-02 17:17 [rfa/arm] Fix some structs.exp failures Daniel Jacobowitz
2004-03-03 17:29 ` Richard Earnshaw
2004-03-03 21:35 ` Mark Kettenis
2004-03-04 9:58 ` Richard Earnshaw
2004-03-19 0:09 ` Richard Earnshaw
2004-03-19 0:09 ` Mark Kettenis
2004-03-09 17:11 ` Daniel Jacobowitz
2004-03-19 0:09 ` Daniel Jacobowitz
2004-03-19 0:09 ` Richard Earnshaw
2004-03-19 0:09 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox