{"action":"created","issue":{"url":"https://api.github.com/repos/Homebrew/homebrew-core/issues/35419","repository_url":"https://api.github.com/repos/Homebrew/homebrew-core","labels_url":"https://api.github.com/repos/Homebrew/homebrew-core/issues/35419/labels{/name}","comments_url":"https://api.github.com/repos/Homebrew/homebrew-core/issues/35419/comments","events_url":"https://api.github.com/repos/Homebrew/homebrew-core/issues/35419/events","html_url":"https://github.com/Homebrew/homebrew-core/pull/35419","id":393910358,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwNzk3MDI1","number":35419,"title":"gdb 8.2.1","user":{"login":"Moisan","id":31669,"node_id":"MDQ6VXNlcjMxNjY5","avatar_url":"https://avatars3.githubusercontent.com/u/31669?v=4","gravatar_id":"","url":"https://api.github.com/users/Moisan","html_url":"https://github.com/Moisan","followers_url":"https://api.github.com/users/Moisan/followers","following_url":"https://api.github.com/users/Moisan/following{/other_user}","gists_url":"https://api.github.com/users/Moisan/gists{/gist_id}","starred_url":"https://api.github.com/users/Moisan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Moisan/subscriptions","organizations_url":"https://api.github.com/users/Moisan/orgs","repos_url":"https://api.github.com/users/Moisan/repos","events_url":"https://api.github.com/users/Moisan/events{/privacy}","received_events_url":"https://api.github.com/users/Moisan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-12-24T16:55:53Z","updated_at":"2019-01-05T21:41:35Z","closed_at":"2018-12-26T16:45:15Z","author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/Homebrew/homebrew-core/pulls/35419","html_url":"https://github.com/Homebrew/homebrew-core/pull/35419","diff_url":"https://github.com/Homebrew/homebrew-core/pull/35419.diff","patch_url":"https://github.com/Homebrew/homebrew-core/pull/35419.patch"},"body":"Created with `brew bump-formula-pr`.\n"},"comment":{"url":"https://api.github.com/repos/Homebrew/homebrew-core/issues/comments/451692800","html_url":"https://github.com/Homebrew/homebrew-core/pull/35419#issuecomment-451692800","issue_url":"https://api.github.com/repos/Homebrew/homebrew-core/issues/35419","id":451692800,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTY5MjgwMA==","user":{"login":"kemlath","id":13645109,"node_id":"MDQ6VXNlcjEzNjQ1MTA5","avatar_url":"https://avatars0.githubusercontent.com/u/13645109?v=4","gravatar_id":"","url":"https://api.github.com/users/kemlath","html_url":"https://github.com/kemlath","followers_url":"https://api.github.com/users/kemlath/followers","following_url":"https://api.github.com/users/kemlath/following{/other_user}","gists_url":"https://api.github.com/users/kemlath/gists{/gist_id}","starred_url":"https://api.github.com/users/kemlath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kemlath/subscriptions","organizations_url":"https://api.github.com/users/kemlath/orgs","repos_url":"https://api.github.com/users/kemlath/repos","events_url":"https://api.github.com/users/kemlath/events{/privacy}","received_events_url":"https://api.github.com/users/kemlath/received_events","type":"User","site_admin":false},"created_at":"2019-01-05T21:41:35Z","updated_at":"2019-01-05T21:41:35Z","author_association":"NONE","body":"I finally got a working gdb version under Mojave. No more need for sudo or password entry to debug your code.\r\nWhat I'm describing here is not a home-brew solution but a working gdb under Mojave none the  less.\r\nIf like me you'r hard pressed to have  gdb under Mojave this should be of help.\r\n\r\nIt seems that the most current version rom today 5.1.2019 of gdb fixes things. There are still some minor compile issues and intricacies with regard to signing it under Mojave (entitlements and such) but all this is explained in great detail below.\r\n\r\n1.) Download ftp://sourceware.org/pub/gdb/snapshots/current/gdb-8.2.50.20190105.tar.xz\r\n\r\n2.) Build using GCC-8 and G++-8 NOT CLANG:\r\nCC=gcc-8 CXX=g++-8 ./configure --prefix=/usr/local/opt/gdb/ --disable-debug --disable-dependency-tracking --enable-targets=all --with-python=/usr\r\n\r\n3.) Codesign it with the right! entitlements (assuming gdb_cert is a valid code sig):\r\n\r\ncodesign --entitlements gdb.xml -fs gdb_cert /usr/local/opt/gdb/bin/gdb\r\n\r\nImportant \"gdb_cert\" has to be a valid code signing cert from the SYSTEM keychain (login keychain won't do)\r\n\r\nThe entitlements in gdb.xml look like:\r\n\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\r\n<plist version=\"1.0\">\r\n<dict>\r\n    <key>com.apple.security.cs.allow-jit</key>\r\n    <true/>\r\n    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>\r\n    <true/>\r\n    <key>com.apple.security.cs.allow-dyld-environment-variables</key>\r\n    <true/>\r\n    <key>com.apple.security.cs.disable-library-validation</key>\r\n    <true/>\r\n    <key>com.apple.security.cs.disable-executable-page-protection</key>\r\n    <true/>\r\n    <key>com.apple.security.cs.debugger</key>\r\n    <true/>\r\n\r\n\r\n    <key>com.apple.security.get-task-allow</key>\r\n    <true/>\r\n\r\n\r\n</dict>\r\n</plist>\r\n\r\nNot sure if all of them are needed...\r\nI stumbled upon the need for entitlement \"com.apple.security.cs.debugger\" while googling\r\nand ended up adding putting all of them in there in my despair.\r\n\r\nYou can check the entitlements via\r\n\r\ncodesign -d --entitlements - /usr/local/opt/gdb/bin/gdb\r\n\r\n3.) Maybe optionally call (didn't help with gdb 8.2.1 form homebrew)\r\n\r\nDevToolsSecurity -enable\r\n\r\n4.) Maybe optionally call (didn't help on Mojave with gdb 8.2.1 form homebrew but was nescessary under el Capitan)\r\n\r\nsudo dseditgroup -o edit -a <your user name> -t user procmod\r\nWhich adds you to group procmod.\r\nIt's just because only users in procmod can use function task_for_pid\r\n\r\n5.) Enjoy ;)\r\n\r\nCaveats:\r\n\r\nThe compile initially fails because of some problems in gb/darwin-nat.c\r\n(some variables are double defined and that make gcc fail)\r\n\r\nPatch darwin-nat.c as below to get rid of some compiler errors\r\n\r\n--- ./gdb-8.2.50_working/gdb/darwin-nat.c\t2019-01-05 19:51:48.000000000 +0100\r\n+++ ./gdb-8.2.50.20190105/gdb/darwin-nat.c\t2019-01-05 02:49:08.000000000 +0100\r\n@@ -687,7 +687,7 @@\r\n       /* Not a known inferior.  This could happen if the child fork, as\r\n \t the created process will inherit its exception port.\r\n \t FIXME: should the exception port be restored ?  */\r\n-      // kern_return_t kret;\r\n+      kern_return_t kret;\r\n       mig_reply_error_t reply;\r\n\r\n       inferior_debug\r\n@@ -1125,14 +1125,14 @@\r\n\r\n \t  if (!priv->no_ptrace)\r\n \t    {\r\n-\t      pid_t pid_res;\r\n+\t      pid_t res;\r\n \t      int wstatus;\r\n\r\n-\t      pid_res = wait4 (inf->pid, &wstatus, 0, NULL);\r\n-\t      if (pid_res < 0 || pid_res != inf->pid)\r\n+\t      res = wait4 (inf->pid, &wstatus, 0, NULL);\r\n+\t      if (res < 0 || res != inf->pid)\r\n \t\t{\r\n \t\t  printf_unfiltered (_(\"wait4: res=%d: %s\\n\"),\r\n-\t\t\t\t     pid_res, safe_strerror (errno));\r\n+\t\t\t\t     res, safe_strerror (errno));\r\n \t\t  status->kind = TARGET_WAITKIND_IGNORE;\r\n \t\t  return minus_one_ptid;\r\n \t\t}\r\n@@ -1148,7 +1148,7 @@\r\n \t\t}\r\n\r\n \t      inferior_debug (4, _(\"darwin_wait: pid=%d exit, status=0x%x\\n\"),\r\n-\t\t\t      pid_res, wstatus);\r\n+\t\t\t      res, wstatus);\r\n\r\n \t      /* Looks necessary on Leopard and harmless...  */\r\n \t      wait4 (inf->pid, &wstatus, 0, NULL);\r\n@@ -1559,7 +1559,7 @@\r\n          signaled thus darwin_decode_message function knows that the kill\r\n          signal was sent by gdb and will take the appropriate action\r\n          (cancel signal and reply to the signal message).  */\r\n-      priv = get_darwin_inferior (inf);\r\n+      darwin_inferior *priv = get_darwin_inferior (inf);\r\n       for (darwin_thread_t *thread : priv->threads)\r\n         thread->signaled = 1;\r\n"}}
{"actor":{"display_login":"kemlath"}}