From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2125 invoked by alias); 19 Sep 2013 13:56:30 -0000 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 Received: (qmail 2091 invoked by uid 89); 19 Sep 2013 13:56:30 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Sep 2013 13:56:30 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8JDuRcd011261 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 Sep 2013 09:56:27 -0400 Received: from host2.jankratochvil.net (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8JDuOmE008749 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Thu, 19 Sep 2013 09:56:26 -0400 Date: Thu, 19 Sep 2013 13:56:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patchv4 3/5] new: solib-sunos.c objfile unification [test needed] Message-ID: <20130919135623.GC16978@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00680.txt.bz2 Hi, I would appreciate testing this (probably a full testsuite diff needed) on Solaris. I found some local older Opensolaris VM here but recent GDB fails to build there (on gnulib fnmatch*); according to Joel recent GDBs build fine on real Solaris. The reason is apparently that objfile should be created at a single place, otherwise various changes need to be done at multiple places etc. But unfortunately I do not see the reason why the code did not use allocate_objfile() already. It was added this way by this release from https://github.com/palves/gdb-old-releases.git but I do not know why: commit e62555e9d0cf7be157ac62cc31a3d1d079ba271b Date: Wed Feb 1 19:21:24 1995 +0100 gdb-4.14+gdb-4.14-testsuite also in archer.git jankratochvil/dwp Thanks, Jan gdb/ 2013-09-18 Jan Kratochvil * solib-sunos.c (allocate_rt_common_objfile): Replace it by an allocate_objfile call. (solib_add_common_symbols): Call free_objfile and allocate_objfile instead. --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -182,31 +182,11 @@ static int match_main (char *); static void allocate_rt_common_objfile (void) { - struct objfile *objfile; - struct objfile *last_one; - - objfile = (struct objfile *) xmalloc (sizeof (struct objfile)); - memset (objfile, 0, sizeof (struct objfile)); - objfile->psymbol_cache = psymbol_bcache_init (); - objfile->macro_cache = bcache_xmalloc (NULL, NULL); - objfile->filename_cache = bcache_xmalloc (NULL, NULL); - obstack_init (&objfile->objfile_obstack); - objfile->name = xstrdup ("rt_common"); - - /* Add this file onto the tail of the linked list of other such files. */ - - objfile->next = NULL; - if (object_files == NULL) - object_files = objfile; - else - { - for (last_one = object_files; - last_one->next; - last_one = last_one->next); - last_one->next = objfile; - } + const char name[] = "rt_common"; - rt_common_objfile = objfile; + rt_common_objfile = allocate_objfile (NULL, 0); + rt_common_objfile->name = obstack_copy0 (&rt_common_objfile->objfile_obstack, + name, strlen (name)); } /* Read all dynamically loaded common symbol definitions from the inferior @@ -225,10 +205,8 @@ solib_add_common_symbols (CORE_ADDR rtc_symp) if (rt_common_objfile != NULL && rt_common_objfile->minimal_symbol_count) { - obstack_free (&rt_common_objfile->objfile_obstack, 0); - obstack_init (&rt_common_objfile->objfile_obstack); - rt_common_objfile->minimal_symbol_count = 0; - rt_common_objfile->msymbols = NULL; + free_objfile (rt_common_objfile); + allocate_rt_common_objfile (); terminate_minimal_symbol_table (rt_common_objfile); }