Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patchv4 3/5] new: solib-sunos.c objfile unification [test needed]
Date: Thu, 19 Sep 2013 13:56:00 -0000	[thread overview]
Message-ID: <20130919135623.GC16978@host2.jankratochvil.net> (raw)

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  <jan.kratochvil@redhat.com>

	* 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);
     }
 


             reply	other threads:[~2013-09-19 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19 13:56 Jan Kratochvil [this message]
2013-09-19 14:19 ` Joel Brobecker
2013-09-19 14:31   ` Jan Kratochvil
2013-09-19 14:41     ` Pedro Alves
2013-09-19 20:04       ` [cancel] " Jan Kratochvil
2013-09-19 14:41     ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130919135623.GC16978@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox