* [PATCH] issues in bcache_xmalloc calls.
@ 2011-08-26 9:23 matt rice
2011-08-26 12:06 ` Pedro Alves
2011-08-26 16:56 ` Tom Tromey
0 siblings, 2 replies; 4+ messages in thread
From: matt rice @ 2011-08-26 9:23 UTC (permalink / raw)
To: gdb-patches; +Cc: matt rice
While doing the macro patches, I noticed these 2 things,
though i have not tried it solib-sunos.c seems as though it should not compile
for almost a year, I didn't see a bug report or email so I'm going to go out on
a limb and say its relatively unused.
earlier in reread_symbols the bcaches are allocated, and it looks like a leak
to me... don't see any way to cause it to free in the inbetween. Just in case,
i set these up as uninitialized values and ran the testsuite to make sure.
it was covered by gdb.base/reread.exp.
2011-08-26 Matt Rice <ratmice@gmail.com>
* solib-sunos.c (allocate_rt_common_objfile): Add missing arguments to
bcache_xmalloc.
* symfile.c (reread_symbols): Remove extra calls to bcache_xmalloc.
---
gdb/solib-sunos.c | 6 +++---
gdb/symfile.c | 3 ---
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c
index 405ca4f..5bf765d 100644
--- a/gdb/solib-sunos.c
+++ b/gdb/solib-sunos.c
@@ -189,9 +189,9 @@ allocate_rt_common_objfile (void)
objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
memset (objfile, 0, sizeof (struct objfile));
- objfile->psymbol_cache = bcache_xmalloc ();
- objfile->macro_cache = bcache_xmalloc ();
- objfile->filename_cache = bcache_xmalloc ();
+ objfile->psymbol_cache = bcache_xmalloc (NULL, NULL);
+ objfile->macro_cache = bcache_xmalloc (NULL, NULL);
+ objfile->filename_cache = bcache_xmalloc (NULL, NULL);
obstack_init (&objfile->objfile_obstack);
objfile->name = xstrdup ("rt_common");
diff --git a/gdb/symfile.c b/gdb/symfile.c
index aca907a..bb233c9 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2472,9 +2472,6 @@ reread_symbols (void)
memset (&objfile->msymbol_demangled_hash, 0,
sizeof (objfile->msymbol_demangled_hash));
- objfile->psymbol_cache = psymbol_bcache_init ();
- objfile->macro_cache = bcache_xmalloc (NULL, NULL);
- objfile->filename_cache = bcache_xmalloc (NULL, NULL);
/* obstack_init also initializes the obstack so it is
empty. We could use obstack_specify_allocation but
gdb_obstack.h specifies the alloc/dealloc
--
1.7.4.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] issues in bcache_xmalloc calls.
2011-08-26 9:23 [PATCH] issues in bcache_xmalloc calls matt rice
@ 2011-08-26 12:06 ` Pedro Alves
2011-08-26 16:56 ` Tom Tromey
1 sibling, 0 replies; 4+ messages in thread
From: Pedro Alves @ 2011-08-26 12:06 UTC (permalink / raw)
To: gdb-patches; +Cc: matt rice
On Friday 26 August 2011 10:22:30, matt rice wrote:
> though i have not tried it solib-sunos.c seems as though it should not compile
> for almost a year, I didn't see a bug report or email so I'm going to go out on
> a limb and say its relatively unused.
Despite its name, it's only used by *bsd a.out targets
noadays, and it only builds natively (though I believe
it could be made host independent with some work).
$ grep solib-sunos config/* -rn
config/arm/nbsdaout.mh:3: solib-sunos.o
config/i386/nbsdaout.mh:4: solib.o solib-sunos.o
config/i386/obsdaout.mh:4: solib.o solib-sunos.o
config/m68k/nbsdaout.mh:3: solib.o solib-sunos.o
config/m68k/obsd.mh:3: solib.o solib-sunos.o
config/sparc/nbsdaout.mh:3: sparc-nat.o sparcnbsd-nat.o bsd-kvm.o solib-sunos.o
config/vax/nbsdaout.mh:4: solib.o solib-sunos.o
I don't know whether there's anyone still using these targets
nowdays, or whether everyone moved to elf long ago.
--
Pedro Alves
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] issues in bcache_xmalloc calls.
2011-08-26 9:23 [PATCH] issues in bcache_xmalloc calls matt rice
2011-08-26 12:06 ` Pedro Alves
@ 2011-08-26 16:56 ` Tom Tromey
2011-08-27 10:38 ` Matt Rice
1 sibling, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2011-08-26 16:56 UTC (permalink / raw)
To: matt rice; +Cc: gdb-patches
>>>>> "matt" == matt rice <ratmice@gmail.com> writes:
matt> 2011-08-26 Matt Rice <ratmice@gmail.com>
matt> * solib-sunos.c (allocate_rt_common_objfile): Add missing arguments to
matt> bcache_xmalloc.
matt> * symfile.c (reread_symbols): Remove extra calls to bcache_xmalloc.
Thanks.
matt> + objfile->psymbol_cache = bcache_xmalloc (NULL, NULL);
This one should call psymbol_bcache_init.
The patch is ok with this change.
Not your problem, but I think it is bogus that solib-sunos.c allocates
an objfile on its own like this. This sort of thing should be in
objfiles.c, because the current approach makes it too easy to miss this
code when making changes to objfile.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] issues in bcache_xmalloc calls.
2011-08-26 16:56 ` Tom Tromey
@ 2011-08-27 10:38 ` Matt Rice
0 siblings, 0 replies; 4+ messages in thread
From: Matt Rice @ 2011-08-27 10:38 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Fri, Aug 26, 2011 at 9:55 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "matt" == matt rice <ratmice@gmail.com> writes:
>
> matt> + objfile->psymbol_cache = bcache_xmalloc (NULL, NULL);
>
> This one should call psymbol_bcache_init.
>
> The patch is ok with this change.
commited.
http://sourceware.org/ml/gdb-cvs/2011-08/msg00124.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-08-27 10:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-26 9:23 [PATCH] issues in bcache_xmalloc calls matt rice
2011-08-26 12:06 ` Pedro Alves
2011-08-26 16:56 ` Tom Tromey
2011-08-27 10:38 ` Matt Rice
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox