Convinces GDB to recognize DFP types in casts when no binary with debuginfo for DFP types is loaded. Before: (gdb) p (decimal float) 1 No symbol table is loaded. Use the "file" command. After: (gdb) p (_Decimal32) 1 $1 = 1E-101 Don't worry about the result. It will be fixed in the next patch. This should logically be part of the next patch, but the C parser is scary code and I don't feel very confident that this is indeed the right way to do it. It works, though, and introduces no regressions. I am also not sure of the ChangeLog format for .y files. Ok to commit? -- []'s Thiago Jung Bauermann Software Engineer IBM Linux Technology Center 2007-12-19 Thiago Jung Bauermann * c-exp.y: Add DECFLOAT_KEYWORD, DECDOUBLE_KEYWORD and DECLONG_KEYWORD for Decimal Floating Point types. Add typebase rule for DECFLOAT_KEYWORD, DECDOUBLE_KEYWORD and DECLONG_KEYWORD. (yylex): Recognize _Decimal32, _Decimal64 and _Decimal128 keywords. * gdbtypes.c (gdbtypes_post_init): Change names of decimal float types to conform to C extension for decimal float. Index: src-git/gdb/c-exp.y =================================================================== --- src-git.orig/gdb/c-exp.y 2007-10-26 14:00:29.000000000 -0200 +++ src-git/gdb/c-exp.y 2007-12-14 15:31:04.000000000 -0200 @@ -197,7 +197,7 @@ static int parse_number (char *, int, in /* Special type cases, put in to allow the parser to distinguish different legal basetypes. */ -%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD +%token SIGNED_KEYWORD LONG SHORT INT_KEYWORD CONST_KEYWORD VOLATILE_KEYWORD DOUBLE_KEYWORD DECFLOAT_KEYWORD DECDOUBLE_KEYWORD DECLONG_KEYWORD %token VARIABLE @@ -872,6 +872,12 @@ typebase /* Implements (approximately): { $$ = builtin_type (current_gdbarch)->builtin_double; } | LONG DOUBLE_KEYWORD { $$ = builtin_type (current_gdbarch)->builtin_long_double; } + | DECFLOAT_KEYWORD + { $$ = builtin_type (current_gdbarch)->builtin_decfloat; } + | DECDOUBLE_KEYWORD + { $$ = builtin_type (current_gdbarch)->builtin_decdouble; } + | DECLONG_KEYWORD + { $$ = builtin_type (current_gdbarch)->builtin_declong; } | STRUCT name { $$ = lookup_struct (copy_name ($2), expression_context_block); } @@ -1677,6 +1683,14 @@ yylex () /* Catch specific keywords. Should be done with a data structure. */ switch (namelen) { + case 11: + if (strncmp (tokstart, "_Decimal128", 11) == 0) + return DECLONG_KEYWORD; + case 10: + if (strncmp (tokstart, "_Decimal32", 10) == 0) + return DECFLOAT_KEYWORD; + if (strncmp (tokstart, "_Decimal64", 10) == 0) + return DECDOUBLE_KEYWORD; case 8: if (strncmp (tokstart, "unsigned", 8) == 0) return UNSIGNED; Index: src-git/gdb/gdbtypes.c =================================================================== --- src-git.orig/gdb/gdbtypes.c 2007-12-10 16:10:58.000000000 -0200 +++ src-git/gdb/gdbtypes.c 2007-12-14 15:31:04.000000000 -0200 @@ -3122,15 +3122,15 @@ gdbtypes_post_init (struct gdbarch *gdba builtin_type->builtin_decfloat = init_type (TYPE_CODE_DECFLOAT, 32 / 8, 0, - "decimal float", (struct objfile *) NULL); + "_Decimal32", (struct objfile *) NULL); builtin_type->builtin_decdouble = init_type (TYPE_CODE_DECFLOAT, 64 / 8, 0, - "decimal double", (struct objfile *) NULL); + "_Decimal64", (struct objfile *) NULL); builtin_type->builtin_declong = init_type (TYPE_CODE_DECFLOAT, 128 / 8, 0, - "decimal long double", (struct objfile *) NULL); + "_Decimal128", (struct objfile *) NULL); /* Pointer/Address types. */ -- -- []'s Thiago Jung Bauermann Software Engineer IBM Linux Technology Center