From f3cc5a0ea42542dd745389414da0bb37581fa1d8 Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Sat, 22 Feb 1997 11:42:07 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 10 ++++++++++ gdb/stabsread.c | 24 +++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 009a5401c2..e82f3baa96 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 175415dbd9..e779c934e3 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);