From e58de8a23021ce9bbdee715ac79745ebb93437a8 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Sun, 15 Nov 1992 17:28:02 +0000 Subject: * Makefile.in (SFILES_MAINDIR): Add ch-exp.y. * Makefile.in (YYFILES): Add ch-exp.tab.c. * Makefile.in (YYOBJ): Add ch-exp.tab.o. * Makefile.in (saber_gdb): Add unload of ch-exp.y and load of ch-exp.tab.c. * Makefile.in (distclean): Add target ch-exp.tab.c. * Makefile.in (realclean): Add rm of ch-exp.tab.c. * Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on Makefile since it contains sed patterns used in generation. Add sed pattern to also delete #include of any malloc.h. * Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets. * ch-exp.y: New expression parser, for GNU-Chill. * c-exp.y, expr.c, expression.h, language.c, m2-exp.y, parser-defs.h, valarith.c, valops.c, value.h: Remap macros and function names to conform to K&R terminology with respect to logical and bitwise operators: UNOP_ZEROP => UNOP_LOGICAL_NOT UNOP_LOGNOT => UNOP_COMPLEMENT BINOP_LOGAND => BINOP_BITWISE_AND BINOP_LOGXOR => BINOP_BITWISE_XOR BINOP_LOGIOR => BINOP_BITWISE_IOR BINOP_AND => BINOP_LOGICAL_AND BINOP_OR => BINOP_LOGICAL_OR PREC_OR => PREC_LOGICAL_OR PREC_AND => PREC_LOGICAL_AND PREC_LOGIOR => PREC_BITWISE_IOR PREC_LOGXOR => PREC_BITWISE_XOR PREC_LOGAND => PREC_BITWISE_AND value_zerop() => value_logical_not() value_lognot() => value_complement() * c-exp.y (c_op_print_tab): Add explicit empty terminator. * m2-exp.y (m2_op_print_tab): Add explicit empty terminator. * defs.h (enum language): Add language_chill. * dwarfread.c (set_cu_language): Add LANG_CHILL case and make LANG_MODULA2 a recognized language. * eval.c (evaluate_subexp): Add OP_BOOL case. * expprint.c (print_subexp): Add OP_BOOL case. * gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for Chill as well as Modula-2. * gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long, builtin_type_chill_ulong, builtin_type_chill_real): Add. * i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary and is nonexistant in some SVR4 based systems. * language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4. * language.c (set_language_command): Add chill. * language.c (binop_result_type, integral_type, character_type, boolean_type, structured_type, value_true, binop_type_check): Add language_chill cases. * language.h (_LANG_chill): Define. * m2-exp.y (number_sign, modblock): Make static, #ifdef out unused modblock. * m2-exp.y (ANDAND): Rename to LOGICAL_AND. * source.c (source_info): Fix minor nits, print "1 line" rather than "1 lines", and "language is ". * symfile.c (deduce_language_from_filename): Recognize the filename extensions ".chill", ".c186", and ".c286" for Chill. * valarith.c (value_binop): Handle TYPE_CODE_BOOL as well as TYPE_CODE_INT and TYPE_CODE_FLOAT. * valprint.c (val_print): Print TYPE_CODE_BOOL type values as "TRUE" or "FALSE". * valprint.c (typedef_print): Add case for language_chill. * values.c (value_from_longest): Handle TYPE_CODE_BOOL. --- gdb/valprint.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'gdb/valprint.c') diff --git a/gdb/valprint.c b/gdb/valprint.c index 9170805..8811cc5 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -628,6 +628,7 @@ cplus_val_print (type, valaddr, stream, format, recurse, pretty, dont_print) obstack_ptr_grow (&dont_print_obstack, TYPE_BASECLASS (type, i)); } + /* Fix to use baseclass_offset instead. FIXME */ baddr = baseclass_addr (type, i, valaddr, 0, &err); if (err == 0 && baddr == 0) error ("could not find virtual baseclass `%s'\n", @@ -867,8 +868,9 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty) addr = unpack_pointer (lookup_pointer_type (builtin_type_void), valaddr); - if (addr < 128) /* FIXME! What is this 128? */ + if (METHOD_PTR_IS_VIRTUAL(addr)) { + int offset = METHOD_PTR_TO_VOFFSET(addr); len = TYPE_NFN_FIELDS (domain); for (i = 0; i < len; i++) { @@ -878,9 +880,9 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty) for (j = 0; j < len2; j++) { QUIT; - if (TYPE_FN_FIELD_VOFFSET (f, j) == addr) + if (TYPE_FN_FIELD_VOFFSET (f, j) == offset) { - kind = "virtual"; + kind = "virtual "; goto common; } } @@ -1283,6 +1285,11 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty) fprintf_filtered (stream, ""); break; + case TYPE_CODE_BOOL: + val = unpack_long (builtin_type_chill_bool, valaddr); + fprintf_filtered (stream, val ? "TRUE" : "FALSE"); + break; + default: error ("Invalid type code in symbol table."); } @@ -1324,6 +1331,10 @@ typedef_print (type, new, stream) type_print(type,"",stream,0); break; #endif +#ifdef _LANG_chill + case language_chill: + error("Missing Chill support in function typedef_print."); /*FIXME*/ +#endif default: error("Language not supported."); } @@ -1862,8 +1873,13 @@ type_print_base (type, stream, show, level) fprintf_filtered (stream, ";\n"); } - /* C++: print out the methods */ + /* If there are both fields and methods, put a space between. */ len = TYPE_NFN_FIELDS (type); + if (len && section_type != s_none) + fprintf_filtered (stream, "\n"); + + /* C++: print out the methods */ + for (i = 0; i < len; i++) { struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i); -- cgit v1.1