From 27f1958c241c861d12f40901a96a119cabf0228c Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Sat, 7 Jun 1997 09:38:31 +0000 Subject: [PATCH] start-sanitize-gdbtk * gdbtk.c (gdb_get_breakpoint_info): Add string for new enumeration del_at_next_stop to bpdisp array. end-sanitize-gdbtk * eval.c (evaluate_subexp_for_sizeof): Handle dereferencing of non-pointer values. * symtab.c (gdb_mangle_name): Improve mangling of nested types, their physical names already include the class name. * valops.c (value_cast): Handle upcast of a class pointer. From Andreas Schwab (schwab@issan.informatik.uni-dortmund.de): * corelow.c (get_core_registers): Make secname big enough. --- gdb/ChangeLog | 18 ++++++++++++++++++ gdb/corelow.c | 2 +- gdb/eval.c | 18 ++++++++++++------ gdb/gdbtk.c | 2 +- gdb/symtab.c | 8 ++++---- 5 files changed, 36 insertions(+), 12 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d2b557ade1b..a0811febff5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +Sat Jun 7 02:34:19 1997 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + +start-sanitize-gdbtk + * gdbtk.c (gdb_get_breakpoint_info): Add string for new + enumeration del_at_next_stop to bpdisp array. + +end-sanitize-gdbtk + * eval.c (evaluate_subexp_for_sizeof): Handle dereferencing + of non-pointer values. + + * symtab.c (gdb_mangle_name): Improve mangling of nested types, + their physical names already include the class name. + + * valops.c (value_cast): Handle upcast of a class pointer. + + From Andreas Schwab (schwab@issan.informatik.uni-dortmund.de): + * corelow.c (get_core_registers): Make secname big enough. + Fri Jun 6 14:43:23 1997 Keith Seitz * config/sh/tm-sh.h: add define for FPSCR_REGNUM diff --git a/gdb/corelow.c b/gdb/corelow.c index d7cab710c61..458e6467108 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -278,7 +278,7 @@ get_core_registers (regno) sec_ptr reg_sec; unsigned size; char *the_regs; - char secname[10]; + char secname[30]; enum bfd_flavour our_flavour = bfd_get_flavour (core_bfd); struct core_fns *cf = NULL; diff --git a/gdb/eval.c b/gdb/eval.c index 5d6a594d38c..4a7da00e602 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1,5 +1,5 @@ /* Evaluate expressions for GDB. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996 + Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of GDB. @@ -524,9 +524,6 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) low_bound = 0; high_bound = (TYPE_LENGTH (type) / element_size) - 1; } - if (nargs > (high_bound - low_bound + 1)) - /* to avoid memory corruption */ - error ("Too many array elements"); index = low_bound; memset (VALUE_CONTENTS_RAW (array), 0, TYPE_LENGTH (expect_type)); for (tem = nargs; --nargs >= 0; ) @@ -551,6 +548,9 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) } else { + if (index > high_bound) + /* to avoid memory corruption */ + error ("Too many array elements"); memcpy (VALUE_CONTENTS_RAW (array) + (index - low_bound) * element_size, VALUE_CONTENTS (element), @@ -1445,7 +1445,8 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (noside == EVAL_SKIP) goto nosideret; - if (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_INT) + type = check_typedef (VALUE_TYPE (arg2)); + if (TYPE_CODE (type) != TYPE_CODE_INT) error ("Non-integral right operand for \"@\" operator."); if (noside == EVAL_AVOID_SIDE_EFFECTS) { @@ -1560,7 +1561,8 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) return value_zero (exp->elts[pc + 1].type, lval_memory); else return value_at_lazy (exp->elts[pc + 1].type, - value_as_pointer (arg1)); + value_as_pointer (arg1), + NULL); case UNOP_PREINCREMENT: arg1 = evaluate_subexp (expect_type, exp, pos, noside); @@ -1801,6 +1803,10 @@ evaluate_subexp_for_sizeof (exp, pos) (*pos)++; val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); type = check_typedef (VALUE_TYPE (val)); + if (TYPE_CODE (type) != TYPE_CODE_PTR + && TYPE_CODE (type) != TYPE_CODE_REF + && TYPE_CODE (type) != TYPE_CODE_ARRAY) + error ("Attempt to take contents of a non-pointer value."); type = check_typedef (TYPE_TARGET_TYPE (type)); return value_from_longest (builtin_type_int, (LONGEST) TYPE_LENGTH (type)); diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c index 2306d09346f..72b711b11f7 100644 --- a/gdb/gdbtk.c +++ b/gdb/gdbtk.c @@ -376,7 +376,7 @@ gdb_get_breakpoint_info (clientData, interp, argc, argv) "longjmp", "longjmp resume", "step resume", "through sigtramp", "watchpoint scope", "call dummy" }; - static char *bpdisp[] = {"delete", "disable", "donttouch"}; + static char *bpdisp[] = {"delete", "delstop", "disable", "donttouch"}; struct command_line *cmd; int bpnum; struct breakpoint *b; diff --git a/gdb/symtab.c b/gdb/symtab.c index 61bbe28b50c..732ba0d1c85 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -305,12 +305,11 @@ gdb_mangle_name (type, i, j) if (len == 0) { sprintf (buf, "__%s%s", const_prefix, volatile_prefix); - if (strcmp(buf, "__") == 0) - buf[0] = '\0'; } - else if (newname != NULL && strchr (newname, '<') != NULL) + else if (physname[0] == 't' || physname[0] == 'Q') { - /* Template methods are fully mangled. */ + /* The physname for template and qualified methods already includes + the class name. */ sprintf (buf, "__%s%s", const_prefix, volatile_prefix); newname = NULL; len = 0; @@ -2063,6 +2062,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical) xmalloc (sizeof (struct symtab_and_line)); values.nelts = 1; values.sals[0] = find_pc_line (pc, 0); + values.sals[0].pc = pc; return values; } -- 2.30.2