This doesn't work with OS X 10.9 or later. If you want to build gdb-ng either use Mountain Lion or ask gdbinit (github)/osxreverser (twitter)/fractalg (irc) to fix it for you ;^)
Install darwinbuild
:
sudo port install darwinbuild
Download and pack gdb-ng
:
cd /tmp
wget --no-check-certificate https://github.com/gdbinit/gdb-ng/archive/master.zip
unzip master.zip
cd gdb-ng-master
sh pack.sh
Create .dmg
for darwinbuild
:
hdiutil create -size 2G -type UDIF -fs HFSX -volname Builds -uid 0 -gid 0 -attach /tmp/Builds.dmg
Switch to root prompt (all commands from now on will require root):
sudo sh
Initialize darwinbuild
:
vsdbutil -a /Volumes/Builds
cd /Volumes/Builds
mkdir Build12A269 # Mountain Lion version
cd Build12A269
darwinbuild -init 12A269
darwinxref edit
Change the line with RC_ARCHS
to:
RC_ARCHS = "i386";
Add the following lines after projects = {
:
gdb = {
version = 1824;
};
Copy gdb-ng
to Build image:
cp /tmp/gdb-ng-master/gdb-1824.tar.gz Sources
Build gdb
:
darwinbuild -nochroot gdb
Backup old version of gdb
:
cp /usr/libexec/gdb/gdb-i386-apple-darwin /usr/libexec/gdb/gdb-i386-apple-darwin.orig
Copy new version of gdb
to /usr/libexec/gdb
:
cp Roots/gdb/gdb-1824.root*/usr/libexec/gdb/gdb-i386-apple-darwin /usr/libexec/gdb/
Sign the new gdb binary using this guide (replace lldb
with gdb
):
http://www.opensource.apple.com/source/lldb/lldb-69/docs/code-signing.txt
Clean up:
rm -rf /tmp/master.zip /tmp/gdb-ng-master
# Not sure if these 2 lines are correct:
hdiutil detach /Volumes/Builds/.build/*.sparseimage
hdiutil detach /tmp/Builds.dmg
rm -rf /tmp/Builds.dmg
Thanks! But I'm getting darwinxref [edit cancelled]: cancelled by user. Any ideas?