]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[Ada] pspace_data->sym_cache is always NULL
authorJoel Brobecker <brobecker@adacore.com>
Mon, 2 Feb 2015 03:20:58 +0000 (07:20 +0400)
committerJoel Brobecker <brobecker@adacore.com>
Mon, 2 Feb 2015 03:36:39 +0000 (07:36 +0400)
commit19a5737950b966d0ff3e50c01bb43742a870bb9e
tree3a2930ae860e98067c51ec77e062ad1aadb9520f
parentf48b30da32f7fd3d818541229d50666265f83218
[Ada] pspace_data->sym_cache is always NULL

The Ada symbol cache has been designed to have one instance of that
of that cache per program space, and for each instance to be created
on-demand. ada_get_symbol_cache is the function responsible for both
lookup and creation on demand.

Unfortunately, ada_get_symbol_cache forgot to store the reference
to newly created caches, thus causing it to:
  - Leak old caches;
  - Allocate a new cache each time the cache is being searched or
    a new entry is to be inserted.

This patch fixes the issue by avoiding the use of the local variable,
which indirectly allowed the bug to happen. We manipulate the reference
in the program-space data instead.

gdb/ChangeLog:

        PR gdb/17854:
        * ada-lang.c (ada_get_symbol_cache): Set pspace_data->sym_cache
        when allocating a new one.
gdb/ChangeLog
gdb/ada-lang.c