From: Tom Tromey Date: Mon, 20 Jun 2011 17:53:33 +0000 (+0000) Subject: * symtab.c (lookup_language_this): End loop if block is NULL. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=03de682319d5a8d18f2121056ea75aeb37b39b21;p=binutils-gdb.git * symtab.c (lookup_language_this): End loop if block is NULL. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 70ae97614d3..954fb5317a2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2011-06-20 Tom Tromey + + * symtab.c (lookup_language_this): End loop if block is NULL. + 2011-06-17 Tom Tromey * valops.c (value_of_this): Use lookup_language_this. diff --git a/gdb/symtab.c b/gdb/symtab.c index d627636ae1a..13234f236df 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1100,7 +1100,7 @@ lookup_language_this (const struct language_defn *lang, if (lang->la_name_of_this == NULL || block == NULL) return NULL; - while (1) + while (block) { struct symbol *sym; @@ -1108,9 +1108,11 @@ lookup_language_this (const struct language_defn *lang, if (sym != NULL) return sym; if (BLOCK_FUNCTION (block)) - return NULL; + break; block = BLOCK_SUPERBLOCK (block); } + + return NULL; } /* Behave like lookup_symbol except that NAME is the natural name