diff options
author | Daniel Jacobowitz <drow@false.org> | 2002-03-21 00:53:44 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2002-03-21 00:53:44 +0000 |
commit | f65ca430eb1613be683a3e6dbcad7a449c80b85c (patch) | |
tree | f4d0e0193971486f2d513f7d04b93c4dc3cc2720 | |
parent | ae5742ba512254333f91dc31fbc3406b0c94b324 (diff) | |
download | gdb-f65ca430eb1613be683a3e6dbcad7a449c80b85c.zip gdb-f65ca430eb1613be683a3e6dbcad7a449c80b85c.tar.gz gdb-f65ca430eb1613be683a3e6dbcad7a449c80b85c.tar.bz2 |
2002-03-20 Daniel Jacobowitz <drow@mvista.com>
Fix PR gdb/422.
* c-lang.c (c_create_fundamental_type): Handle FT_COMPLEX,
FT_DBL_PREC_COMPLEX, and FT_EXT_PREC_COMPLEX.
* dwarf2read.c (read_base_type): Set TYPE_TARGET_TYPE for
complex types.
* stabsread.c (rs6000_builtin_type): Likewise.
(read_sun_floating_type): Likewise.
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/c-lang.c | 24 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 12 | ||||
-rw-r--r-- | gdb/stabsread.c | 14 |
4 files changed, 57 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index acdb2c3..45f050a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2002-03-20 Daniel Jacobowitz <drow@mvista.com> + + Fix PR gdb/422. + * c-lang.c (c_create_fundamental_type): Handle FT_COMPLEX, + FT_DBL_PREC_COMPLEX, and FT_EXT_PREC_COMPLEX. + * dwarf2read.c (read_base_type): Set TYPE_TARGET_TYPE for + complex types. + * stabsread.c (rs6000_builtin_type): Likewise. + (read_sun_floating_type): Likewise. + 2002-03-19 Peter Schauer <pes@regent.e-technik.tu-muenchen.de> * stabsread.c (read_member_functions): Remove skip code for duplicate diff --git a/gdb/c-lang.c b/gdb/c-lang.c index fa977cd..f98548a 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -338,6 +338,30 @@ c_create_fundamental_type (struct objfile *objfile, int typeid) TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, 0, "long double", objfile); break; + case FT_COMPLEX: + type = init_type (TYPE_CODE_FLT, + 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + 0, "complex float", objfile); + TYPE_TARGET_TYPE (type) + = init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + 0, "float", objfile); + break; + case FT_DBL_PREC_COMPLEX: + type = init_type (TYPE_CODE_FLT, + 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + 0, "complex double", objfile); + TYPE_TARGET_TYPE (type) + = init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + 0, "double", objfile); + break; + case FT_EXT_PREC_COMPLEX: + type = init_type (TYPE_CODE_FLT, + 2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + 0, "complex long double", objfile); + TYPE_TARGET_TYPE (type) + = init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT, + 0, "long double", objfile); + break; case FT_TEMPLATE_ARG: type = init_type (TYPE_CODE_TEMPLATE_ARG, 0, diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index e006681..e5450d0 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2979,6 +2979,18 @@ read_base_type (struct die_info *die, struct objfile *objfile) type = init_type (code, size, type_flags, DW_STRING (attr), objfile); if (encoding == DW_ATE_address) TYPE_TARGET_TYPE (type) = dwarf2_fundamental_type (objfile, FT_VOID); + else if (encoding == DW_ATE_complex_float) + { + if (size == 32) + TYPE_TARGET_TYPE (type) + = dwarf2_fundamental_type (objfile, FT_EXT_PREC_FLOAT); + else if (size == 16) + TYPE_TARGET_TYPE (type) + = dwarf2_fundamental_type (objfile, FT_DBL_PREC_FLOAT); + else if (size == 8) + TYPE_TARGET_TYPE (type) + = dwarf2_fundamental_type (objfile, FT_FLOAT); + } } else { diff --git a/gdb/stabsread.c b/gdb/stabsread.c index a06b37f..671d4da 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -2978,10 +2978,14 @@ rs6000_builtin_type (int typenum) case 25: /* Complex type consisting of two IEEE single precision values. */ rettype = init_type (TYPE_CODE_COMPLEX, 8, 0, "complex", NULL); + TYPE_TARGET_TYPE (rettype) = init_type (TYPE_CODE_FLT, 4, 0, "float", + NULL); break; case 26: /* Complex type consisting of two IEEE double precision values. */ rettype = init_type (TYPE_CODE_COMPLEX, 16, 0, "double complex", NULL); + TYPE_TARGET_TYPE (rettype) = init_type (TYPE_CODE_FLT, 8, 0, "double", + NULL); break; case 27: rettype = init_type (TYPE_CODE_INT, 1, 0, "integer*1", NULL); @@ -4491,6 +4495,7 @@ read_sun_floating_type (char **pp, int typenums[2], struct objfile *objfile) int nbits; int details; int nbytes; + struct type *rettype; /* The first number has more details about the type, for example FN_COMPLEX. */ @@ -4505,9 +4510,12 @@ read_sun_floating_type (char **pp, int typenums[2], struct objfile *objfile) if (details == NF_COMPLEX || details == NF_COMPLEX16 || details == NF_COMPLEX32) - /* This is a type we can't handle, but we do know the size. - We also will be able to give it a name. */ - return init_type (TYPE_CODE_COMPLEX, nbytes, 0, NULL, objfile); + { + rettype = init_type (TYPE_CODE_COMPLEX, nbytes, 0, NULL, objfile); + TYPE_TARGET_TYPE (rettype) + = init_type (TYPE_CODE_FLT, nbytes / 2, 0, NULL, objfile); + return rettype; + } return init_type (TYPE_CODE_FLT, nbytes, 0, NULL, objfile); } |