aboutsummaryrefslogtreecommitdiff
path: root/gdb/stabsread.c
diff options
context:
space:
mode:
authorPeter Schauer <Peter.Schauer@mytum.de>1997-02-22 11:42:07 +0000
committerPeter Schauer <Peter.Schauer@mytum.de>1997-02-22 11:42:07 +0000
commitf3cc5a0ea42542dd745389414da0bb37581fa1d8 (patch)
tree71d9375896b2dd8dd398d240a6a292a9ddf19e73 /gdb/stabsread.c
parent50b264e375f49f5e0a15711206426cff21e055cb (diff)
downloadgdb-f3cc5a0ea42542dd745389414da0bb37581fa1d8.zip
gdb-f3cc5a0ea42542dd745389414da0bb37581fa1d8.tar.gz
gdb-f3cc5a0ea42542dd745389414da0bb37581fa1d8.tar.bz2
* 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.
Diffstat (limited to 'gdb/stabsread.c')
-rw-r--r--gdb/stabsread.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 175415d..e779c93 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);