2012-02-08 Joel Brobecker <brobecker@adacore.com>
authorTristan Gingold <gingold@adacore.com>
Wed, 8 Feb 2012 09:17:41 +0000 (09:17 +0000)
committerTristan Gingold <gingold@adacore.com>
Wed, 8 Feb 2012 09:17:41 +0000 (09:17 +0000)
* solib-darwin.c (darwin_bfd_open): Make sure that the filename
of the returned BFD is allocated by GDB.

gdb/ChangeLog
gdb/solib-darwin.c

index 60c5833afc6cc91e7f15359fed270397b394c5b1..1d491887e7dfab209e073dbdba340a39b2dc9807 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-08  Joel Brobecker  <brobecker@adacore.com>
+
+       * solib-darwin.c (darwin_bfd_open): Make sure that the filename
+       of the returned BFD is allocated by GDB.
+
 2012-02-07  Tom Tromey  <tromey@redhat.com>
 
        PR python/12027:
index ddfd48ba9853bc9439683658ef071b2b151b9368..95f8ad7962d8a814680bab164332bc9bfd72750a 100644 (file)
@@ -456,6 +456,12 @@ darwin_bfd_open (char *pathname)
       error (_("`%s': not a shared-library: %s"),
             found_pathname, bfd_errmsg (bfd_get_error ()));
     }
+
+  /* Make sure that the filename is malloc'ed.  The current filename
+     for fat-binaries BFDs is a name that was generated by BFD, usually
+     a static string containing the name of the architecture.  */
+  res->filename = xstrdup (pathname);
+
   return res;
 }