From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23072 invoked by alias); 23 Jun 2009 15:03:40 -0000 Received: (qmail 22840 invoked by uid 22791); 23 Jun 2009 15:03:38 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Jun 2009 15:03:28 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n5NF3PHe018796 for ; Tue, 23 Jun 2009 11:03:25 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5NF3POA007056 for ; Tue, 23 Jun 2009 11:03:25 -0400 Received: from host0.dyn.jankratochvil.net (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5NF3OKB000675; Tue, 23 Jun 2009 11:03:25 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id n5NF3Njx008459; Tue, 23 Jun 2009 17:03:23 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id n5NF3M1T008458; Tue, 23 Jun 2009 17:03:22 +0200 Date: Tue, 23 Jun 2009 15:03:00 -0000 From: Jan Kratochvil To: Paul Pluzhnikov Cc: Tom Tromey , gdb-patches@sources.redhat.com Subject: [patch] Fix a reread_symbols regression by mmap [Re: [patch] Use mmap instead of obstack_alloc for dwarf debug sections.] Message-ID: <20090623150322.GA7654@host0.dyn.jankratochvil.net> References: <20090527001157.934BD76BC0@localhost> <8ac60eac0905280956v79d9a84apad9a4370212283b9@mail.gmail.com> <8ac60eac0906101839t4d3978fyc1c6d3b3e2eccb6e@mail.gmail.com> <8ac60eac0906101842y2d2fc9fco331cb4336d9508d0@mail.gmail.com> <8ac60eac0906161342m67c30151lc7f685e0eb36e41f@mail.gmail.com> <8ac60eac0906161407s6498913cu5e50e930d599be77@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8ac60eac0906161407s6498913cu5e50e930d599be77@mail.gmail.com> User-Agent: Mutt/1.5.19 (2009-01-05) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00606.txt.bz2 Hi Paul, while sure your patch is great it has a regression. Assuming a regression reproducer needs to link GDB with -lmcheck (but did verify it). (I do not try to advocate reread_symbols but its code is there now.) Thanks, Jan This patch will fix back (tested on {x86_64,i686}-fedora-linux-gnu): -FAIL: gdb.ada/exec_changed.exp: start second -dwarf2read.c:10943: internal-error: munmap_section_buffer: Assertion `munmap ((void *) map_begin, map_length) == 0' failed.^M +PASS: gdb.ada/exec_changed.exp: start second -FAIL: gdb.base/chng-syms.exp: (timeout) running with invalidated bpt condition after executable changes -dwarf2read.c:10943: internal-error: munmap_section_buffer: Assertion `munmap ((void *) map_begin, map_length) == 0' failed.^M +PASS: gdb.base/chng-syms.exp: running with invalidated bpt condition after executable changes -FAIL: gdb.base/reread.exp: run to foo() second time (timeout) -dwarf2read.c:10943: internal-error: munmap_section_buffer: Assertion `munmap ((void *) map_begin, map_length) == 0' failed.^M -FAIL: gdb.base/reread.exp: shell mv /home/jkratoch/hammock/20090623build-gdbcvs/fedora-11-i386/build/src/gdb/testsuite.unix.-m32/gdb.base/reread /home/jkratoch/hammock/20090623build-gdbcvs/fedora-11-i386/build/src/gdb/testsuite.unix.-m32/gdb.base/reread2 (GDB internal error) -ERROR: Could not resync from internal error (timeout) -[more mess] +PASS: gdb.base/reread.exp: run to foo() second time +PASS: gdb.base/reread.exp: second pass: breakpoint foo in first file +PASS: gdb.base/reread.exp: second pass: run to foo() +PASS: gdb.base/reread.exp: second pass: continue to completion +PASS: gdb.base/reread.exp: second pass: run to foo() second time munmap(0x9595959595959000, 10778685752873425706) = -1 EINVAL (Invalid argument) write(1, "dwarf2read.c:10943: internal-error: munmap_section_buffer: Assertion `munmap ((void *) map_begin, map_length) == 0' failed.\nA problem internal to GDB has been detected,\nfurther debugging may prove unre"..., 209) = 209 2009-06-23 Jan Kratochvil Fix a regression by the mmap patch from 2009-06-16. * symfile.c (reread_symbols): Move sym_finish and clear_objfile_data calls before deleting the OBJFILE obstack. Extend the comment. --- gdb/symfile.c 17 Jun 2009 18:34:34 -0000 1.232 +++ gdb/symfile.c 23 Jun 2009 14:56:34 -0000 @@ -2334,7 +2334,16 @@ reread_symbols (void) /* Nuke all the state that we will re-read. Much of the following code which sets things to NULL really is necessary to tell - other parts of GDB that there is nothing currently there. */ + other parts of GDB that there is nothing currently there. + + Try to keep the freeing order compatible with free_objfile. */ + + if (objfile->sf != NULL) + { + (*objfile->sf->sym_finish) (objfile); + } + + clear_objfile_data (objfile); /* FIXME: Do we have to free a whole linked list, or is this enough? */ @@ -2371,11 +2380,6 @@ reread_symbols (void) sizeof (objfile->msymbol_hash)); memset (&objfile->msymbol_demangled_hash, 0, sizeof (objfile->msymbol_demangled_hash)); - clear_objfile_data (objfile); - if (objfile->sf != NULL) - { - (*objfile->sf->sym_finish) (objfile); - } objfile->psymbol_cache = bcache_xmalloc (); objfile->macro_cache = bcache_xmalloc ();