mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:51:15 +08:00
* 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 <lang>". * 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.
This commit is contained in:
parent
c1878f8788
commit
e58de8a230
@ -52,6 +52,7 @@ buildsym.c
|
||||
buildsym.h
|
||||
c-exp.y
|
||||
call-cmds.h
|
||||
ch-exp.y
|
||||
coffread.c
|
||||
command.c
|
||||
command.h
|
||||
|
@ -1,3 +1,68 @@
|
||||
Sun Nov 15 09:22:09 1992 Fred Fish (fnf@cygnus.com)
|
||||
|
||||
* 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 <lang>".
|
||||
* 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.
|
||||
|
||||
Fri Nov 13 20:24:10 1992 Stu Grossman (grossman at cygnus.com)
|
||||
|
||||
* infcmd.c (step_over_calls): Improve comments.
|
||||
|
@ -201,7 +201,7 @@ SFILES_MAINDIR = \
|
||||
mem-break.c target.c \
|
||||
dbxread.c coffread.c elfread.c dwarfread.c xcoffread.c stabsread.c \
|
||||
ieee-float.c language.c parse.c buildsym.c objfiles.c \
|
||||
minsyms.c mipsread.c maint.c
|
||||
minsyms.c mipsread.c maint.c ch-exp.y
|
||||
|
||||
# Source files in subdirectories (which will be handled separately by
|
||||
# 'make gdb.tar.Z').
|
||||
@ -325,8 +325,8 @@ NTSSTART = kdb-start.o
|
||||
SUBDIRS = doc
|
||||
|
||||
# For now, shortcut the "configure GDB for fewer languages" stuff.
|
||||
YYFILES = c-exp.tab.c m2-exp.tab.c
|
||||
YYOBJ = c-exp.tab.o m2-exp.tab.o
|
||||
YYFILES = c-exp.tab.c m2-exp.tab.c ch-exp.tab.c
|
||||
YYOBJ = c-exp.tab.o m2-exp.tab.o ch-exp.tab.o
|
||||
|
||||
# Prevent Sun make from putting in the machine type. Setting
|
||||
# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1.
|
||||
@ -372,8 +372,9 @@ saber_gdb: $(SFILES) $(DEPFILES) copying.c version.c
|
||||
#setopt load_flags $(CFLAGS) -I$(BFD_DIR) -DHOST_SYS=SUN4_SYS
|
||||
#load ./init.c $(SFILES)
|
||||
#unload ${srcdir}/c-exp.y ${srcdir}/m2-exp.y ${srcdir}/vx-share/*.h
|
||||
#unload ${srcdir}/ch-exp.y
|
||||
#unload ${srcdir}/nindy-share/[A-Z]*
|
||||
#load c-exp.tab.c m2-exp.tab.c
|
||||
#load c-exp.tab.c m2-exp.tab.c ch-exp.tab.c
|
||||
#load copying.c version.c
|
||||
#load ../opcodes/libopcodes.a
|
||||
#load ../libiberty/libiberty.a
|
||||
@ -623,14 +624,14 @@ clean:
|
||||
rm -f gdb[0-9]
|
||||
@$(MAKE) subdir_do DO=clean "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS)
|
||||
|
||||
distclean: clean c-exp.tab.c m2-exp.tab.c TAGS
|
||||
distclean: clean c-exp.tab.c m2-exp.tab.c ch-exp.tab.c TAGS
|
||||
rm -f tm.h xm.h config.status
|
||||
rm -f y.output yacc.acts yacc.tmp
|
||||
rm -f ${TESTS} Makefile depend
|
||||
@$(MAKE) subdir_do DO=distclean "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS)
|
||||
|
||||
realclean: clean
|
||||
rm -f c-exp.tab.c m2-exp.tab.c TAGS
|
||||
rm -f c-exp.tab.c m2-exp.tab.c ch-exp.tab.c TAGS
|
||||
rm -f tm.h xm.h config.status
|
||||
rm -f Makefile depend
|
||||
@$(MAKE) subdir_do DO=realclean "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS)
|
||||
@ -687,25 +688,46 @@ version.c: Makefile
|
||||
# Remove bogus decls for malloc/realloc/free which conflict with everything
|
||||
# else.
|
||||
c-exp.tab.o: c-exp.tab.c
|
||||
c-exp.tab.c: $(srcdir)/c-exp.y
|
||||
c-exp.tab.c: $(srcdir)/c-exp.y Makefile
|
||||
@echo 'Expect 4 shift/reduce conflicts.'
|
||||
${YACC} $(srcdir)/c-exp.y
|
||||
-sed -e '/extern.*malloc/d' \
|
||||
-e '/extern.*realloc/d' \
|
||||
-e '/extern.*free/d' \
|
||||
-e '/include.*malloc.h/d' \
|
||||
-e 's/malloc/xmalloc/g' \
|
||||
-e 's/realloc/xrealloc/g' \
|
||||
< y.tab.c > c-exp.tab.c
|
||||
-rm y.tab.c
|
||||
|
||||
# ch-exp.tab.c is generated in target dir from ch-exp.y if it doesn't exist
|
||||
# in srcdir, then compiled in target dir to ch-exp.tab.o.
|
||||
# Remove bogus decls for malloc/realloc/free which conflict with everything
|
||||
# else.
|
||||
ch-exp.tab.o: ch-exp.tab.c
|
||||
ch-exp.tab.c: $(srcdir)/ch-exp.y Makefile
|
||||
@echo 'Expect 4 shift/reduce conflicts.'
|
||||
${YACC} $(srcdir)/ch-exp.y
|
||||
-sed -e '/extern.*malloc/d' \
|
||||
-e '/extern.*realloc/d' \
|
||||
-e '/extern.*free/d' \
|
||||
-e '/include.*malloc.h/d' \
|
||||
-e 's/malloc/xmalloc/g' \
|
||||
-e 's/realloc/xrealloc/g' \
|
||||
< y.tab.c > ch-exp.tab.c
|
||||
-rm y.tab.c
|
||||
|
||||
# m2-exp.tab.c is generated in target dir from m2-exp.y if it doesn't exist
|
||||
# in srcdir, then compiled in target dir to m2-exp.tab.o.
|
||||
# Remove bogus decls for malloc/realloc/free which conflict with everything
|
||||
# else.
|
||||
m2-exp.tab.o: m2-exp.tab.c
|
||||
m2-exp.tab.c: $(srcdir)/m2-exp.y
|
||||
m2-exp.tab.c: $(srcdir)/m2-exp.y Makefile
|
||||
${YACC} $(srcdir)/m2-exp.y
|
||||
-sed -e '/extern.*malloc/d' \
|
||||
-e '/extern.*realloc/d' \
|
||||
-e '/extern.*free/d' \
|
||||
-e '/include.*malloc.h/d' \
|
||||
-e 's/malloc/xmalloc/g' \
|
||||
-e 's/realloc/xrealloc/g' \
|
||||
< y.tab.c > m2-exp.tab.c
|
||||
|
35
gdb/c-exp.y
35
gdb/c-exp.y
@ -234,11 +234,11 @@ exp : '-' exp %prec UNARY
|
||||
;
|
||||
|
||||
exp : '!' exp %prec UNARY
|
||||
{ write_exp_elt_opcode (UNOP_ZEROP); }
|
||||
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
|
||||
;
|
||||
|
||||
exp : '~' exp %prec UNARY
|
||||
{ write_exp_elt_opcode (UNOP_LOGNOT); }
|
||||
{ write_exp_elt_opcode (UNOP_COMPLEMENT); }
|
||||
;
|
||||
|
||||
exp : INCREMENT exp %prec UNARY
|
||||
@ -396,23 +396,23 @@ exp : exp '>' exp
|
||||
;
|
||||
|
||||
exp : exp '&' exp
|
||||
{ write_exp_elt_opcode (BINOP_LOGAND); }
|
||||
{ write_exp_elt_opcode (BINOP_BITWISE_AND); }
|
||||
;
|
||||
|
||||
exp : exp '^' exp
|
||||
{ write_exp_elt_opcode (BINOP_LOGXOR); }
|
||||
{ write_exp_elt_opcode (BINOP_BITWISE_XOR); }
|
||||
;
|
||||
|
||||
exp : exp '|' exp
|
||||
{ write_exp_elt_opcode (BINOP_LOGIOR); }
|
||||
{ write_exp_elt_opcode (BINOP_BITWISE_IOR); }
|
||||
;
|
||||
|
||||
exp : exp ANDAND exp
|
||||
{ write_exp_elt_opcode (BINOP_AND); }
|
||||
{ write_exp_elt_opcode (BINOP_LOGICAL_AND); }
|
||||
;
|
||||
|
||||
exp : exp OROR exp
|
||||
{ write_exp_elt_opcode (BINOP_OR); }
|
||||
{ write_exp_elt_opcode (BINOP_LOGICAL_OR); }
|
||||
;
|
||||
|
||||
exp : exp '?' exp ':' exp %prec '?'
|
||||
@ -1057,9 +1057,9 @@ const static struct token tokentab2[] =
|
||||
{"*=", ASSIGN_MODIFY, BINOP_MUL},
|
||||
{"/=", ASSIGN_MODIFY, BINOP_DIV},
|
||||
{"%=", ASSIGN_MODIFY, BINOP_REM},
|
||||
{"|=", ASSIGN_MODIFY, BINOP_LOGIOR},
|
||||
{"&=", ASSIGN_MODIFY, BINOP_LOGAND},
|
||||
{"^=", ASSIGN_MODIFY, BINOP_LOGXOR},
|
||||
{"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
|
||||
{"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
|
||||
{"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
|
||||
{"++", INCREMENT, BINOP_END},
|
||||
{"--", DECREMENT, BINOP_END},
|
||||
{"->", ARROW, BINOP_END},
|
||||
@ -1478,11 +1478,11 @@ const static struct op_print c_op_print_tab[] =
|
||||
{
|
||||
{",", BINOP_COMMA, PREC_COMMA, 0},
|
||||
{"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
|
||||
{"||", BINOP_OR, PREC_OR, 0},
|
||||
{"&&", BINOP_AND, PREC_AND, 0},
|
||||
{"|", BINOP_LOGIOR, PREC_LOGIOR, 0},
|
||||
{"&", BINOP_LOGAND, PREC_LOGAND, 0},
|
||||
{"^", BINOP_LOGXOR, PREC_LOGXOR, 0},
|
||||
{"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
|
||||
{"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
|
||||
{"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
|
||||
{"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
|
||||
{"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
|
||||
{"==", BINOP_EQUAL, PREC_EQUAL, 0},
|
||||
{"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
|
||||
{"<=", BINOP_LEQ, PREC_ORDER, 0},
|
||||
@ -1498,8 +1498,8 @@ const static struct op_print c_op_print_tab[] =
|
||||
{"%", BINOP_REM, PREC_MUL, 0},
|
||||
{"@", BINOP_REPEAT, PREC_REPEAT, 0},
|
||||
{"-", UNOP_NEG, PREC_PREFIX, 0},
|
||||
{"!", UNOP_ZEROP, PREC_PREFIX, 0},
|
||||
{"~", UNOP_LOGNOT, PREC_PREFIX, 0},
|
||||
{"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
|
||||
{"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
|
||||
{"*", UNOP_IND, PREC_PREFIX, 0},
|
||||
{"&", UNOP_ADDR, PREC_PREFIX, 0},
|
||||
{"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
|
||||
@ -1507,6 +1507,7 @@ const static struct op_print c_op_print_tab[] =
|
||||
{"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
|
||||
/* C++ */
|
||||
{"::", BINOP_SCOPE, PREC_PREFIX, 0},
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* These variables point to the objects
|
||||
|
1199
gdb/ch-exp.y
Normal file
1199
gdb/ch-exp.y
Normal file
File diff suppressed because it is too large
Load Diff
18
gdb/defs.h
18
gdb/defs.h
@ -47,8 +47,11 @@ quit PARAMS ((void));
|
||||
|
||||
#define QUIT { if (quit_flag) quit (); }
|
||||
|
||||
/* Notes on classes: class_alias is for alias commands which are not
|
||||
abbreviations of the original command. */
|
||||
/* Command classes are top-level categories into which commands are broken
|
||||
down for "help" purposes.
|
||||
Notes on classes: class_alias is for alias commands which are not
|
||||
abbreviations of the original command. class-pseudo is for commands
|
||||
which are not really commands nor help topics ("stop"). */
|
||||
|
||||
enum command_class
|
||||
{
|
||||
@ -57,7 +60,8 @@ enum command_class
|
||||
/* Classes of commands */
|
||||
no_class = -1, class_run = 0, class_vars, class_stack,
|
||||
class_files, class_support, class_info, class_breakpoint,
|
||||
class_alias, class_obscure, class_user, class_maintenance
|
||||
class_alias, class_obscure, class_user, class_maintenance,
|
||||
class_pseudo
|
||||
};
|
||||
|
||||
/* the cleanup list records things that have to be undone
|
||||
@ -338,6 +342,7 @@ enum language
|
||||
language_auto, /* Placeholder for automatic setting */
|
||||
language_c, /* C */
|
||||
language_cplus, /* C++ */
|
||||
language_chill, /* Chill */
|
||||
language_m2 /* Modula-2 */
|
||||
};
|
||||
|
||||
@ -368,6 +373,11 @@ local_hex_string_custom PARAMS ((int, char *)); /* language.c */
|
||||
|
||||
#include "xm.h"
|
||||
|
||||
/* Native machine support. This will be a symlink to one of the
|
||||
nm-*.h files, built by the `configure' script. */
|
||||
|
||||
#include "nm.h"
|
||||
|
||||
/* If the xm.h file did not define the mode string used to open the
|
||||
files, assume that binary files are opened the same way as text
|
||||
files */
|
||||
@ -811,6 +821,4 @@ push_word ();
|
||||
#define MAINTENANCE_CMDS 1
|
||||
#endif
|
||||
|
||||
#include "energize.h"
|
||||
|
||||
#endif /* !defined (DEFS_H) */
|
||||
|
@ -486,13 +486,18 @@ set_cu_language (dip)
|
||||
case LANG_C_PLUS_PLUS:
|
||||
cu_language = language_cplus;
|
||||
break;
|
||||
case LANG_CHILL:
|
||||
cu_language = language_chill;
|
||||
break;
|
||||
case LANG_MODULA2:
|
||||
cu_language = language_m2;
|
||||
break;
|
||||
case LANG_ADA83:
|
||||
case LANG_COBOL74:
|
||||
case LANG_COBOL85:
|
||||
case LANG_FORTRAN77:
|
||||
case LANG_FORTRAN90:
|
||||
case LANG_PASCAL83:
|
||||
case LANG_MODULA2:
|
||||
default:
|
||||
cu_language = language_unknown;
|
||||
break;
|
||||
|
74
gdb/eval.c
74
gdb/eval.c
@ -237,6 +237,11 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
(*pos) += 2;
|
||||
return value_of_register (longest_to_int (exp->elts[pc + 1].longconst));
|
||||
|
||||
case OP_BOOL:
|
||||
(*pos) += 2;
|
||||
return value_from_longest (builtin_type_chill_bool,
|
||||
exp->elts[pc + 1].longconst);
|
||||
|
||||
case OP_INTERNALVAR:
|
||||
(*pos) += 2;
|
||||
return value_of_internalvar (exp->elts[pc + 1].internalvar);
|
||||
@ -252,7 +257,7 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
case TERNOP_COND:
|
||||
/* Skip third and second args to evaluate the first one. */
|
||||
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
if (value_zerop (arg1))
|
||||
if (value_logical_not (arg1))
|
||||
{
|
||||
evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
|
||||
return evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
@ -342,9 +347,8 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
nargs = longest_to_int (exp->elts[pc + 1].longconst) + 1;
|
||||
/* First, evaluate the structure into arg2 */
|
||||
pc2 = (*pos)++;
|
||||
/* type = exp->elts[pc2 + 1].type; */
|
||||
tem2 = strlen (&exp->elts[pc2 + 2].string);
|
||||
*pos += 3 + (tem2 + sizeof (union exp_element)) / sizeof (union exp_element);
|
||||
tem2 = strlen (&exp->elts[pc2 + 1].string);
|
||||
*pos += 2 + (tem2 + sizeof (union exp_element)) / sizeof (union exp_element);
|
||||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
|
||||
@ -377,13 +381,9 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
int static_memfuncp;
|
||||
value temp = arg2;
|
||||
|
||||
/* argvec[0] gets the method;
|
||||
argvec[1] gets the 'this' pointer (unless static) (from arg2);
|
||||
the remaining args go into the rest of argvec. */
|
||||
|
||||
argvec[1] = arg2;
|
||||
argvec[0] =
|
||||
value_struct_elt (&temp, argvec+1, &exp->elts[pc2 + 2].string,
|
||||
value_struct_elt (&temp, argvec+1, &exp->elts[pc2 + 1].string,
|
||||
&static_memfuncp,
|
||||
op == STRUCTOP_STRUCT
|
||||
? "structure" : "structure pointer");
|
||||
@ -428,50 +428,40 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
return call_function_by_hand (argvec[0], nargs, argvec + 1);
|
||||
|
||||
case STRUCTOP_STRUCT:
|
||||
tem = strlen (&exp->elts[pc + 2].string);
|
||||
(*pos) += 3 + ((tem + sizeof (union exp_element))
|
||||
tem = strlen (&exp->elts[pc + 1].string);
|
||||
(*pos) += 2 + ((tem + sizeof (union exp_element))
|
||||
/ sizeof (union exp_element));
|
||||
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR)
|
||||
goto handle_structop_ptr;
|
||||
type = exp->elts[pc + 1].type;
|
||||
if (type)
|
||||
arg1 = value_ind (value_cast (lookup_pointer_type (type),
|
||||
value_addr (arg1)));
|
||||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||
return value_zero (lookup_struct_elt_type (VALUE_TYPE (arg1),
|
||||
&exp->elts[pc + 2].string,
|
||||
&exp->elts[pc + 1].string,
|
||||
0),
|
||||
lval_memory);
|
||||
else
|
||||
{
|
||||
value temp = arg1;
|
||||
return value_struct_elt (&temp, (value *)0, &exp->elts[pc + 2].string,
|
||||
return value_struct_elt (&temp, (value *)0, &exp->elts[pc + 1].string,
|
||||
(int *) 0, "structure");
|
||||
}
|
||||
|
||||
case STRUCTOP_PTR:
|
||||
tem = strlen (&exp->elts[pc + 2].string);
|
||||
(*pos) += 3 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
|
||||
tem = strlen (&exp->elts[pc + 1].string);
|
||||
(*pos) += 2 + (tem + sizeof (union exp_element)) / sizeof (union exp_element);
|
||||
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
handle_structop_ptr:
|
||||
type = exp->elts[pc + 1].type;
|
||||
if (type)
|
||||
arg1 = value_cast (lookup_pointer_type (type), arg1);
|
||||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||
return value_zero (lookup_struct_elt_type (TYPE_TARGET_TYPE
|
||||
(VALUE_TYPE (arg1)),
|
||||
&exp->elts[pc + 2].string,
|
||||
&exp->elts[pc + 1].string,
|
||||
0),
|
||||
lval_memory);
|
||||
else
|
||||
{
|
||||
value temp = arg1;
|
||||
return value_struct_elt (&temp, (value *)0, &exp->elts[pc + 2].string,
|
||||
return value_struct_elt (&temp, (value *)0, &exp->elts[pc + 1].string,
|
||||
(int *) 0, "structure pointer");
|
||||
}
|
||||
|
||||
@ -552,9 +542,9 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
case BINOP_REM:
|
||||
case BINOP_LSH:
|
||||
case BINOP_RSH:
|
||||
case BINOP_LOGAND:
|
||||
case BINOP_LOGIOR:
|
||||
case BINOP_LOGXOR:
|
||||
case BINOP_BITWISE_AND:
|
||||
case BINOP_BITWISE_IOR:
|
||||
case BINOP_BITWISE_XOR:
|
||||
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
if (noside == EVAL_SKIP)
|
||||
@ -592,7 +582,7 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
else
|
||||
return value_subscript (arg1, arg2);
|
||||
|
||||
case BINOP_AND:
|
||||
case BINOP_LOGICAL_AND:
|
||||
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
if (noside == EVAL_SKIP)
|
||||
{
|
||||
@ -611,14 +601,14 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
}
|
||||
else
|
||||
{
|
||||
tem = value_zerop (arg1);
|
||||
tem = value_logical_not (arg1);
|
||||
arg2 = evaluate_subexp (NULL_TYPE, exp, pos,
|
||||
(tem ? EVAL_SKIP : noside));
|
||||
return value_from_longest (builtin_type_int,
|
||||
(LONGEST) (!tem && !value_zerop (arg2)));
|
||||
(LONGEST) (!tem && !value_logical_not (arg2)));
|
||||
}
|
||||
|
||||
case BINOP_OR:
|
||||
case BINOP_LOGICAL_OR:
|
||||
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
if (noside == EVAL_SKIP)
|
||||
{
|
||||
@ -637,11 +627,11 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
}
|
||||
else
|
||||
{
|
||||
tem = value_zerop (arg1);
|
||||
tem = value_logical_not (arg1);
|
||||
arg2 = evaluate_subexp (NULL_TYPE, exp, pos,
|
||||
(!tem ? EVAL_SKIP : noside));
|
||||
return value_from_longest (builtin_type_int,
|
||||
(LONGEST) (!tem || !value_zerop (arg2)));
|
||||
(LONGEST) (!tem || !value_logical_not (arg2)));
|
||||
}
|
||||
|
||||
case BINOP_EQUAL:
|
||||
@ -760,19 +750,19 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
else
|
||||
return value_neg (arg1);
|
||||
|
||||
case UNOP_LOGNOT:
|
||||
case UNOP_COMPLEMENT:
|
||||
/* C++: check for and handle destructor names. */
|
||||
op = exp->elts[*pos].opcode;
|
||||
|
||||
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
if (unop_user_defined_p (UNOP_LOGNOT, arg1))
|
||||
return value_x_unop (arg1, UNOP_LOGNOT);
|
||||
if (unop_user_defined_p (UNOP_COMPLEMENT, arg1))
|
||||
return value_x_unop (arg1, UNOP_COMPLEMENT);
|
||||
else
|
||||
return value_lognot (arg1);
|
||||
return value_complement (arg1);
|
||||
|
||||
case UNOP_ZEROP:
|
||||
case UNOP_LOGICAL_NOT:
|
||||
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
||||
if (noside == EVAL_SKIP)
|
||||
goto nosideret;
|
||||
@ -780,7 +770,7 @@ evaluate_subexp (expect_type, exp, pos, noside)
|
||||
return value_x_unop (arg1, op);
|
||||
else
|
||||
return value_from_longest (builtin_type_int,
|
||||
(LONGEST) value_zerop (arg1));
|
||||
(LONGEST) value_logical_not (arg1));
|
||||
|
||||
case UNOP_IND:
|
||||
if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR)
|
||||
|
@ -80,7 +80,7 @@ enum type_code
|
||||
|
||||
/* Modula-2 */
|
||||
TYPE_CODE_CHAR, /* *real* character type */
|
||||
TYPE_CODE_BOOL /* Builtin Modula-2 BOOLEAN */
|
||||
TYPE_CODE_BOOL /* Builtin Modula-2/Chill BOOLEAN */
|
||||
};
|
||||
|
||||
/* For now allow source to use TYPE_CODE_CLASS for C++ classes, as an
|
||||
@ -489,6 +489,13 @@ extern struct type *builtin_type_m2_card;
|
||||
extern struct type *builtin_type_m2_real;
|
||||
extern struct type *builtin_type_m2_bool;
|
||||
|
||||
/* Chill types */
|
||||
|
||||
extern struct type *builtin_type_chill_bool;
|
||||
extern struct type *builtin_type_chill_long;
|
||||
extern struct type *builtin_type_chill_ulong;
|
||||
extern struct type *builtin_type_chill_real;
|
||||
|
||||
/* LONG_LONG is defined if the host has "long long". */
|
||||
|
||||
#ifdef LONG_LONG
|
||||
|
@ -29,7 +29,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/dir.h>
|
||||
#include <signal.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -112,7 +112,7 @@ const struct language_defn *expected_language;
|
||||
static const struct language_defn **languages;
|
||||
static unsigned languages_size;
|
||||
static unsigned languages_allocsize;
|
||||
#define DEFAULT_ALLOCSIZE 3
|
||||
#define DEFAULT_ALLOCSIZE 4
|
||||
|
||||
/* The "set language/type/range" commands all put stuff in these
|
||||
buffers. This is to make them work as set/show commands. The
|
||||
@ -165,6 +165,7 @@ set_language_command (ignore, from_tty)
|
||||
local or auto Automatic setting based on source file\n\
|
||||
c Use the C language\n\
|
||||
c++ Use the C++ language\n\
|
||||
chill Use the Chill language\n\
|
||||
modula-2 Use the Modula-2 language\n");
|
||||
/* Restore the silly string. */
|
||||
set_language(current_language->la_language);
|
||||
@ -457,6 +458,8 @@ binop_result_type(v1,v2)
|
||||
not needed. */
|
||||
return l1 > l2 ? VALUE_TYPE(v1) : VALUE_TYPE(v2);
|
||||
break;
|
||||
case language_chill:
|
||||
error ("Missing Chill support in function binop_result_check.");/*FIXME*/
|
||||
}
|
||||
abort();
|
||||
return (struct type *)0; /* For lint */
|
||||
@ -605,6 +608,8 @@ integral_type (type)
|
||||
(TYPE_CODE(type) != TYPE_CODE_ENUM) ? 0 : 1;
|
||||
case language_m2:
|
||||
return TYPE_CODE(type) != TYPE_CODE_INT ? 0 : 1;
|
||||
case language_chill:
|
||||
error ("Missing Chill support in function integral_type."); /*FIXME*/
|
||||
default:
|
||||
error ("Language not supported.");
|
||||
}
|
||||
@ -640,6 +645,8 @@ character_type (type)
|
||||
return (TYPE_CODE(type) == TYPE_CODE_INT) &&
|
||||
TYPE_LENGTH(type) == sizeof(char)
|
||||
? 1 : 0;
|
||||
case language_chill:
|
||||
error ("Missing Chill support in function character_type."); /*FIXME*/
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
@ -652,6 +659,7 @@ boolean_type (type)
|
||||
{
|
||||
switch(current_language->la_language)
|
||||
{
|
||||
case language_chill:
|
||||
case language_m2:
|
||||
return TYPE_CODE(type) != TYPE_CODE_BOOL ? 0 : 1;
|
||||
|
||||
@ -696,6 +704,8 @@ structured_type(type)
|
||||
return (TYPE_CODE(type) == TYPE_CODE_STRUCT) ||
|
||||
(TYPE_CODE(type) == TYPE_CODE_SET) ||
|
||||
(TYPE_CODE(type) == TYPE_CODE_ARRAY);
|
||||
case language_chill:
|
||||
error ("Missing Chill support in function structured_type."); /*FIXME*/
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
@ -717,7 +727,7 @@ value_true(val)
|
||||
|
||||
case language_c:
|
||||
case language_cplus:
|
||||
return !value_zerop (val);
|
||||
return !value_logical_not (val);
|
||||
|
||||
case language_m2:
|
||||
type = VALUE_TYPE(val);
|
||||
@ -740,6 +750,9 @@ value_true(val)
|
||||
return 0; /* BOOLEAN with value FALSE */
|
||||
break;
|
||||
|
||||
case language_chill:
|
||||
error ("Missing Chill support in function value_type."); /*FIXME*/
|
||||
|
||||
default:
|
||||
error ("Language not supported.");
|
||||
}
|
||||
@ -786,8 +799,8 @@ binop_type_check(arg1,arg2,op)
|
||||
type_op_error ("Arguments to %s must be of the same type.",op);
|
||||
break;
|
||||
|
||||
case BINOP_AND:
|
||||
case BINOP_OR:
|
||||
case BINOP_LOGICAL_AND:
|
||||
case BINOP_LOGICAL_OR:
|
||||
if (!boolean_type(t1) || !boolean_type(t2))
|
||||
type_op_error ("Arguments to %s must be of boolean type.",op);
|
||||
break;
|
||||
@ -839,7 +852,7 @@ binop_type_check(arg1,arg2,op)
|
||||
|
||||
/* Unary checks -- arg2 is null */
|
||||
|
||||
case UNOP_ZEROP:
|
||||
case UNOP_LOGICAL_NOT:
|
||||
if (!boolean_type(t1))
|
||||
type_op_error ("Argument to %s must be of boolean type.",op);
|
||||
break;
|
||||
@ -900,6 +913,12 @@ binop_type_check(arg1,arg2,op)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _LANG_chill
|
||||
case language_chill:
|
||||
error ("Missing Chill support in function binop_type_check.");/*FIXME*/
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ struct value;
|
||||
/* #include "lang_def.h" */
|
||||
#define _LANG_c
|
||||
#define _LANG_m2
|
||||
#define _LANG_chill
|
||||
|
||||
/* range_mode ==
|
||||
range_mode_auto: range_check set automatically to default of language.
|
||||
|
29
gdb/m2-exp.y
29
gdb/m2-exp.y
@ -105,11 +105,13 @@ int
|
||||
yyparse PARAMS ((void));
|
||||
|
||||
/* The sign of the number being parsed. */
|
||||
int number_sign = 1;
|
||||
static int number_sign = 1;
|
||||
|
||||
/* The block that the module specified by the qualifer on an identifer is
|
||||
contained in, */
|
||||
struct block *modblock=0;
|
||||
#if 0
|
||||
static struct block *modblock=0;
|
||||
#endif
|
||||
|
||||
/* #define YYDEBUG 1 */
|
||||
%}
|
||||
@ -174,7 +176,7 @@ struct block *modblock=0;
|
||||
%nonassoc ASSIGN
|
||||
%left '<' '>' LEQ GEQ '=' NOTEQUAL '#' IN
|
||||
%left OROR
|
||||
%left ANDAND '&'
|
||||
%left LOGICAL_AND '&'
|
||||
%left '@'
|
||||
%left '+' '-'
|
||||
%left '*' '/' DIV MOD
|
||||
@ -217,7 +219,7 @@ exp : '+' exp %prec UNARY
|
||||
;
|
||||
|
||||
exp : not_exp exp %prec UNARY
|
||||
{ write_exp_elt_opcode (UNOP_ZEROP); }
|
||||
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
|
||||
;
|
||||
|
||||
not_exp : NOT
|
||||
@ -444,16 +446,12 @@ exp : exp '>' exp
|
||||
{ write_exp_elt_opcode (BINOP_GTR); }
|
||||
;
|
||||
|
||||
exp : exp ANDAND exp
|
||||
{ write_exp_elt_opcode (BINOP_AND); }
|
||||
;
|
||||
|
||||
exp : exp '&' exp
|
||||
{ write_exp_elt_opcode (BINOP_AND); }
|
||||
exp : exp LOGICAL_AND exp
|
||||
{ write_exp_elt_opcode (BINOP_LOGICAL_AND); }
|
||||
;
|
||||
|
||||
exp : exp OROR exp
|
||||
{ write_exp_elt_opcode (BINOP_OR); }
|
||||
{ write_exp_elt_opcode (BINOP_LOGICAL_OR); }
|
||||
;
|
||||
|
||||
exp : exp ASSIGN exp
|
||||
@ -813,7 +811,7 @@ static struct keyword keytab[] =
|
||||
{
|
||||
{"OR" , OROR },
|
||||
{"IN", IN },/* Note space after IN */
|
||||
{"AND", ANDAND },
|
||||
{"AND", LOGICAL_AND},
|
||||
{"ABS", ABS },
|
||||
{"CHR", CHR },
|
||||
{"DEC", DEC },
|
||||
@ -1189,9 +1187,9 @@ const static struct op_print m2_op_print_tab[] = {
|
||||
{"DIV", BINOP_INTDIV, PREC_MUL, 0},
|
||||
{"MOD", BINOP_REM, PREC_MUL, 0},
|
||||
{":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
|
||||
{"OR", BINOP_OR, PREC_OR, 0},
|
||||
{"AND", BINOP_AND, PREC_AND, 0},
|
||||
{"NOT", UNOP_ZEROP, PREC_PREFIX, 0},
|
||||
{"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
|
||||
{"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
|
||||
{"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
|
||||
{"=", BINOP_EQUAL, PREC_EQUAL, 0},
|
||||
{"<>", BINOP_NOTEQUAL, PREC_EQUAL, 0},
|
||||
{"<=", BINOP_LEQ, PREC_ORDER, 0},
|
||||
@ -1200,6 +1198,7 @@ const static struct op_print m2_op_print_tab[] = {
|
||||
{"<", BINOP_LESS, PREC_ORDER, 0},
|
||||
{"^", UNOP_IND, PREC_PREFIX, 0},
|
||||
{"@", BINOP_REPEAT, PREC_REPEAT, 0},
|
||||
{NULL, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* The built-in types of Modula-2. */
|
||||
|
@ -175,9 +175,9 @@ int comma_terminates;
|
||||
they are used as the "surrounding precedence" to force
|
||||
various kinds of things to be parenthesized. */
|
||||
enum precedence
|
||||
{ PREC_NULL, PREC_COMMA, PREC_ABOVE_COMMA, PREC_ASSIGN, PREC_OR, PREC_AND,
|
||||
PREC_LOGIOR, PREC_LOGAND, PREC_LOGXOR, PREC_EQUAL, PREC_ORDER,
|
||||
PREC_SHIFT, PREC_ADD, PREC_MUL, PREC_REPEAT,
|
||||
{ PREC_NULL, PREC_COMMA, PREC_ABOVE_COMMA, PREC_ASSIGN, PREC_LOGICAL_OR,
|
||||
PREC_LOGICAL_AND, PREC_BITWISE_IOR, PREC_BITWISE_AND, PREC_BITWISE_XOR,
|
||||
PREC_EQUAL, PREC_ORDER, PREC_SHIFT, PREC_ADD, PREC_MUL, PREC_REPEAT,
|
||||
PREC_HYPER, PREC_PREFIX, PREC_SUFFIX };
|
||||
|
||||
/* Table mapping opcodes into strings for printing operators
|
||||
|
@ -29,6 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include "objfiles.h"
|
||||
#include "gdbcmd.h"
|
||||
#include "breakpoint.h"
|
||||
#include "language.h"
|
||||
|
||||
#include <obstack.h>
|
||||
#include <assert.h>
|
||||
@ -49,6 +50,9 @@ extern int info_verbose;
|
||||
|
||||
/* Functions this file defines */
|
||||
|
||||
static void
|
||||
set_initial_language PARAMS ((void));
|
||||
|
||||
static void
|
||||
load_command PARAMS ((char *, int));
|
||||
|
||||
@ -643,7 +647,7 @@ symbol_file_command (args, from_tty)
|
||||
current_source_line = 0;
|
||||
if (from_tty)
|
||||
{
|
||||
printf_filtered ("No symbol file now.\n");
|
||||
printf ("No symbol file now.\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -681,11 +685,45 @@ symbol_file_command (args, from_tty)
|
||||
else
|
||||
{
|
||||
symbol_file_add (name, from_tty, (CORE_ADDR)0, 1, mapped, readnow);
|
||||
set_initial_language ();
|
||||
}
|
||||
do_cleanups (cleanups);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the initial language.
|
||||
|
||||
A better solution would be to record the language in the psymtab when reading
|
||||
partial symbols, and then use it (if known) to set the language. This would
|
||||
be a win for formats that encode the language in an easily discoverable place,
|
||||
such as DWARF. For stabs, we can jump through hoops looking for specially
|
||||
named symbols or try to intuit the language from the specific type of stabs
|
||||
we find, but we can't do that until later when we read in full symbols.
|
||||
FIXME. */
|
||||
|
||||
static void
|
||||
set_initial_language ()
|
||||
{
|
||||
struct partial_symtab *pst;
|
||||
enum language lang = language_unknown;
|
||||
|
||||
pst = find_main_psymtab ();
|
||||
if (pst != NULL)
|
||||
{
|
||||
if (pst -> filename != NULL)
|
||||
{
|
||||
lang = deduce_language_from_filename (pst -> filename);
|
||||
}
|
||||
if (lang == language_unknown)
|
||||
{
|
||||
/* Make C the default language */
|
||||
lang = language_c;
|
||||
}
|
||||
set_language (lang);
|
||||
expected_language = current_language; /* Don't warn the user */
|
||||
}
|
||||
}
|
||||
|
||||
/* Open file specified by NAME and hand it off to BFD for preliminary
|
||||
analysis. Result is a newly initialized bfd *, which includes a newly
|
||||
malloc'd` copy of NAME (tilde-expanded and made absolute).
|
||||
@ -720,6 +758,7 @@ symfile_bfd_open (name)
|
||||
error ("\"%s\": can't open to read symbols: %s.", name,
|
||||
bfd_errmsg (bfd_error));
|
||||
}
|
||||
sym_bfd->cacheable = true;
|
||||
|
||||
if (!bfd_check_format (sym_bfd, bfd_object))
|
||||
{
|
||||
@ -1013,6 +1052,8 @@ deduce_language_from_filename (filename)
|
||||
return language_c;
|
||||
else if(!strcmp(c,".cc") || !strcmp(c,".C"))
|
||||
return language_cplus;
|
||||
else if(!strcmp(c,".chill") || !strcmp(c,".c186") || !strcmp(c,".c286"))
|
||||
return language_chill;
|
||||
|
||||
return language_unknown; /* default */
|
||||
}
|
||||
@ -1128,7 +1169,7 @@ clear_symtab_users_once ()
|
||||
return;
|
||||
clear_symtab_users_done = clear_symtab_users_queued;
|
||||
|
||||
printf_filtered ("Resetting debugger state after updating old symbol tables\n");
|
||||
printf ("Resetting debugger state after updating old symbol tables\n");
|
||||
|
||||
/* Someday, we should do better than this, by only blowing away
|
||||
the things that really need to be blown. */
|
||||
|
120
gdb/valarith.c
120
gdb/valarith.c
@ -134,8 +134,7 @@ value_subscripted_rvalue (array, idx)
|
||||
error ("no such vector element");
|
||||
|
||||
v = allocate_value (elt_type);
|
||||
(void) memcpy (VALUE_CONTENTS (v), VALUE_CONTENTS (array) + elt_offs,
|
||||
elt_size);
|
||||
memcpy (VALUE_CONTENTS (v), VALUE_CONTENTS (array) + elt_offs, elt_size);
|
||||
|
||||
if (VALUE_LVAL (array) == lval_internalvar)
|
||||
VALUE_LVAL (v) = lval_internalvar_component;
|
||||
@ -225,32 +224,32 @@ value_x_binop (arg1, arg2, op, otherop)
|
||||
ptr = tstr+8;
|
||||
switch (op)
|
||||
{
|
||||
case BINOP_ADD: strcpy(ptr,"+"); break;
|
||||
case BINOP_SUB: strcpy(ptr,"-"); break;
|
||||
case BINOP_MUL: strcpy(ptr,"*"); break;
|
||||
case BINOP_DIV: strcpy(ptr,"/"); break;
|
||||
case BINOP_REM: strcpy(ptr,"%"); break;
|
||||
case BINOP_LSH: strcpy(ptr,"<<"); break;
|
||||
case BINOP_RSH: strcpy(ptr,">>"); break;
|
||||
case BINOP_LOGAND: strcpy(ptr,"&"); break;
|
||||
case BINOP_LOGIOR: strcpy(ptr,"|"); break;
|
||||
case BINOP_LOGXOR: strcpy(ptr,"^"); break;
|
||||
case BINOP_AND: strcpy(ptr,"&&"); break;
|
||||
case BINOP_OR: strcpy(ptr,"||"); break;
|
||||
case BINOP_MIN: strcpy(ptr,"<?"); break;
|
||||
case BINOP_MAX: strcpy(ptr,">?"); break;
|
||||
case BINOP_ASSIGN: strcpy(ptr,"="); break;
|
||||
case BINOP_ADD: strcpy(ptr,"+"); break;
|
||||
case BINOP_SUB: strcpy(ptr,"-"); break;
|
||||
case BINOP_MUL: strcpy(ptr,"*"); break;
|
||||
case BINOP_DIV: strcpy(ptr,"/"); break;
|
||||
case BINOP_REM: strcpy(ptr,"%"); break;
|
||||
case BINOP_LSH: strcpy(ptr,"<<"); break;
|
||||
case BINOP_RSH: strcpy(ptr,">>"); break;
|
||||
case BINOP_BITWISE_AND: strcpy(ptr,"&"); break;
|
||||
case BINOP_BITWISE_IOR: strcpy(ptr,"|"); break;
|
||||
case BINOP_BITWISE_XOR: strcpy(ptr,"^"); break;
|
||||
case BINOP_LOGICAL_AND: strcpy(ptr,"&&"); break;
|
||||
case BINOP_LOGICAL_OR: strcpy(ptr,"||"); break;
|
||||
case BINOP_MIN: strcpy(ptr,"<?"); break;
|
||||
case BINOP_MAX: strcpy(ptr,">?"); break;
|
||||
case BINOP_ASSIGN: strcpy(ptr,"="); break;
|
||||
case BINOP_ASSIGN_MODIFY:
|
||||
switch (otherop)
|
||||
{
|
||||
case BINOP_ADD: strcpy(ptr,"+="); break;
|
||||
case BINOP_SUB: strcpy(ptr,"-="); break;
|
||||
case BINOP_MUL: strcpy(ptr,"*="); break;
|
||||
case BINOP_DIV: strcpy(ptr,"/="); break;
|
||||
case BINOP_REM: strcpy(ptr,"%="); break;
|
||||
case BINOP_LOGAND: strcpy(ptr,"&="); break;
|
||||
case BINOP_LOGIOR: strcpy(ptr,"|="); break;
|
||||
case BINOP_LOGXOR: strcpy(ptr,"^="); break;
|
||||
case BINOP_ADD: strcpy(ptr,"+="); break;
|
||||
case BINOP_SUB: strcpy(ptr,"-="); break;
|
||||
case BINOP_MUL: strcpy(ptr,"*="); break;
|
||||
case BINOP_DIV: strcpy(ptr,"/="); break;
|
||||
case BINOP_REM: strcpy(ptr,"%="); break;
|
||||
case BINOP_BITWISE_AND: strcpy(ptr,"&="); break;
|
||||
case BINOP_BITWISE_IOR: strcpy(ptr,"|="); break;
|
||||
case BINOP_BITWISE_XOR: strcpy(ptr,"^="); break;
|
||||
default:
|
||||
error ("Invalid binary operation specified.");
|
||||
}
|
||||
@ -318,9 +317,9 @@ value_x_unop (arg1, op)
|
||||
case UNOP_PREDECREMENT: strcpy(ptr,"++"); break;
|
||||
case UNOP_POSTINCREMENT: strcpy(ptr,"++"); break;
|
||||
case UNOP_POSTDECREMENT: strcpy(ptr,"++"); break;
|
||||
case UNOP_ZEROP: strcpy(ptr,"!"); break;
|
||||
case UNOP_LOGNOT: strcpy(ptr,"~"); break;
|
||||
case UNOP_NEG: strcpy(ptr,"-"); break;
|
||||
case UNOP_LOGICAL_NOT: strcpy(ptr,"!"); break;
|
||||
case UNOP_COMPLEMENT: strcpy(ptr,"~"); break;
|
||||
case UNOP_NEG: strcpy(ptr,"-"); break;
|
||||
default:
|
||||
error ("Invalid binary operation specified.");
|
||||
}
|
||||
@ -354,12 +353,16 @@ value_binop (arg1, arg2, op)
|
||||
|
||||
if ((TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_FLT
|
||||
&&
|
||||
TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_INT)
|
||||
TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_INT
|
||||
&&
|
||||
TYPE_CODE (VALUE_TYPE (arg1)) != TYPE_CODE_BOOL)
|
||||
||
|
||||
(TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_FLT
|
||||
&&
|
||||
TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_INT))
|
||||
error ("Argument to arithmetic operation not a number.");
|
||||
TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_INT
|
||||
&&
|
||||
TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_BOOL))
|
||||
error ("Argument to arithmetic operation not a number or boolean.");
|
||||
|
||||
if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_FLT
|
||||
||
|
||||
@ -394,8 +397,39 @@ value_binop (arg1, arg2, op)
|
||||
SWAP_TARGET_AND_HOST (&v, sizeof (v));
|
||||
*(double *) VALUE_CONTENTS_RAW (val) = v;
|
||||
}
|
||||
else if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_BOOL
|
||||
&&
|
||||
TYPE_CODE (VALUE_TYPE (arg2)) == TYPE_CODE_BOOL)
|
||||
{
|
||||
LONGEST v1, v2, v;
|
||||
v1 = value_as_long (arg1);
|
||||
v2 = value_as_long (arg2);
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case BINOP_BITWISE_AND:
|
||||
v = v1 & v2;
|
||||
break;
|
||||
|
||||
case BINOP_BITWISE_IOR:
|
||||
v = v1 | v2;
|
||||
break;
|
||||
|
||||
case BINOP_BITWISE_XOR:
|
||||
v = v1 ^ v2;
|
||||
break;
|
||||
|
||||
default:
|
||||
error ("Invalid operation on booleans.");
|
||||
}
|
||||
|
||||
val = allocate_value (builtin_type_chill_bool);
|
||||
SWAP_TARGET_AND_HOST (&v, sizeof (v));
|
||||
*(LONGEST *) VALUE_CONTENTS_RAW (val) = v;
|
||||
}
|
||||
else
|
||||
/* Integral operations here. */
|
||||
/* FIXME: Also mixed integral/booleans, with result an integer. */
|
||||
{
|
||||
/* Should we promote to unsigned longest? */
|
||||
if ((TYPE_UNSIGNED (VALUE_TYPE (arg1))
|
||||
@ -437,23 +471,23 @@ value_binop (arg1, arg2, op)
|
||||
v = v1 >> v2;
|
||||
break;
|
||||
|
||||
case BINOP_LOGAND:
|
||||
case BINOP_BITWISE_AND:
|
||||
v = v1 & v2;
|
||||
break;
|
||||
|
||||
case BINOP_LOGIOR:
|
||||
case BINOP_BITWISE_IOR:
|
||||
v = v1 | v2;
|
||||
break;
|
||||
|
||||
case BINOP_LOGXOR:
|
||||
case BINOP_BITWISE_XOR:
|
||||
v = v1 ^ v2;
|
||||
break;
|
||||
|
||||
case BINOP_AND:
|
||||
case BINOP_LOGICAL_AND:
|
||||
v = v1 && v2;
|
||||
break;
|
||||
|
||||
case BINOP_OR:
|
||||
case BINOP_LOGICAL_OR:
|
||||
v = v1 || v2;
|
||||
break;
|
||||
|
||||
@ -509,23 +543,23 @@ value_binop (arg1, arg2, op)
|
||||
v = v1 >> v2;
|
||||
break;
|
||||
|
||||
case BINOP_LOGAND:
|
||||
case BINOP_BITWISE_AND:
|
||||
v = v1 & v2;
|
||||
break;
|
||||
|
||||
case BINOP_LOGIOR:
|
||||
case BINOP_BITWISE_IOR:
|
||||
v = v1 | v2;
|
||||
break;
|
||||
|
||||
case BINOP_LOGXOR:
|
||||
case BINOP_BITWISE_XOR:
|
||||
v = v1 ^ v2;
|
||||
break;
|
||||
|
||||
case BINOP_AND:
|
||||
case BINOP_LOGICAL_AND:
|
||||
v = v1 && v2;
|
||||
break;
|
||||
|
||||
case BINOP_OR:
|
||||
case BINOP_LOGICAL_OR:
|
||||
v = v1 || v2;
|
||||
break;
|
||||
|
||||
@ -553,7 +587,7 @@ value_binop (arg1, arg2, op)
|
||||
/* Simulate the C operator ! -- return 1 if ARG1 contains zero. */
|
||||
|
||||
int
|
||||
value_zerop (arg1)
|
||||
value_logical_not (arg1)
|
||||
value arg1;
|
||||
{
|
||||
register int len;
|
||||
@ -696,7 +730,7 @@ value_neg (arg1)
|
||||
}
|
||||
|
||||
value
|
||||
value_lognot (arg1)
|
||||
value_complement (arg1)
|
||||
register value arg1;
|
||||
{
|
||||
COERCE_ENUM (arg1);
|
||||
|
@ -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, "<range type>");
|
||||
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.");
|
||||
}
|
||||
@ -1323,6 +1330,10 @@ typedef_print (type, new, stream)
|
||||
fprintf_filtered(stream, "<builtin> = ");
|
||||
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);
|
||||
|
@ -1384,7 +1384,7 @@ value_from_longest (type, num)
|
||||
integers, and that all pointers have the same form. */
|
||||
if (code == TYPE_CODE_INT || code == TYPE_CODE_ENUM ||
|
||||
code == TYPE_CODE_CHAR || code == TYPE_CODE_PTR ||
|
||||
code == TYPE_CODE_REF)
|
||||
code == TYPE_CODE_REF || code == TYPE_CODE_BOOL)
|
||||
{
|
||||
if (len == sizeof (char))
|
||||
* (char *) VALUE_CONTENTS_RAW (val) = num;
|
||||
|
Loading…
Reference in New Issue
Block a user