From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 02/10] clean up allocation of bfd filenames
Date: Thu, 19 Jul 2012 18:52:00 -0000 [thread overview]
Message-ID: <20120719185134.GA16054@host2.jankratochvil.net> (raw)
In-Reply-To: <87r4s83lu5.fsf@fleche.redhat.com>
On Wed, 18 Jul 2012 21:34:10 +0200, Tom Tromey wrote:
> BFD requires the user to allocate the file name for a BFD.
> GDB does this inconsistently: sometimes the file name is malloc'd,
> sometimes not. Sometimes it is freed, sometimes not.
>
> This patch adds a new function that reallocated the BFD's filename
> using bfd_alloc. This ties the lifetime to the BFD and removes the
> need to free the filename when closing the BFD.
[...]
> +void
> +gdb_bfd_stash_filename (struct bfd *abfd)
> +{
> + char *name = bfd_get_filename (abfd);
> + char *data;
> +
> + data = bfd_alloc (abfd, strlen (name) + 1);
> + strcpy (data, name);
> +
> + /* Unwarranted chumminess with BFD. */
> + abfd->filename = data;
> +}
Would not it be worth propose this bfd filename memory storage globally in
bfd/ ?
Thanks,
Jan
next prev parent reply other threads:[~2012-07-19 18:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-18 19:34 Tom Tromey
2012-07-19 18:52 ` Jan Kratochvil [this message]
2012-07-19 20:59 ` Tom Tromey
2012-07-20 16:30 ` Tom Tromey
2012-07-20 18:07 ` Jan Kratochvil
2013-03-28 12:29 ` RFC: solib.c:solib_map_sections so->so_name clobbering (was: [PATCH 02/10] clean up allocation of bfd filenames) Joel Brobecker
2013-03-28 19:12 ` RFC: solib.c:solib_map_sections so->so_name clobbering Tom Tromey
2013-03-29 1:59 ` Joel Brobecker
2013-03-29 7:43 ` darwin: fix SO name in "info sharedlibrary" (was: "RFC: solib.c:solib_map_sections so->so_name clobbering") Joel Brobecker
2013-04-09 2:17 ` darwin: fix SO name in "info sharedlibrary" Tom Tromey
2013-04-11 5:40 ` checked in: " Joel Brobecker
2013-04-11 4:03 ` checked in: Re: RFC: solib.c:solib_map_sections so->so_name clobbering 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=20120719185134.GA16054@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/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