Use scoped_free_pendings in coff_symtab_read
authorTom Tromey <tom@tromey.com>
Fri, 29 Jun 2018 21:10:04 +0000 (15:10 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 17 Jul 2018 15:30:57 +0000 (09:30 -0600)
PR gdb/18624 concerns an assertion failure that occurs when setting a
breakpoint in a Go program on Windows.

What happens here is that coff_symtab_read uses buildsym but does not
instantiate scoped_free_pendings.  So, the struct pending objects are
never released.  Later, dwarf2read.c calls buildsym_init, which
asserts.

This patch fixes the problem by instantiating scoped_free_pendings in
coff_symtab_read.

Tested using the test executable from the PR.  I don't know how to
test this more fully.

gdb/ChangeLog
2018-07-17  Tom Tromey  <tom@tromey.com>

PR gdb/18624:
* coffread.c (coff_symtab_read): Use scoped_free_pendings.

gdb/ChangeLog
gdb/coffread.c

index 635f592e476a55b6181ed6b7bd6adb98f9f41575..01c1a2501db22d250da4aa9eae2373917189573c 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-17  Tom Tromey  <tom@tromey.com>
+
+       PR gdb/18624:
+       * coffread.c (coff_symtab_read): Use scoped_free_pendings.
+
 2018-07-16  Jim Wilson  <jimw@sifive.com>
 
        * riscv-tdep.c (riscv_gdbarch_init): Call gdbarch_init_osabi.
index b13d901638de41c4deeff86e1436952aaa75dd62..ff55542031df01e5edbe1fb70784bf09c49660fb 100644 (file)
@@ -804,6 +804,9 @@ coff_symtab_read (minimal_symbol_reader &reader,
   CORE_ADDR tmpaddr;
   struct minimal_symbol *msym;
 
+  buildsym_init ();
+  scoped_free_pendings free_pending;
+
   /* Work around a stdio bug in SunOS4.1.1 (this makes me nervous....
      it's hard to know I've really worked around it.  The fix should
      be harmless, anyway).  The symptom of the bug is that the first