diff options
author | Daniel Jacobowitz <drow@false.org> | 2002-04-09 20:51:33 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2002-04-09 20:51:33 +0000 |
commit | 97658e92dfc5dd20031100cf6a3b26d700228613 (patch) | |
tree | 129dd165d527b7dbb82d2f038dfcd5868a9bc4ce /gdb/symtab.h | |
parent | 2d1676a068c316f3d6d31d905ff2880b32326d3d (diff) | |
download | gdb-97658e92dfc5dd20031100cf6a3b26d700228613.zip gdb-97658e92dfc5dd20031100cf6a3b26d700228613.tar.gz gdb-97658e92dfc5dd20031100cf6a3b26d700228613.tar.bz2 |
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/symtab.h')
-rw-r--r-- | gdb/symtab.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/symtab.h b/gdb/symtab.h index f59e7a3..ec1b058 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 |