* [patchv4 3/5] new: solib-sunos.c objfile unification [test needed]
@ 2013-09-19 13:56 Jan Kratochvil
2013-09-19 14:19 ` Joel Brobecker
0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2013-09-19 13:56 UTC (permalink / raw)
To: gdb-patches
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);
}
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [patchv4 3/5] new: solib-sunos.c objfile unification [test needed]
2013-09-19 13:56 [patchv4 3/5] new: solib-sunos.c objfile unification [test needed] Jan Kratochvil
@ 2013-09-19 14:19 ` Joel Brobecker
2013-09-19 14:31 ` Jan Kratochvil
0 siblings, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2013-09-19 14:19 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
> 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.
If this is really used on Solaris, I wouldn't mind testing it
(though only with our internal testing, as something in the official
testing badly crashes every single of our Solaris machine).
But isn't this file only used in the case of (old) SunOS, that is
pre-Solaris? Actually, a quick grep shows:
./config/vax/nbsdaout.mh: solib-sunos.o
./config/sparc/nbsdaout.mh: sparc-nat.o sparcnbsd-nat.o bsd-kvm.o solib-sunos.o
./config/m68k/nbsdaout.mh: solib-sunos.o
./config/m68k/obsd.mh: solib-sunos.o
./config/arm/nbsdaout.mh: solib-sunos.o
./config/i386/nbsdaout.mh: solib-sunos.o
./config/i386/obsdaout.mh: solib-sunos.o
I must be missing something, or else did you build with --enable-targets=all?
--
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patchv4 3/5] new: solib-sunos.c objfile unification [test needed]
2013-09-19 14:19 ` Joel Brobecker
@ 2013-09-19 14:31 ` Jan Kratochvil
2013-09-19 14:41 ` Joel Brobecker
2013-09-19 14:41 ` Pedro Alves
0 siblings, 2 replies; 6+ messages in thread
From: Jan Kratochvil @ 2013-09-19 14:31 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Thu, 19 Sep 2013 16:19:31 +0200, Joel Brobecker wrote:
> But isn't this file only used in the case of (old) SunOS, that is
> pre-Solaris? Actually, a quick grep shows:
>
> ./config/vax/nbsdaout.mh: solib-sunos.o
> ./config/sparc/nbsdaout.mh: sparc-nat.o sparcnbsd-nat.o bsd-kvm.o solib-sunos.o
> ./config/m68k/nbsdaout.mh: solib-sunos.o
> ./config/m68k/obsd.mh: solib-sunos.o
> ./config/arm/nbsdaout.mh: solib-sunos.o
> ./config/i386/nbsdaout.mh: solib-sunos.o
> ./config/i386/obsdaout.mh: solib-sunos.o
>
> I must be missing something, or else did you build with --enable-targets=all?
OK, I did not expect that. Yes, I always build with --enable-targets=all.
Is anyone using this target? I think the patch is OK to check-in I think.
Thanks,
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-09-19 20:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-19 13:56 [patchv4 3/5] new: solib-sunos.c objfile unification [test needed] Jan Kratochvil
2013-09-19 14:19 ` Joel Brobecker
2013-09-19 14:31 ` Jan Kratochvil
2013-09-19 14:41 ` Joel Brobecker
2013-09-19 14:41 ` Pedro Alves
2013-09-19 20:04 ` [cancel] " Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox