This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] NULL dwarf2_per_objfile in dwarf2_per_objfile_free
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at redhat dot com>
- Date: Wed, 19 Jun 2013 12:33:21 -0600
- Subject: [PATCH] NULL dwarf2_per_objfile in dwarf2_per_objfile_free
This is the patch I suggested to Joel: clear dwarf2_per_objfile in
dwarf2_per_objfile_free, to avoid problems if any code there tries to
use it.
Built and regtested on x86-64 Fedora 18.
* dwarf2read.c (dwarf2_per_objfile_free): Clear
dwarf2_per_objfile.
---
gdb/dwarf2read.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 555698a..8dfd110 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -20514,6 +20514,10 @@ dwarf2_per_objfile_free (struct objfile *objfile, void *d)
struct dwarf2_per_objfile *data = d;
int ix;
+ /* Make sure we don't accidentally use dwarf2_per_objfile while
+ cleaning up. */
+ dwarf2_per_objfile = NULL;
+
for (ix = 0; ix < data->n_comp_units; ++ix)
VEC_free (dwarf2_per_cu_ptr, data->all_comp_units[ix]->imported_symtabs);
--
1.8.1.4