···11-Error codes by platform:
22-http://www.ioplex.com/~miallen/errcmp.html
33-44-GCC inline asm:
55-http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
66-77-Darwin syscalls:
88-http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/
99-1010-Darwin tasks:
1111-http://www.foldr.org/~michaelw/log/computers/macosx/task-info-fun-with-mach
1212-1313-NetBSD paper:
1414-http://2004.eurobsdcon.org/uploads/media/EBSD04_21.pdf
1515-1616-Crosscompilation:
1717-http://nathancoulson.com/proj_cross.php#x86_64-apple-darwin10
1818-1919-Unix apps for OS X:
2020-http://code.google.com/p/rudix/
2121-2222-
-71
tools/gdb_maloader.py
···11-# Copyright 2011 Shinichiro Hamaji. All rights reserved.
22-#
33-# Redistribution and use in source and binary forms, with or without
44-# modification, are permitted provided that the following conditions
55-# are met:
66-#
77-# 1. Redistributions of source code must retain the above copyright
88-# notice, this list of conditions and the following disclaimer.
99-#
1010-# 2. Redistributions in binary form must reproduce the above
1111-# copyright notice, this list of conditions and the following
1212-# disclaimer in the documentation and/or other materials
1313-# provided with the distribution.
1414-#
1515-# THIS SOFTWARE IS PROVIDED BY Shinichiro Hamaji ``AS IS'' AND ANY
1616-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1717-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1818-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Shinichiro Hamaji OR
1919-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2020-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2121-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
2222-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2323-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2424-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
2525-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2626-# SUCH DAMAGE.
2727-2828-import gdb
2929-import os
3030-import re
3131-import sys
3232-3333-def bt(demangle=True):
3434- # Find the newest frame.
3535- frame = gdb.selected_frame()
3636- while True:
3737- next = frame.newer()
3838- if not next:
3939- break
4040- frame = next
4141-4242- if demangle:
4343- pipe = os.popen('c++filt', 'w')
4444- else:
4545- pipe = sys.stdout
4646-4747- i = 0
4848- while frame:
4949- s = gdb.execute('p dumpSymbol((void*)0x%x)' % frame.pc(),
5050- to_string=True)
5151- m = re.match(r'.*"(.*)"$', s)
5252- if m:
5353- pipe.write("#%-2d %s\n" % (i, m.group(1)))
5454- else:
5555- sal = frame.find_sal()
5656- lineno = ''
5757- if sal.symtab:
5858- lineno = 'at %s:%d' % (sal.symtab, sal.line)
5959- else:
6060- soname = gdb.solib_name(frame.pc())
6161- if soname:
6262- lineno = 'from %s' % (soname)
6363- framename = frame.name()
6464- if not framename:
6565- framename = '??'
6666- pipe.write("#%-2d 0x%016x in %s () %s\n" %
6767- (i, frame.pc(), framename, lineno))
6868- frame = frame.older()
6969- i += 1
7070-7171- pipe.close()
-97
tools/unpack_xcode.sh
···11-#!/bin/sh
22-#
33-# Copyright 2011 Shinichiro Hamaji. All rights reserved.
44-#
55-# Redistribution and use in source and binary forms, with or without
66-# modification, are permitted provided that the following conditions
77-# are met:
88-#
99-# 1. Redistributions of source code must retain the above copyright
1010-# notice, this list of conditions and the following disclaimer.
1111-#
1212-# 2. Redistributions in binary form must reproduce the above
1313-# copyright notice, this list of conditions and the following
1414-# disclaimer in the documentation and/or other materials
1515-# provided with the distribution.
1616-#
1717-# THIS SOFTWARE IS PROVIDED BY Shinichiro Hamaji ``AS IS'' AND ANY
1818-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1919-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2020-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Shinichiro Hamaji OR
2121-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2222-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2323-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
2424-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2525-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2626-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
2727-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2828-# SUCH DAMAGE.
2929-#
3030-# Usage:
3131-#
3232-# %./unpack_xcode.sh xcode_3.2.6_and_ios_sdk_4.3__final.dmg
3333-#
3434-# The above commandline will put CLI tools in the dmg package into
3535-# ./xcode_3.2.6_and_ios_sdk_4.3__final/root .
3636-#
3737-# This script was inspired by this document:
3838-# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
3939-4040-set -e
4141-4242-dmg=$1
4343-dir=`basename $dmg .dmg`
4444-4545-if echo $dmg | grep xcode_4.1; then
4646- PKGS="MacOSX10.6 gcc4.2 llvm-gcc4.2 DeveloperToolsCLI clang"
4747- XCODE=xcode_4.1
4848- PKG_DIR="Applications/Install Xcode.app/Contents/Resources/Packages"
4949-elif echo $dmg | grep xcode_3; then
5050- PKGS="MacOSX10.6 gcc4.2 gcc4.0 llvm-gcc4.2 DeveloperToolsCLI clang"
5151- XCODE=xcode_3
5252- PKG_DIR="*/Packages"
5353-else
5454- PKGS="MacOSX10.6 gcc4.2 llvm-gcc4.2 DeveloperToolsCLI clang"
5555- XCODE=xcode_4.0
5656- PKG_DIR="*/Packages"
5757-fi
5858-5959-rm -fr $dir
6060-mkdir $dir
6161-cd $dir
6262-6363-7z x ../$dmg
6464-7z x 5.hfs
6565-6666-if [ $XCODE = "xcode_4.1" ]; then
6767- 7z x -y "Install Xcode/InstallXcode.pkg"
6868- 7z x -y InstallXcode.pkg/Payload
6969-fi
7070-7171-for pkg in $PKGS; do
7272- 7z x -y "$PKG_DIR/$pkg.pkg"
7373- 7z x -y Payload
7474- mkdir -p $pkg
7575- cd $pkg
7676- cpio -i < ../Payload~
7777- cd ..
7878- rm -f Payload*
7979-done
8080-8181-rm -fr root
8282-mkdir root
8383-for pkg in $PKGS; do
8484- if [ $pkg = "MacOSX10.6" ]; then
8585- cp -R $pkg/SDKs/*/* root
8686- else
8787- cd $pkg || continue
8888- tar -c * | tar -xC ../root
8989- cd ..
9090- fi
9191-done
9292-9393-ln -sf "../../System/Library/Frameworks root/Library/Frameworks"
9494-cd root/usr/lib
9595-ln -s system/* .
9696-9797-echo "The package was unpacked into $dir/root"