gdb: apply upstream patch to fix OS X crash

There is a known issue with gdb 7.4 on OS X where calling `run` on twice
in the same debugging session will crash gdb. It's been fixed upstream
and it's targeted for 7.5. I've added a patch that fixes it in the
formula.

The bug report:
http://old.nabble.com/-Bug-gdb-13619--New%3A-Crash-when-running-binary-a-second-time-in-the-same-session-td33196464.html
The patch (linked from the bug report):
http://sourceware.org/ml/gdb-patches/2012-02/msg00098.html

Closes Homebrew/homebrew#8.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
David Albert 2012-03-31 17:42:04 -04:00 committed by Misty De Meo
parent e6d682f587
commit 4059a20567

View file

@ -8,6 +8,13 @@ class Gdb < Formula
depends_on 'readline'
def patches
# patch to fix a crash when calling `run` twice in one session. It is
# upstream in gdb 7.5 and should be removed at that point.
# http://old.nabble.com/-Bug-gdb-13619--New%3A-Crash-when-running-binary-a-second-time-in-the-same-session-td33196464.html
{ :p0 => DATA }
end
def install
system "./configure", "--prefix=#{prefix}",
"--disable-debug",
@ -26,3 +33,22 @@ class Gdb < Formula
EOS
end
end
__END__
diff -c -r1.18 solib-darwin.c
*** gdb/solib-darwin.c 4 Jan 2012 08:17:11 -0000 1.18
--- gdb/solib-darwin.c 8 Feb 2012 09:15:49 -0000
***************
*** 456,461 ****
--- 456,467 ----
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;
}