diff options
author | Daniel Jacobowitz <dan@debian.org> | 2002-04-09 20:51:33 +0000 |
---|---|---|
committer | Daniel Jacobowitz <dan@debian.org> | 2002-04-09 20:51:33 +0000 |
commit | af99dbbf57a98cf72799c2bd92a456344510da6d (patch) | |
tree | a4e3dc4aba8f96a57444134cee58b4ac6da4fedf /gdb | |
parent | 428c9ace18b40c386b813ceafe9cc6d3d5ae3672 (diff) | |
download | gdb-af99dbbf57a98cf72799c2bd92a456344510da6d.tar.gz |
2002-04-09 Daniel Jacobowitz <drow@mvista.com>
* symtab.h (ALL_BLOCK_SYMBOLS): Don't dereference the pointer
after the last symbol in a block.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/symtab.h | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index eab7956c616..068424a471b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2002-04-09 Daniel Jacobowitz <drow@mvista.com> + + * symtab.h (ALL_BLOCK_SYMBOLS): Don't dereference the pointer + after the last symbol in a block. + 2002-04-09 Pierre Muller <muller@ics.u-strasbg.fr> * p-exp.y (yylex): Handle also the fact that is_a_field_of_this diff --git a/gdb/symtab.h b/gdb/symtab.h index f59e7a32040..ec1b058c556 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -407,11 +407,15 @@ struct block /* Macro to loop through all symbols in a block BL. i counts which symbol we are looking at, and sym points to the current - symbol. */ + symbol. + The contortion at the end is to avoid reading past the last valid + BLOCK_SYM. */ #define ALL_BLOCK_SYMBOLS(bl, i, sym) \ for ((i) = 0, (sym) = BLOCK_SYM ((bl), (i)); \ (i) < BLOCK_NSYMS ((bl)); \ - ++(i), (sym) = BLOCK_SYM ((bl), (i))) + ++(i), (sym) = ((i) < BLOCK_NSYMS ((bl))) \ + ? BLOCK_SYM ((bl), (i)) \ + : NULL) /* Nonzero if symbols of block BL should be sorted alphabetically. Don't sort a block which corresponds to a function. If we did the |