Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Xavier Roirand <roirand@adacore.com>
To: gdb-patches@sourceware.org
Cc: brobecker@adacore.com,	Xavier Roirand <roirand@adacore.com>
Subject: [RFA 3/5] Darwin: set startup-with-shell to off on Sierra and later.
Date: Wed, 22 Aug 2018 10:11:00 -0000	[thread overview]
Message-ID: <1534932677-9496-4-git-send-email-roirand@adacore.com> (raw)
In-Reply-To: <1534932677-9496-1-git-send-email-roirand@adacore.com>

On Mac OS X Sierra and later, the shell is not allowed to be
debug so add a check and disable startup with shell in that
case.

gdb/ChangeLog:
    * darwin-nat.c (disable_startup_with_shell): New function.
    (_initialize_darwin_inferior): Add call.

Change-Id: Ia3cbeaa89b2b44a173b93ee22cce0d3884a16924
---
 gdb/darwin-nat.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index be80163..96f70cf 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -2362,6 +2362,26 @@ darwin_nat_target::supports_multi_process ()
   return true;
 }
 
+/* Read kernel version, and set startup-with-shell to false on Sierra or
+   later.  */
+
+void
+disable_startup_with_shell ()
+{
+  char str[16];
+    size_t sz = sizeof (str);
+    int ret;
+    unsigned long ver;
+
+    ret = sysctlbyname ("kern.osrelease", str, &sz, NULL, 0);
+    if (ret == 0 && sz < sizeof (str))
+      {
+       ver = strtoul (str, NULL, 10);
+       if (ver >= 16)
+         startup_with_shell = 0;
+      }
+}
+
 void
 _initialize_darwin_nat ()
 {
@@ -2396,4 +2416,6 @@ When this mode is on, all low level exceptions are reported before being\n\
 reported by the kernel."),
 			   &set_enable_mach_exceptions, NULL,
 			   &setlist, &showlist);
+
+  disable_startup_with_shell ();
 }
-- 
2.7.4


  parent reply	other threads:[~2018-08-22 10:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 10:11 [RFA 0/5] Fix some bugs on macOS Xavier Roirand
2018-08-22 10:11 ` [RFA 2/5] Darwin: Handle unrelocated dyld Xavier Roirand
2018-08-22 13:55   ` Simon Marchi
2018-09-18 21:22     ` Tom Tromey
2018-09-19 13:41       ` Joel Brobecker
2018-09-19 14:16         ` Simon Marchi
2018-09-19 14:28           ` Joel Brobecker
2018-09-19 14:36         ` Tom Tromey
2018-09-19 14:44           ` Simon Marchi
2018-09-19 15:32             ` Joel Brobecker
2018-09-19 19:15             ` Tom Tromey
2018-09-19 19:50               ` Simon Marchi
2018-09-28 13:31               ` Xavier Roirand
2018-09-28 17:22                 ` Tom Tromey
2018-08-22 13:59   ` Simon Marchi
2018-09-18 21:23     ` Tom Tromey
2018-08-22 10:11 ` [RFA 5/5] Darwin: fix SIGTRAP when debugging Xavier Roirand
2018-08-22 14:34   ` Simon Marchi
2018-08-22 10:11 ` [RFA 4/5] Darwin: fix thread ptid started by fork_inferior Xavier Roirand
2018-08-22 14:30   ` Simon Marchi
2018-08-22 16:10   ` Pedro Alves
2018-08-22 18:14     ` Simon Marchi
2018-08-22 10:11 ` [RFA 1/5] Darwin: fix bad loop incrementation Xavier Roirand
2018-08-22 13:14   ` Simon Marchi
2018-08-23 15:21     ` Simon Marchi
2018-08-22 10:11 ` Xavier Roirand [this message]
2018-08-22 14:20   ` [RFA 3/5] Darwin: set startup-with-shell to off on Sierra and later Simon Marchi
2018-08-22 14:37     ` Pedro Alves
2018-09-03 13:23     ` Xavier Roirand
2018-09-17 19:31   ` Tom Tromey
2018-09-17 20:57 ` [RFA 0/5] Fix some bugs on macOS Tom Tromey
2018-09-17 21:25   ` Joel Brobecker
2018-09-17 23:03     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1534932677-9496-4-git-send-email-roirand@adacore.com \
    --to=roirand@adacore.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox