From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: darwin: fix SO name in "info sharedlibrary" (was: "RFC: solib.c:solib_map_sections so->so_name clobbering")
Date: Fri, 29 Mar 2013 07:43:00 -0000 [thread overview]
Message-ID: <20130329015304.GJ4758@adacore.com> (raw)
In-Reply-To: <20130328232724.GF4758@adacore.com>
[-- Attachment #1: Type: text/plain, Size: 587 bytes --]
> > Joel> We wouldn't be able to use a patch like this on the 7.6 branch,
> > Joel> so for Darwin, I'd restore the xstrdup below - it would be a memory
> > Joel> leak, but better to have a leak than not having the shared library name,
> > Joel> IMO.
> >
> > You can make it not leak by using bfd_alloc.
>
> Neat! I will try that before I go.
Here is the patch.
gdb/ChangeLog:
* solib-darwin.c (darwin_bfd_open): Set the filename of the
returned bfd to a copy of PATHNAME.
Tested on x86_64-darwin, no regression. Does it look OK for the branch?
Thank you,
--
Joel
[-- Attachment #2: 0001-solib-darwin-Overwrite-filename-of-unpeeled-fat-bina.patch --]
[-- Type: text/x-diff, Size: 1099 bytes --]
From c77cdff7df21b5351f471faaf4d34dd423c7c385 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Thu, 28 Mar 2013 21:48:36 -0400
Subject: [PATCH] solib-darwin: Overwrite filename of unpeeled fat-binary bfd.
gdb/ChangeLog:
* solib-darwin.c (darwin_bfd_open): Set the filename of the
returned bfd to a copy of PATHNAME.
---
gdb/solib-darwin.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index b9a4be1..9b61de5 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -621,6 +621,16 @@ darwin_bfd_open (char *pathname)
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
}
+ /* The current filename for fat-binary BFDs is a name generated
+ by BFD, usually a string containing the name of the architecture.
+ Reset its value to the actual filename. */
+ {
+ char *data = bfd_alloc (res, strlen (pathname) + 1);
+
+ strcpy (data, pathname);
+ res->filename = data;
+ }
+
gdb_bfd_unref (abfd);
return res;
}
--
1.7.0.4
next prev parent reply other threads:[~2013-03-29 1:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-18 19:34 [PATCH 02/10] clean up allocation of bfd filenames Tom Tromey
2012-07-19 18:52 ` Jan Kratochvil
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 ` Joel Brobecker [this message]
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=20130329015304.GJ4758@adacore.com \
--to=brobecker@adacore.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