This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA 3/5] Darwin: set startup-with-shell to off on Sierra and later.
- From: Xavier Roirand <roirand at adacore dot com>
- To: gdb-patches at sourceware dot org
- Cc: brobecker at adacore dot com, Xavier Roirand <roirand at adacore dot com>
- Date: Wed, 22 Aug 2018 12:11:15 +0200
- Subject: [RFA 3/5] Darwin: set startup-with-shell to off on Sierra and later.
- References: <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