summaryrefslogtreecommitdiff
path: root/sys-devel/gdb-apple
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-devel/gdb-apple
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-devel/gdb-apple')
-rw-r--r--sys-devel/gdb-apple/Manifest26
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1344-darwin8.patch131
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1461-darwin8.patch128
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1461-dyld-info.patch22
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1518-darwin8-9.patch87
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1518-darwin8.patch128
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1518-task_dyld_info.patch22
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-1705-darwin8-10.patch11
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-563-darwin7.patch110
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-563-no-64bit.patch19
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-768-darwin-arch.patch15
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-768-texinfo.patch10
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-962-darwin64.patch17
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-962-darwin8.patch15
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-962-demangle.patch22
-rw-r--r--sys-devel/gdb-apple/files/gdb-apple-no-global-gdbinit.patch23
-rw-r--r--sys-devel/gdb-apple/gdb-apple-1461.ebuild66
-rw-r--r--sys-devel/gdb-apple/gdb-apple-1752.ebuild75
-rw-r--r--sys-devel/gdb-apple/gdb-apple-768-r1.ebuild51
-rw-r--r--sys-devel/gdb-apple/gdb-apple-966.ebuild65
-rw-r--r--sys-devel/gdb-apple/metadata.xml8
21 files changed, 1051 insertions, 0 deletions
diff --git a/sys-devel/gdb-apple/Manifest b/sys-devel/gdb-apple/Manifest
new file mode 100644
index 000000000000..49deafb69dbd
--- /dev/null
+++ b/sys-devel/gdb-apple/Manifest
@@ -0,0 +1,26 @@
+AUX gdb-apple-1344-darwin8.patch 3606 SHA256 e7be79bc996f17f11b8332c8a6f6b574c35e3343647c0b8b913d9c142302ebba SHA512 e98fd9a9d4d5969e868885fa467142eae0e3981eccc212fdfcd9b2d82c85d2e4f6aed50ad77227eb7ad24f71434f6f1564cf8ac49bdb9bc9898b85c2ea6ec45e WHIRLPOOL da5609507e4a8b64877049aaae4d4fb2cc09039250fc3747dade3ae775cf54b91bb237ae09a82e4f3f320a7ada63292ae5f507dfae8fad0c322d7532712a9b68
+AUX gdb-apple-1461-darwin8.patch 3206 SHA256 5af99b9785a5edc8a649c63b33f68b3c5f56887c3058c2d323ffebcb43e96a4c SHA512 bbf8ff590bbc6225ba4a78813c36e239bc4bc50514ae59e024a2f4c54a79fa2e98db2313be8cc9bbb098f3df3b79b2e9925fda400879e196ac02071a8e9b1b93 WHIRLPOOL 091889a32627d66c4b8457f22d9d2a0897085ff097772afbe8f1e50c7513a5047d4cc692ccadf41d95a091c400d2585ffbd0d87196ec8fb1698cbedae908bbb5
+AUX gdb-apple-1461-dyld-info.patch 503 SHA256 d0a1cf51ca0c8699a7fc06bd64e1765c4612a20a87acbcf24a98d0fb1bb6f4b1 SHA512 f697133fcad4b6d2c0492f3e800f02feb133526bbec548c966bf92dbb92df9cfa9e69fadcc2bf28898bdf6a90f3ef2480ff944101eb0d1e6566735d2278cf56e WHIRLPOOL 5910b921c60be0b665f17609070940fde281e5cd449ddef92ae2a9e433f7454bdedb2bd0a9b57ec38b2a44b9b2bcba9fb2d1dcd402292ff40ab88c8ac962172d
+AUX gdb-apple-1518-darwin8-9.patch 2260 SHA256 9adb3170f383af933aa2a14822341160e39a521c02a49db154ab71513f31222c SHA512 7c079c480b3ed1e9d6cfed78ea87358988a4c72a0e89f4cd76e12b235e9451ab6ea77679ad0953f224e6c30ba0d078c5ce4e1a25f6bbd1134214dd721b0420b6 WHIRLPOOL 3c3ad175ce7d607ab0fbfd741b75974ad402ee98c29da7e94716001be9c530f3e42da4dce0125344a123ad1a09e1865682e21b0e307247ff63802f71b5b03ac4
+AUX gdb-apple-1518-darwin8.patch 3022 SHA256 9b313bc99eedf2cb7ba0163b13ad88ce86be78c49372f9b158bb1ea3139b2844 SHA512 efa100767336d0eba752d03d5d6ea6a77c80e40160208cd157abc444064c779f9d671e5a621cbeae8f7b2ae134e838e49a2726d1d9efcbd8421070a6b789679d WHIRLPOOL b7a7520be2ced8da6d25a852e8a98fe2e9b0b6762b971b36788d2ce8c201acee02f263cef7772b24cbe4384ff28278f76f190964bf4fcb4e835b3de32ab7c537
+AUX gdb-apple-1518-task_dyld_info.patch 557 SHA256 bc7e754ef5eb8a8a285d9ed8ec0d3476297c13456e6f76c887c4a848c4049ecb SHA512 69ea8de6663c91b8587df903c5c8578586875d73b6fb2aeef37a98346e78d214814e794e6a294051fb3b82a9d450ab6e9a2b13265ae48b8ad3dfd80004d6caf5 WHIRLPOOL 559fd483ea4144dd40ab5b9bec1ad7ee4e0fa69f3129662bf0d008c44ab6aca996db1cc2c2f266c9df154b93ddecb701645bb50756bfd520dd05a7182e979dfa
+AUX gdb-apple-1705-darwin8-10.patch 286 SHA256 db62e146bc0595b02ac8f4883d56459c59f57ad50b01aa6d7211209e9ef95136 SHA512 baf049e3a1e580faeb5b5481bbdda5cfd96abb22ec7dd2528986c4fa78113933565a9a1711f4dcf8bed9edd27190aa9f5f04d7df141b0eb1aa65b18b57915061 WHIRLPOOL 249caf55b7a2135e7df5e90c725466c793ceec90aecf1d6b2246a59c83f9f6553c32526514a5fad8361f2f7f4e78a689b2292ce9d5f6637954dc6347458b38bb
+AUX gdb-apple-563-darwin7.patch 3329 SHA256 7d20fb2e241060f220a179a14d14a0062528ddee1ec60ce213ea80a1b85e8921 SHA512 5c12715998a039e114ae214848f4715848c6390f358d140b1886c52fc1ff376f8b26525c19b004ebbbda4c577a5a32d4909642943ceb5394fd8849d131aab626 WHIRLPOOL 69847755e18727d4711dccbda570e7fb01aeb1b822addd11938b44e2eb315e4242c3a64b1ea1f11e5612c50f11b3eb87773e9604d08aac8b20208f5116d697cc
+AUX gdb-apple-563-no-64bit.patch 767 SHA256 3eb672bb4bc08d74f01bd33008140177b9906fc06969852d013ee9440a8d6c97 SHA512 79eb42ca51363276aec1dfc9c2580ad8524c826bcf0a0d2a0128ba671625d5546aad161ad2d368f71b5828b76965a27df0f4e47ab78e3b46c73553168af6b94a WHIRLPOOL f83a53dcaaeea05dc40ceae083a99c0b2acfe34a551875a84fe328182a54b65db3283f90b7ef5e7f54dd53d84a66e424ad1b13c6453f5a598701a500f104ff5a
+AUX gdb-apple-768-darwin-arch.patch 571 SHA256 afd10f60857900824fb36d3109e2c4fa0c87ca95fab1c4411cd8316d3d566ab6 SHA512 5d5345c0b9aab9610bfeb3adf98f92f2d132e198ce69278b8a7e35e59d9b45955b5eabd0cf2e6dd085a034369826804d833ec841726729a1272b06a8d7b8592b WHIRLPOOL 4b0f05cd5a862027e5ec55bd5de402ec1eb7bacf77024a020b4296388abb563ba7900f08b7b868eb3d72a4be1e1682dc6b091d428131b85ef2e0a5aa87521d82
+AUX gdb-apple-768-texinfo.patch 487 SHA256 55d33c8603278687ec92f4b0bdbc7cb8e0b62b2348f1b44ce247d95c7ae14b2d SHA512 fb40c8c713e0cdd34df82b368fbae5b9cc4180a6519f303750d72181dcac31436f947fc01c6949bbfc8bf8a7be4459cb2083e821433c1c4e9a587e2171933b92 WHIRLPOOL c2728b22c83db57dc9c4981d2d7de5d2f5921a4d676a5443d1574fe0a58062fd8ce0af0d90962c0aaa4b58e91ed58299429e9babe2bd2c58c3e9f98632d8b0c5
+AUX gdb-apple-962-darwin64.patch 580 SHA256 016259650cd60b24b4bc39b890f7adec7a0a7c2f028dcc8fae8114d0f36a8676 SHA512 2b940cfef9caeac9aa863ab53349de083026258458321108d54e4605d1030f496701e666a720e530d530ede0db7b59694f3fbc4ab28a6122ca1e28c03bbae8a2 WHIRLPOOL 1f6106a3573467eb6117042559d765a7fbe3737b84923b384f2c44a5cda57473922d62a66f84f9597f7cfedf4b5528a2734e6f1eb1b3253f5c26bd3c7e1d95a7
+AUX gdb-apple-962-darwin8.patch 402 SHA256 885453cb8ea7e39bc5da479ce046e96e113eb150af220b7d61d8f50ebf29d2d6 SHA512 e6c8a48eef811c061e9ec48b4a99f653b6dcfd02d4c4cd7b0135e170eca8240183da563fe62de600156b065f5a74d64fbed84f9c3763324d6697168486750237 WHIRLPOOL 22536511d4226e1c2dd5748a45c924da6d85a0950294e5671b20687318fdfb50a16902362dabbfc31afc13df736c767f41cb02f1dff22eb1c3e60bf391aee5e8
+AUX gdb-apple-962-demangle.patch 708 SHA256 35d10612776db1cae9aca99ba72973ab1c6629dd6a9f1d16f1ec8322684c26ab SHA512 623db08a7c378f2644faf22a41cf57341f9bbecd7ad319e32651a8f4eff2935bb9914443143a749dabf255a1f99dea133daa487dc3192bacc1fc8f7eb088dec4 WHIRLPOOL 35e1f2521c6909d2f78f5c54b1b53da617820327da0fa1277146ea25cc9828f6ffd43bec21e411bdb221def8be7372b51ee5dcd9ec8f3e8a4a03c8aeef23e112
+AUX gdb-apple-no-global-gdbinit.patch 714 SHA256 e89a211394dec0443cc17098ebdf8b2ea513d64ad62bddd39082706902b83683 SHA512 e692621595562f002a8f2d170cf3aed087f09ddb0578e2a8bf4bdac77119ee7c4a921f9d4a10273a3c0b7cbe95299d936c93971b5ff1a73fd528f8d1984f7a4c WHIRLPOOL 55b28fd647ad093c73e738e0cc48aa173622218547624ef3961e8d5c6f57e22d99962c6d30824c06fd44e7a64e6b7d893202ca2f96eb4e71425df8f47e255ce6
+DIST gdb-1461.2.tar.gz 17951571 SHA256 91d8cdbcd9cf36377d9c2d425921141085b5c79a6dce312a3dc0b6960f8e02f9 SHA512 2d8b11ed575e26176a8f93eb7d2fbc052313114ffce10f0da6888ff9e7c30067d4db6d89c9443187bf7167823dfd631a7f56fe718160b5653791080df9b8163d WHIRLPOOL 20f0bcf5d9c7a5f42ff3d46e074ad94ed7bd6c89e61c6887a66b8f04fe5eb7dd3d9adaaaa041af0ef3c5fd236b7c31faa40a51a2f90e6217bec59b56950de929
+DIST gdb-1752.tar.gz 17922994 SHA256 8685227243cedc26954d175f28ed56ba5889410420aa888323e1eeaffb204ccf SHA512 863a861a9a7708b8a763ea93599f6b519277f23fff35700d04e81a7747cc49421d0f051790deb92c440ced30ee15ba719b75066d5a614341e0f0b765d7a81094 WHIRLPOOL f07fd8a5e3e8ed466a5f21df689c4b6b7f7deaafcfdb2a209573a1112c1720c423f87e1b82d559a0616aea0c089966ffe9d30e785112936469394a621c916611
+DIST gdb-768.tar.gz 17727326 SHA256 2342cbbf7c57dcc08011736c9823d5ca374156666ba73c4b67d9984ed944f24d SHA512 40395d2e8ca30bb7aa0bbb0b270cbb9c18decc5a8fb37a764d43770e234b6281528d6feb301bcd97033c624c196851283fdbfc131f0336772a1e6e4b0168ae47 WHIRLPOOL a824e5ff903df33327827545ca8dad0401846f368e6feb3dc1b8fc9d9d2359e37302a6fd2773a6ec09ce7c71cae6082728cb9ee7d62ec28c4ede7f2fe0630c56
+DIST gdb-966.tar.gz 17769429 SHA256 fc51d13dd4153e4ac6140fa5199699dc26387189fb0e37277bb50944410a445f SHA512 daaf6f0329e311d46d82734df87fd501f70281edb511a8eb9123b6288a6a97f84725acc0f1c5e67dee3dc3e00cfa31bf7fc20594fbf3827a0ea35414f5ef7434 WHIRLPOOL acb4fb07806c08f5e58aca3b067226ce789ecd35d77eecda2e12ff757c27f08102ac3bbc4e6cf81dde97e6b112e721a7db178a807ec84a108ccc50772d45a11d
+EBUILD gdb-apple-1461.ebuild 1767 SHA256 38e34227f154ed036815d196e6c6ea0c8ea50cd0e232666890a9e86c7e914a84 SHA512 695a01c6243a5a1aa033cb7e44fd21d9cbd6d0d7761fd476af3af05124323198d5cb712c3d1546068422234d45de6d1958dc8fc9aad10fac40bce4444bdc1226 WHIRLPOOL ff657f09e01d14d7f842139009379d49cfef819e346997bbb6658738a305fcd3cd67a72587d60da25580749883391091c745386d11b7dd1cfc777036c8a2e303
+EBUILD gdb-apple-1752.ebuild 2141 SHA256 f550fceb4e041200a359df3904a89c1e62c929a150a77779fdeeabc61d16ff4a SHA512 b18fb1e49efb63f157cf7fa91ae93cf4f597901278cebd09d1e98e17ea93a9852265694339781a37c279e7451d5625611497542987355adb89ba4b5c6e0865f3 WHIRLPOOL 8f7a0b6e089f5b2a8b5b403534aa9a84a408292c3585d77f895746994324f56c3f8085b98832b90ae3adaf58ad1120ff12be76f34dd241310b4e29d4cd7b1baf
+EBUILD gdb-apple-768-r1.ebuild 1094 SHA256 0f269945cc2d6c66918238a06591af5da519946a8a97a7177ca6e2167be652c3 SHA512 4e8b6d7c5b3c5795ea5bae69db45748223d977c2cf7ee010b2ff710bd488cb032c91c64db2f357c3d614fff5bc2f8adab2c7cea4811becc8ab25f5ca058f63c1 WHIRLPOOL fd67a82fc36d1481b55c28f7b2099b77bc53ecdf155a9801388324d4d753eb6a1410a93e44031f8adcc7bdd5544fda4cf2d2253afa3fb4680135b8350567a181
+EBUILD gdb-apple-966.ebuild 1717 SHA256 c26d84d88fe07f0ada287405447502cab6f1cea7ac143bc9798a6220440ceb5b SHA512 438e7db050233ecaf29dd82fa6f7174734813f49b0556dd55ff86d8b5c4caaebc5cd06e3cf7ff2eb0bc4e1de39cf4cdd4505af80c305ba595a9ead574910c644 WHIRLPOOL 7ff92c7100d92265f117bcf7eec3705b2f3b8de757fa4ea8eee9f4cd52a0fcea1d4122bfb02c1b7e50924168753a7edef6c8108e0d2fd92f141e450d76d81739
+MISC ChangeLog 3992 SHA256 687f0b907e435e6bb4ca1060dd1b1309a47998bc5136e6da38af22147613ccfb SHA512 b804de07543690dd4c91a66b5e1f73561edf66396fcfa0b37572c4a0c200234b432ef4143fb6263ff89720f09922ec696212cb3702b79e83c0a9a98d1e44c13f WHIRLPOOL ad54aa883fb407fb331502db0d61c17e0756e179820ae65704f226ad6cdfea5fa83bfee1c438a0f140add9c428d6a8b1ccdbc08b5ba608219e62afc561ecfb2f
+MISC ChangeLog-2015 6444 SHA256 c4f8c1c6abdde43991696ec2bf888cf426ba009383aab2191b800ca9b70271c2 SHA512 0e9a098f87e7f884700c3cfce4249000e75fda7ce3e043c4905bf9798d97bcf5de3c4877e8887704fb9b3acd44ce9764463c925aca925aea063b76fae570e7ba WHIRLPOOL a59634eeb06c4724e90695368af87e96d21c7682f85ff75e8d760a9117f8266f7c11434bf4e662ad332941a4fd962ae6bfa554593ff389c660801fd8c629c4ae
+MISC metadata.xml 247 SHA256 beb9a5395fe6fcde3c82e31b0cde4a75ea911efb59294b0419f76b71e4518366 SHA512 ae91bc559b2380b04af0bacbaf419deb042e9a9235c596c1afdbbb3933e59ba4f895c6e7ebf8fa4884702d5b39febedfdcce109ab912d6ef4f51b3696bc82c18 WHIRLPOOL b82c282b0539e6427a6d6dc1d6742794f922e0b6276dbc7acb805735d6654c79600eb6f650a9c1e36cd727a63d1f1655d728535082154a218c6fb40c01eb8fe0
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1344-darwin8.patch b/sys-devel/gdb-apple/files/gdb-apple-1344-darwin8.patch
new file mode 100644
index 000000000000..c95f02e0fe2e
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1344-darwin8.patch
@@ -0,0 +1,131 @@
+--- src/gdb/symfile.c.orig 2009-09-25 09:00:15 +0200
++++ src/gdb/symfile.c 2009-09-25 09:00:18 +0200
+@@ -67,7 +67,6 @@
+ #include <ctype.h>
+ #include <time.h>
+ #include <sys/time.h>
+-#include <libgen.h>
+
+ #include <sys/mman.h>
+
+--- src/gdb/utils.c.orig 2009-09-25 09:06:29 +0200
++++ src/gdb/utils.c 2009-09-25 09:46:24 +0200
+@@ -27,7 +27,6 @@
+ #include "gdb_string.h"
+ #include "event-top.h"
+ #include "exceptions.h"
+-#include <execinfo.h>
+
+ #ifdef TUI
+ #include "tui/tui.h" /* For tui_get_command_dimension. */
+@@ -878,6 +877,7 @@
+ target_terminal_ours ();
+ begin_line ();
+
++#if 0
+ /* APPLE LOCAL: Do a stack crawl of how we got here so we're more likely
+ to get useful bug reports. */
+ {
+@@ -886,6 +886,7 @@
+ fprintf (stderr, "gdb stack crawl at point of internal error:\n");
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
+ }
++#endif
+
+ /* Create a string containing the full error/warning message. Need
+ to call query with this full string, as otherwize the reason
+--- src/gdb/remote.c.orig 2009-09-25 09:31:58 +0200
++++ src/gdb/remote.c 2009-09-25 09:48:18 +0200
+@@ -61,7 +61,6 @@
+ #ifdef MACOSX_DYLD
+ #include "macosx-nat-dyld.h"
+ #endif
+-#include <execinfo.h>
+
+ /* Prototypes for local functions. */
+ static void cleanup_sigint_signal_handler (void *dummy);
+@@ -483,10 +482,12 @@
+ static void
+ remote_backtrace_self ()
+ {
++#if 0
+ void *bt_buffer[10];
+ int count = backtrace (bt_buffer, 10);
+ fprintf_filtered (gdb_stderr, "gdb stack crawl at point of invalid hex digit:\n");
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
++#endif
+ }
+
+ static void
+--- src/gdb/macosx/macosx-tdep.c.orig 2009-09-25 09:09:00 +0200
++++ src/gdb/macosx/macosx-tdep.c 2009-09-25 09:09:12 +0200
+@@ -61,7 +61,6 @@
+ #include "exceptions.h"
+
+ #include <dirent.h>
+-#include <libgen.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+--- src/gdb/macosx/macosx-nat-inferior.c.orig 2009-09-25 09:12:44 +0200
++++ src/gdb/macosx/macosx-nat-inferior.c 2009-09-25 09:13:24 +0200
+@@ -62,8 +62,10 @@
+ #include <semaphore.h>
+
+ #include <dlfcn.h>
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-inferior.h"
+@@ -3261,8 +3263,10 @@
+ int_flags |= RTLD_NOLOAD;
+ if (strstr (flags, "RTLD_NODELETE") != NULL)
+ int_flags |= RTLD_NODELETE;
++#ifdef RTLD_FIRST
+ if (strstr (flags, "RTLD_FIRST") != NULL)
+ int_flags |= RTLD_FIRST;
++#endif
+ }
+
+ /* If the user didn't pass in anything, set some sensible defaults. */
+--- src/gdb/macosx/macosx-nat-infthread.c.orig 2009-09-25 09:14:01 +0200
++++ src/gdb/macosx/macosx-nat-infthread.c 2009-09-25 09:14:19 +0200
+@@ -36,8 +36,10 @@
+ #include <sys/dir.h>
+ #include <inttypes.h>
+
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-util.h"
+--- src/gdb/macosx/macosx-nat-info.c.orig 2009-09-25 09:16:50 +0200
++++ src/gdb/macosx/macosx-nat-info.c 2009-09-25 09:31:12 +0200
+@@ -45,6 +45,22 @@
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-debug.h"
+
++#ifdef __ppc__
++#ifndef __darwin_ppc_thread_state
++#define __darwin_ppc_thread_state ppc_thread_state
++#define __r0 r0
++#define __srr0 srr0
++#define __srr1 srr1
++#define __cr cr
++#define __xer xer
++#define __lr lr
++#define __ctr ctr
++#endif
++#ifndef __darwin_ppc_exception_state
++#define __darwin_ppc_exception_state ppc_exception_state
++#endif
++#endif
++
+ extern macosx_inferior_status *macosx_status;
+
+ #define CHECK_ARGS(what, args) \
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1461-darwin8.patch b/sys-devel/gdb-apple/files/gdb-apple-1461-darwin8.patch
new file mode 100644
index 000000000000..40ef761e8f70
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1461-darwin8.patch
@@ -0,0 +1,128 @@
+--- gdb-1461.2/src/gdb/macosx/macosx-nat-inferior.c
++++ gdb-1461.2/src/gdb/macosx/macosx-nat-inferior.c
+@@ -60,13 +60,17 @@
+ #include <sys/sysctl.h>
+ #include <sys/proc.h>
+ #include <mach/mach_error.h>
++#if defined(TARGET_ARM)
+ #include <spawn.h>
++#endif
+
+ #include <semaphore.h>
+
+ #include <dlfcn.h>
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-inferior.h"
+--- gdb-1461.2/src/gdb/macosx/macosx-nat-info.c
++++ gdb-1461.2/src/gdb/macosx/macosx-nat-info.c
+@@ -45,6 +45,22 @@
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-debug.h"
+
++#ifdef __ppc__
++#ifndef __darwin_ppc_thread_state
++#define __darwin_ppc_thread_state ppc_thread_state
++#define __r0 r0
++#define __srr0 srr0
++#define __srr1 srr1
++#define __cr cr
++#define __xer xer
++#define __lr lr
++#define __ctr ctr
++#endif
++#ifndef __darwin_ppc_exception_state
++#define __darwin_ppc_exception_state ppc_exception_state
++#endif
++#endif
++
+ extern macosx_inferior_status *macosx_status;
+
+ #define CHECK_ARGS(what, args) \
+--- gdb-1461.2/src/gdb/macosx/macosx-nat-infthread.c
++++ gdb-1461.2/src/gdb/macosx/macosx-nat-infthread.c
+@@ -36,8 +36,10 @@
+ #include <sys/dir.h>
+ #include <inttypes.h>
+
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-util.h"
+--- gdb-1461.2/src/gdb/macosx/macosx-tdep.c
++++ gdb-1461.2/src/gdb/macosx/macosx-tdep.c
+@@ -63,7 +63,6 @@
+ #include "gdbcore.h"
+
+ #include <dirent.h>
+-#include <libgen.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+--- gdb-1461.2/src/gdb/remote.c
++++ gdb-1461.2/src/gdb/remote.c
+@@ -62,7 +62,6 @@
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-dyld-process.h"
+ #endif
+-#include <execinfo.h>
+
+ /* Prototypes for local functions. */
+ static void cleanup_sigint_signal_handler (void *dummy);
+@@ -474,11 +473,13 @@
+ static void
+ remote_backtrace_self (const char *message)
+ {
++#if 0
+ void *bt_buffer[100];
+ int count = backtrace (bt_buffer, 100);
+ if (message && message[0])
+ fprintf_filtered (gdb_stderr, "%s", message);
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
++#endif
+ }
+
+ static void
+--- gdb-1461.2/src/gdb/symfile.c
++++ gdb-1461.2/src/gdb/symfile.c
+@@ -67,7 +67,6 @@
+ #include <ctype.h>
+ #include <time.h>
+ #include <sys/time.h>
+-#include <libgen.h>
+
+ #include <sys/mman.h>
+
+--- gdb-1461.2/src/gdb/utils.c
++++ gdb-1461.2/src/gdb/utils.c
+@@ -27,7 +27,6 @@
+ #include "gdb_string.h"
+ #include "event-top.h"
+ #include "exceptions.h"
+-#include <execinfo.h>
+
+ #ifdef TUI
+ #include "tui/tui.h" /* For tui_get_command_dimension. */
+@@ -874,6 +873,7 @@
+ target_terminal_ours ();
+ begin_line ();
+
++#if 0
+ /* APPLE LOCAL: Do a stack crawl of how we got here so we're more likely
+ to get useful bug reports. */
+ {
+@@ -882,6 +882,7 @@
+ fprintf (stderr, "gdb stack crawl at point of internal error:\n");
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
+ }
++#endif
+
+ /* Create a string containing the full error/warning message. Need
+ to call query with this full string, as otherwize the reason
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1461-dyld-info.patch b/sys-devel/gdb-apple/files/gdb-apple-1461-dyld-info.patch
new file mode 100644
index 000000000000..75b910432278
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1461-dyld-info.patch
@@ -0,0 +1,22 @@
+If dyld-info is not available, don't try to compile unreachable code
+using it either.
+
+--- gdb-1461.2/src/gdb/macosx/macosx-nat-dyld.c
++++ gdb-1461.2/src/gdb/macosx/macosx-nat-dyld.c
+@@ -731,7 +731,7 @@
+ {
+ #if !defined (TASK_DYLD_INFO) || !defined (NM_NEXTSTEP)
+ return 0;
+-#endif
++#else
+
+ if (target_is_remote () || value == NULL)
+ return 0;
+@@ -791,6 +791,7 @@
+ }
+ #endif /* NM_NEXTSTEP */
+ return 0;
++#endif
+ }
+
+ /* Searches the target address space for dyld itself, returning it in
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8-9.patch b/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8-9.patch
new file mode 100644
index 000000000000..a05169cec25d
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8-9.patch
@@ -0,0 +1,87 @@
+--- src/gdb/macosx/macosx-nat-dyld.c
++++ src/gdb/macosx/macosx-nat-dyld.c
+@@ -2083,7 +2083,9 @@
+ case MH_DYLIB:
+ case MH_DYLINKER:
+ case MH_BUNDLE:
++#ifdef MH_KEXT_BUNDLE
+ case MH_KEXT_BUNDLE:
++#endif
+ break;
+ case MH_FVMLIB:
+ case MH_PRELOAD:
+@@ -2412,7 +2414,9 @@
+ break;
+ case MH_DYLINKER:
+ case MH_BUNDLE:
++#ifdef MH_KEXT_BUNDLE
+ case MH_KEXT_BUNDLE:
++#endif
+ entry->reason = dyld_reason_dyld;
+ break;
+ default:
+--- src/gdb/macosx/macosx-nat-dyld-process.c
++++ src/gdb/macosx/macosx-nat-dyld-process.c
+@@ -407,7 +407,9 @@
+ case MH_DYLIB:
+ break;
+ case MH_BUNDLE:
++#ifdef MH_KEXT_BUNDLE
+ case MH_KEXT_BUNDLE:
++#endif
+ break;
+ default:
+ return;
+ return;
+--- src/gdb/macosx/macosx-nat-inferior.c
++++ src/gdb/macosx/macosx-nat-inferior.c
+@@ -2692,6 +2692,7 @@
+ if (tp->private == NULL || tp->private->app_thread_port == 0)
+ return NULL;
+
++#ifdef THREAD_IDENTIFIER_INFO_COUNT
+ thread_identifier_info_data_t tident;
+ unsigned int info_count;
+ kern_return_t kret;
+@@ -2719,6 +2720,7 @@
+ }
+ }
+ }
++#endif
+ return buf;
+ }
+
+--- src/gdb/macosx/macosx-nat-infthread.c
++++ src/gdb/macosx/macosx-nat-infthread.c
+@@ -809,6 +809,7 @@
+ print_stack_frame (get_selected_frame (NULL), 0, LOCATION);
+ switch_to_thread (current_ptid);
+
++#ifdef THREAD_IDENTIFIER_INFO_COUNT
+ thread_identifier_info_data_t tident;
+ info_count = THREAD_IDENTIFIER_INFO_COUNT;
+ kret = thread_info (tid, THREAD_IDENTIFIER_INFO, (thread_info_t) &tident,
+@@ -878,6 +879,7 @@
+ printf_filtered ("\tcurrent priority: %d\n", pth.pth_priority);
+ printf_filtered ("\tmax priority: %d\n", pth.pth_maxpriority);
+ }
++#endif
+
+ printf_filtered ("\tsuspend count: %d", info.suspend_count);
+
+@@ -1175,6 +1177,7 @@
+ ui_out_field_fmt (uiout, "mach-port-number", "0x%s",
+ paddr_nz (app_thread_name));
+
++#ifdef THREAD_IDENTIFIER_INFO_COUNT
+ thread_identifier_info_data_t tident;
+ info_count = THREAD_IDENTIFIER_INFO_COUNT;
+ kret = thread_info (tid, THREAD_IDENTIFIER_INFO, (thread_info_t) &tident,
+@@ -1207,6 +1210,7 @@
+ paddr_nz (struct_addr));
+ }
+ }
++#endif
+ }
+
+
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8.patch b/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8.patch
new file mode 100644
index 000000000000..f8ecc30be7f6
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1518-darwin8.patch
@@ -0,0 +1,128 @@
+--- src/gdb/macosx/macosx-nat-inferior.c
++++ src/gdb/macosx/macosx-nat-inferior.c
+@@ -60,13 +60,17 @@
+ #include <sys/sysctl.h>
+ #include <sys/proc.h>
+ #include <mach/mach_error.h>
++#if defined(TARGET_ARM)
+ #include <spawn.h>
++#endif
+
+ #include <semaphore.h>
+
+ #include <dlfcn.h>
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-inferior.h"
+--- src/gdb/macosx/macosx-nat-info.c
++++ src/gdb/macosx/macosx-nat-info.c
+@@ -45,6 +45,22 @@
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-debug.h"
+
++#ifdef __ppc__
++#ifndef __darwin_ppc_thread_state
++#define __darwin_ppc_thread_state ppc_thread_state
++#define __r0 r0
++#define __srr0 srr0
++#define __srr1 srr1
++#define __cr cr
++#define __xer xer
++#define __lr lr
++#define __ctr ctr
++#endif
++#ifndef __darwin_ppc_exception_state
++#define __darwin_ppc_exception_state ppc_exception_state
++#endif
++#endif
++
+ extern macosx_inferior_status *macosx_status;
+
+ #define CHECK_ARGS(what, args) \
+--- src/gdb/macosx/macosx-nat-infthread.c
++++ src/gdb/macosx/macosx-nat-infthread.c
+@@ -36,8 +36,10 @@
+ #include <sys/dir.h>
+ #include <inttypes.h>
+
++#if 0
+ #include <libproc.h>
+ #include <sys/proc_info.h>
++#endif
+
+ #include "macosx-nat-inferior.h"
+ #include "macosx-nat-inferior-util.h"
+--- src/gdb/macosx/macosx-tdep.c
++++ src/gdb/macosx/macosx-tdep.c
+@@ -64,7 +64,6 @@
+ #include "gdbcore.h"
+
+ #include <dirent.h>
+-#include <libgen.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+--- src/gdb/remote.c
++++ src/gdb/remote.c
+@@ -63,7 +63,6 @@
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-dyld-process.h"
+ #endif
+-#include <execinfo.h>
+
+ /* Prototypes for local functions. */
+ static void cleanup_sigint_signal_handler (void *dummy);
+@@ -475,11 +474,13 @@
+ static void
+ remote_backtrace_self (const char *message)
+ {
++#if 0
+ void *bt_buffer[100];
+ int count = backtrace (bt_buffer, 100);
+ if (message && message[0])
+ fprintf_filtered (gdb_stderr, "%s", message);
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
++#endif
+ }
+
+ static void
+--- src/gdb/symfile.c
++++ src/gdb/symfile.c
+@@ -67,7 +67,6 @@
+ #include <ctype.h>
+ #include <time.h>
+ #include <sys/time.h>
+-#include <libgen.h>
+
+ #include <sys/mman.h>
+
+--- src/gdb/utils.c
++++ src/gdb/utils.c
+@@ -28,7 +28,6 @@
+ #include "event-top.h"
+ #include "exceptions.h"
+ #include "bfd.h"
+-#include <execinfo.h>
+ #include <sys/resource.h>
+ #include <uuid/uuid.h>
+
+@@ -879,6 +878,7 @@
+ target_terminal_ours ();
+ begin_line ();
+
++#if 0
+ /* APPLE LOCAL: Do a stack crawl of how we got here so we're more likely
+ to get useful bug reports. */
+ {
+@@ -887,6 +887,7 @@
+ fprintf (stderr, "gdb stack crawl at point of internal error:\n");
+ backtrace_symbols_fd (bt_buffer, count, STDERR_FILENO);
+ }
++#endif
+
+ /* Create a string containing the full error/warning message. Need
+ to call query with this full string, as otherwize the reason
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1518-task_dyld_info.patch b/sys-devel/gdb-apple/files/gdb-apple-1518-task_dyld_info.patch
new file mode 100644
index 000000000000..633a36a7a048
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1518-task_dyld_info.patch
@@ -0,0 +1,22 @@
+If dyld-info is not available, don't try to compile unreachable code
+using it either.
+
+--- gdb-1518/src/gdb/macosx/macosx-nat-dyld.c
++++ gdb-1518/src/gdb/macosx/macosx-nat-dyld.c
+@@ -779,7 +779,7 @@
+ {
+ #if !defined (TASK_DYLD_INFO)
+ return 0;
+-#endif
++#else
+ if (macosx_status->task == TASK_NULL)
+ return 0;
+
+@@ -799,6 +799,7 @@
+ task_dyld_info.all_image_info_size == 0)
+ return 0;
+ s->dyld_image_infos = task_dyld_info.all_image_info_addr;
++#endif /* TASK_DYLD_INFO */
+ }
+ #endif /* NM_NEXTSTEP */
+
diff --git a/sys-devel/gdb-apple/files/gdb-apple-1705-darwin8-10.patch b/sys-devel/gdb-apple/files/gdb-apple-1705-darwin8-10.patch
new file mode 100644
index 000000000000..32247431fe89
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-1705-darwin8-10.patch
@@ -0,0 +1,11 @@
+--- src/gdb/macosx/macosx-nat-dyld.c
++++ src/gdb/macosx/macosx-nat-dyld.c
+@@ -788,7 +788,7 @@
+ }
+ else
+ {
+-#if defined (NM_NEXTSTEP)
++#if defined (NM_NEXTSTEP) && defined(TASK_DYLD_INFO_COUNT)
+ if (macosx_status->task == TASK_NULL)
+ return 0;
+
diff --git a/sys-devel/gdb-apple/files/gdb-apple-563-darwin7.patch b/sys-devel/gdb-apple/files/gdb-apple-563-darwin7.patch
new file mode 100644
index 000000000000..bd5061d41fc0
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-563-darwin7.patch
@@ -0,0 +1,110 @@
+* Fabian Groffen <grobian@gentoo.org>
+ Mac OS X Panther (10.3) doesn't have mach_vm_size_t yet, and
+ apparently this was forseen in macosx-nat-inferior-debug.c. However,
+ macosx-nat-inferior-debug.h also uses the provided types, hence we
+ move the backwards-compatibility logic to the .h file.
+
+* Fabian Groffen <grobian@gentoo.org>
+ On Mac OS X Panther (10.3) an older version of the Launch Services is
+ available, which doesn't cover the requirements made by Xcode here.
+ Because it's for Xcode only, and we don't use it on Gentoo, we just
+ enable the functionality that doesn't compile on 10.3.
+
+--- gdb/macosx/macosx-nat-inferior-debug.c
++++ gdb/macosx/macosx-nat-inferior-debug.c
+@@ -53,24 +53,6 @@
+
+ #include <AvailabilityMacros.h>
+
+-#define MACH64 (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+-
+-#if MACH64
+-
+-#include <mach/mach_vm.h>
+-
+-#else /* ! MACH64 */
+-
+-#define mach_vm_size_t vm_size_t
+-#define mach_vm_address_t vm_address_t
+-#define mach_vm_read vm_read
+-#define mach_vm_write vm_write
+-#define mach_vm_region vm_region
+-#define VM_REGION_BASIC_INFO_COUNT_64 VM_REGION_BASIC_INFO_COUNT
+-#define VM_REGION_BASIC_INFO_64 VM_REGION_BASIC_INFO
+-
+-#endif /* MACH64 */
+-
+ FILE *inferior_stderr = NULL;
+ int inferior_debug_flag = 0;
+ int timestamps_debug_flag = 0;
+--- gdb/macosx/macosx-nat-inferior-debug.h
++++ gdb/macosx/macosx-nat-inferior-debug.h
+@@ -6,6 +6,24 @@
+
+ #include "defs.h"
+
++#define MACH64 (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
++
++#if MACH64
++
++#include <mach/mach_vm.h>
++
++#else /* ! MACH64 */
++
++#define mach_vm_size_t vm_size_t
++#define mach_vm_address_t vm_address_t
++#define mach_vm_read vm_read
++#define mach_vm_write vm_write
++#define mach_vm_region vm_region
++#define VM_REGION_BASIC_INFO_COUNT_64 VM_REGION_BASIC_INFO_COUNT
++#define VM_REGION_BASIC_INFO_64 VM_REGION_BASIC_INFO
++
++#endif /* MACH64 */
++
+ extern FILE *inferior_stderr;
+ extern int inferior_debug_flag;
+
+--- gdb/macosx/macosx-tdep.c
++++ gdb/macosx/macosx-tdep.c
+@@ -413,6 +413,7 @@
+ } BabelAESelInfo;
+ #pragma options align=reset
+
++#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+ static int
+ open_file_with_LS (const char *file_path, int lineno)
+ {
+@@ -538,7 +539,9 @@
+
+ return 1;
+ }
++#endif
+
++#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+ /* Opens the file pointed to in ARGS with the default editor
+ given by LaunchServices. If ARGS is NULL, opens the current
+ source file & line. You can also supply file:line and it will
+@@ -609,6 +612,7 @@
+
+ open_file_with_LS (filename, line_no);
+ }
++#endif
+
+ void
+ _initialize_macosx_tdep ()
+@@ -618,13 +622,15 @@
+
+ add_info ("trampoline", info_trampoline_command,
+ "Resolve function for DYLD trampoline stub and/or Objective-C call");
++#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1040)
+ c = add_com ("open", class_support, open_command, _("\
+ Open the named source file in an application determined by LaunchServices.\n\
+ With no arguments, open the currently selected source file.\n\
+ Also takes file:line to hilight the file at the given line."));
+ set_cmd_completer (c, filename_completer);
+ add_com_alias ("op", "open", class_support, 1);
+ add_com_alias ("ope", "open", class_support, 1);
++#endif
+
+ add_com ("flushstack", class_maintenance, stack_flush_command,
+ "Force gdb to flush its stack-frame cache (maintainer command)");
diff --git a/sys-devel/gdb-apple/files/gdb-apple-563-no-64bit.patch b/sys-devel/gdb-apple/files/gdb-apple-563-no-64bit.patch
new file mode 100644
index 000000000000..952f5b337871
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-563-no-64bit.patch
@@ -0,0 +1,19 @@
+* Fabian Groffen <grobian@gentoo.org>
+ On Gentoo, when the user doesn't have a 64-bits capable CPU, we
+ compile GCC without multi-lib support. Hence, 64-bits defines are not
+ available so we better not use them if we don't have __ppc64__
+ defined.
+
+--- gdb/macosx/macosx-nat-dyld.c
++++ gdb/macosx/macosx-nat-dyld.c
+@@ -619,8 +619,10 @@
+ structures. */
+ if (header.cputype == CPU_TYPE_POWERPC || header.cputype == CPU_TYPE_I386)
+ osabi_seen_in_attached_dyld = GDB_OSABI_DARWIN;
++#if defined(__ppc64__)
+ if (header.cputype == CPU_TYPE_POWERPC64 || header.cputype == GDB_CPU_TYPE_X86_64)
+ osabi_seen_in_attached_dyld = GDB_OSABI_DARWIN64;
++#endif
+ }
+
+ /* Once we know the address at which dyld was loaded, we can try to
diff --git a/sys-devel/gdb-apple/files/gdb-apple-768-darwin-arch.patch b/sys-devel/gdb-apple/files/gdb-apple-768-darwin-arch.patch
new file mode 100644
index 000000000000..5442ba8ba636
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-768-darwin-arch.patch
@@ -0,0 +1,15 @@
+* configure checks for /usr/bin/arch to determine whether "arch" is ok
+ to use, so don't rely on the path at runtime, since GNU arch doesn't
+ understand -arch at all (and only returns the current arch name)
+
+--- src/gdb/fork-child.c
++++ src/gdb/fork-child.c
+@@ -243,7 +243,7 @@
+ arch_string = "x86_64";
+ #endif
+ if (arch_string != NULL)
+- sprintf (shell_command, "%s exec arch -arch %s ", shell_command, arch_string);
++ sprintf (shell_command, "%s exec /usr/bin/arch -arch %s ", shell_command, arch_string);
+ else
+ strcat (shell_command, "exec ");
+ }
diff --git a/sys-devel/gdb-apple/files/gdb-apple-768-texinfo.patch b/sys-devel/gdb-apple/files/gdb-apple-768-texinfo.patch
new file mode 100644
index 000000000000..41153d8436de
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-768-texinfo.patch
@@ -0,0 +1,10 @@
+--- src/Makefile.in
++++ src/Makefile.in
+@@ -280,6 +280,6 @@
+ then echo $$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo ; \
+ else if (${CONFIGURED_MAKEINFO} --version \
+- | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; \
++ | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|4\.[1-9][0-9]|[5-9])') >/dev/null 2>&1; \
+ then echo ${CONFIGURED_MAKEINFO}; else echo $$s/missing makeinfo; fi; fi`
+
+ # This just becomes part of the MAKEINFO definition passed down to
diff --git a/sys-devel/gdb-apple/files/gdb-apple-962-darwin64.patch b/sys-devel/gdb-apple/files/gdb-apple-962-darwin64.patch
new file mode 100644
index 000000000000..4417cee76e4d
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-962-darwin64.patch
@@ -0,0 +1,17 @@
+* todo: extend for powerpc64 also
+
+--- src/bfd/config.bfd.orig 2009-06-23 11:05:43 +0200
++++ src/bfd/config.bfd 2009-06-23 11:05:47 +0200
+@@ -500,6 +500,12 @@
+ targ_archs="bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
+ targ_underscore=yes
+ ;;
++ x86_64-*-darwin*)
++ targ_defvec=mach_o_le_vec
++ targ_selvecs="mach_o_le_vec mach_o_be_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
++ targ_archs="bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
++ targ_underscore=yes
++ ;;
+ i[3-7]86-sequent-bsd*)
+ targ_defvec=i386dynix_vec
+ targ_underscore=yes
diff --git a/sys-devel/gdb-apple/files/gdb-apple-962-darwin8.patch b/sys-devel/gdb-apple/files/gdb-apple-962-darwin8.patch
new file mode 100644
index 000000000000..05a088b93fb3
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-962-darwin8.patch
@@ -0,0 +1,15 @@
+* 10.4 doesn't have posix spawn, but fortunately it's only used on ARM
+ (iPhone), so we can still compile it
+
+--- src/gdb/macosx/macosx-nat-inferior.c
++++ src/gdb/macosx/macosx-nat-inferior.c
+@@ -58,7 +58,9 @@
+ #include <sys/sysctl.h>
+ #include <sys/proc.h>
+ #include <mach/mach_error.h>
++#ifdef TARGET_ARM
+ #include <spawn.h>
++#endif
+
+ #include "macosx-nat-dyld.h"
+ #include "macosx-nat-inferior.h"
diff --git a/sys-devel/gdb-apple/files/gdb-apple-962-demangle.patch b/sys-devel/gdb-apple/files/gdb-apple-962-demangle.patch
new file mode 100644
index 000000000000..a302ce56ec91
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-962-demangle.patch
@@ -0,0 +1,22 @@
+in 32-bits mode this goes /just/ right, in 64-bits mode Portage aborts
+because objc_demangle is implicitly turned into a pointer
+
+--- src/gdb/maint.c.orig 2009-06-23 11:12:15 +0200
++++ src/gdb/maint.c 2009-06-23 11:19:58 +0200
+@@ -31,6 +31,7 @@
+ #include "symtab.h"
+ #include "gdbtypes.h"
+ #include "demangle.h"
++#include "objc-lang.h"
+ #include "gdbcore.h"
+ #include "expression.h" /* For language.h */
+ #include "language.h"
+@@ -167,7 +168,7 @@
+ switch (current_language->la_language)
+ {
+ case language_objc:
+- demangled = objc_demangle (args);
++ demangled = objc_demangle (args, 0);
+ break;
+ case language_objcplus:
+ case language_cplus:
diff --git a/sys-devel/gdb-apple/files/gdb-apple-no-global-gdbinit.patch b/sys-devel/gdb-apple/files/gdb-apple-no-global-gdbinit.patch
new file mode 100644
index 000000000000..0c132ec5b384
--- /dev/null
+++ b/sys-devel/gdb-apple/files/gdb-apple-no-global-gdbinit.patch
@@ -0,0 +1,23 @@
+Sourcing /etc/gdb.conf is annoying mainly because Apple put
+ set history save on
+in there, which means everywhere you run it, you end up with a
+.gdb_history file.
+
+--- src/gdb/main.c
++++ src/gdb/main.c
+@@ -675,6 +675,7 @@
+ memset (&cwdbuf, 0, sizeof (struct stat));
+ /* APPLE LOCAL end move inits up */
+ /* APPLE LOCAL begin global gdbinit */
++#ifdef WANT_GLOBAL_GDBINIT
+ memset (&globalbuf, 0, sizeof (struct stat));
+ stat (gdbinit_global, &globalbuf);
+ if (!inhibit_gdbinit)
+@@ -683,6 +684,7 @@
+ source_file (gdbinit_global, 0);
+ }
+ do_cleanups (ALL_CLEANUPS);
++#endif
+ /* APPLE LOCAL end global gdbinit */
+
+ /* APPLE LOCAL: Set the $_Xcode convenience variable at '0' before sourcing
diff --git a/sys-devel/gdb-apple/gdb-apple-1461.ebuild b/sys-devel/gdb-apple/gdb-apple-1461.ebuild
new file mode 100644
index 000000000000..39484c62c317
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-1461.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit eutils flag-o-matic
+
+APPLE_PV=${PV}.2
+DESCRIPTION="Apple branch of the GNU Debugger, Developer Tools 3.2.2"
+HOMEPAGE="https://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${APPLE_PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${APPLE_PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-no-global-gdbinit.patch
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ epatch "${FILESDIR}"/${P}-dyld-info.patch
+ [[ ${CHOST} == *-darwin8 ]] && epatch "${FILESDIR}"/${P}-darwin8.patch
+
+ # for FSF gcc / gcc-apple:42
+ sed -e 's/-Wno-long-double//' -i gdb/config/*/macosx.mh
+
+ eapply_user
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ --disable-debug-symbols-framework \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -R "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ ewarn "Due to increased security measures in 10.5 and up, gdb is"
+ ewarn "not able to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-1752.ebuild b/sys-devel/gdb-apple/gdb-apple-1752.ebuild
new file mode 100644
index 000000000000..6a6d6a5c511c
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-1752.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit eutils flag-o-matic
+
+APPLE_PV=${PV}
+DESCRIPTION="Apple branch of the GNU Debugger, Developer Tools 4.3"
+HOMEPAGE="https://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${APPLE_PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${APPLE_PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-no-global-gdbinit.patch
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ epatch "${FILESDIR}"/${PN}-1518-darwin8-9.patch
+ epatch "${FILESDIR}"/${PN}-1705-darwin8-10.patch
+ [[ ${CHOST} == *-darwin8 ]] && epatch "${FILESDIR}"/${PN}-1518-darwin8.patch
+
+ eapply_user
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ --disable-debug-symbols-framework \
+ $(use_enable nls) \
+ || die
+}
+
+src_compile() {
+ # unable to work around parallel make issue
+ emake -j2 || die
+}
+
+src_install() {
+ emake -j2 DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -R "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ ewarn "Due to increased security measures in 10.5 and up, gdb is"
+ ewarn "not able to get a mach task port when installed by Prefix"
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll"
+ ewarn "have to perform the following steps:"
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+ if use x86-macos || use x64-macos ; then
+ einfo "FSF gdb works on Intel-based OSX platforms, sometimes even"
+ einfo "better than gdb-apple. You can consider installing FSF gdb"
+ einfo "instead of gdb-apple, since the FSF version is surely more"
+ einfo "advanced than this old 6.8 version modified by Apple."
+ fi
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-768-r1.ebuild b/sys-devel/gdb-apple/gdb-apple-768-r1.ebuild
new file mode 100644
index 000000000000..1206ecb0b60a
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-768-r1.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Apple branch of the GNU Debugger, 10.5"
+HOMEPAGE="https://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-texinfo.patch
+ epatch "${FILESDIR}"/${P}-darwin-arch.patch
+
+ # for FSF gcc / gcc-apple:42
+ sed -e 's/-Wno-long-double//' -i gdb/config/*/macosx.mh
+
+ eapply_user
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -r "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
diff --git a/sys-devel/gdb-apple/gdb-apple-966.ebuild b/sys-devel/gdb-apple/gdb-apple-966.ebuild
new file mode 100644
index 000000000000..15017df485c8
--- /dev/null
+++ b/sys-devel/gdb-apple/gdb-apple-966.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="Apple branch of the GNU Debugger, Developer Tools 3.1.3"
+HOMEPAGE="https://sourceware.org/gdb/"
+SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gdb-${PV}.tar.gz"
+
+LICENSE="APSL-2 GPL-2"
+SLOT="0"
+
+KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
+
+IUSE="nls"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r2
+ =dev-db/sqlite-3*"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/gdb-${PV}/src
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-768-texinfo.patch
+ epatch "${FILESDIR}"/${PN}-768-darwin-arch.patch
+ epatch "${FILESDIR}"/${PN}-962-darwin8.patch
+ epatch "${FILESDIR}"/${PN}-962-darwin64.patch
+ epatch "${FILESDIR}"/${PN}-962-demangle.patch
+
+ # for FSF gcc / gcc-apple:42
+ sed -e 's/-Wno-long-double//' -i gdb/config/*/macosx.mh
+
+ eapply_user
+}
+
+src_configure() {
+ replace-flags -O? -O2
+ econf \
+ --disable-werror \
+ $(use_enable nls) \
+ || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" libdir=/nukeme includedir=/nukeme install || die
+ rm -R "${D}"/nukeme || die
+ rm -Rf "${ED}"/usr/${CHOST} || die
+ mv "${ED}"/usr/bin/gdb "${ED}"/
+ rm -f "${ED}"/usr/bin/*
+ mv "${ED}"/gdb "${ED}"/usr/bin/
+}
+
+pkg_postinst() {
+ if [[ ${CHOST} == *-darwin* && ${CHOST#*-darwin} -ge 9 ]] ; then
+ elog "Due to increased security measures in 10.5 and up, gdb is"
+ elog "not able to get a mach task port when installed by Prefix"
+ elog "Portage, unprivileged. To make gdb fully functional you'll"
+ elog "have to perform the following steps:"
+ elog " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb"
+ elog " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb"
+ fi
+}
diff --git a/sys-devel/gdb-apple/metadata.xml b/sys-devel/gdb-apple/metadata.xml
new file mode 100644
index 000000000000..0c982d881307
--- /dev/null
+++ b/sys-devel/gdb-apple/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>prefix@gentoo.org</email>
+ <name>Gentoo Prefix</name>
+ </maintainer>
+</pkgmetadata>