From: Peter Schauer Date: Sat, 22 Feb 1997 11:42:07 +0000 (+0000) Subject: * stabsread.c (read_type): Fix handling of template names X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f3cc5a0ea42542dd745389414da0bb37581fa1d8;p=binutils-gdb.git * stabsread.c (read_type): Fix handling of template names with template parameters containing `::'. * valops.c (search_struct_field, search_struct_method): Pass correct valaddr parameter to baseclass_offset. Prevent gdb crashes by making sure that the virtual base pointer from an user object still points to accessible memory. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 009a5401c2d..e82f3baa963 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +Sat Feb 22 03:39:50 1997 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * stabsread.c (read_type): Fix handling of template names + with template parameters containing `::'. + + * valops.c (search_struct_field, search_struct_method): + Pass correct valaddr parameter to baseclass_offset. + Prevent gdb crashes by making sure that the virtual base pointer + from an user object still points to accessible memory. + Tue Feb 18 13:36:34 1997 Mark Alexander * maint.c: Eliminate -Wall warnings by including some header files. diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 175415dbd99..e779c934e3c 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1,5 +1,5 @@ /* Support routines for decoding "stabs" debugging information format. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996 + Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc. This file is part of GDB. @@ -1957,15 +1957,21 @@ read_type (pp, objfile) p = strchr(*pp, ':'); if (p == NULL) return error_type (pp, objfile); - while (q1 && p > q1 && p[1] == ':') + if (q1 && p > q1 && p[1] == ':') { - q2 = strchr(q1, '>'); - if (!q2 || q2 < p) - break; - p += 2; - p = strchr(p, ':'); - if (p == NULL) - return error_type (pp, objfile); + int nesting_level = 0; + for (q2 = q1; *q2; q2++) + { + if (*q2 == '<') + nesting_level++; + else if (*q2 == '>') + nesting_level--; + else if (*q2 == ':' && nesting_level == 0) + break; + } + p = q2; + if (*p != ':') + return error_type (pp, objfile); } to = type_name = (char *)obstack_alloc (&objfile->type_obstack, p - *pp + 1);