diff options
author | Tom Tromey <tom@tromey.com> | 2018-09-17 12:29:22 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-10-27 11:58:41 -0600 |
commit | b50a8b9a916ea2fe1379bcd8f122feef8129a0e9 (patch) | |
tree | 407ac2d5de2885afc30a8b067926c959e7db1694 /gdb/macrocmd.c | |
parent | 36033ef57cd048588f9a3d5523712147066421f2 (diff) | |
download | gdb-b50a8b9a916ea2fe1379bcd8f122feef8129a0e9.zip gdb-b50a8b9a916ea2fe1379bcd8f122feef8129a0e9.tar.gz gdb-b50a8b9a916ea2fe1379bcd8f122feef8129a0e9.tar.bz2 |
Cache a copy of the user's shell on macOS
Recent versions of macOS have a feature called System Integrity
Protection. Among other things, This feature prevents ptrace from
tracing certain programs --- for example, the programs in /bin, which
includes typical shells.
This means that startup-with-shell does not work properly. This is PR
cli/23364. Currently there is a workaround in gdb to disable
startup-with-shell when this feature might be in use.
This patch changes gdb to be a bit more precise about when
startup-with-shell will not work, by checking whether the shell
executable is restricted.
If the shell is restricted, then this patch will also cause gdb to
cache a copy of the shell in the gdb cache directory, and then reset
the SHELL environment variable to point to this copy. This lets
startup-with-shell work again.
Tested on High Sierra by trying to start a program using redirection,
and by running startup-with-shell.exp.
gdb/ChangeLog
2018-10-27 Tom Tromey <tom@tromey.com>
PR cli/23364:
* darwin-nat.c (copied_shell): New global.
(may_have_sip): Rename from should_disable_startup_with_shell.
(copy_shell_to_cache, maybe_cache_shell): New functions.
(darwin_nat_target::create_inferior): Update. Use
copied_shell.
Diffstat (limited to 'gdb/macrocmd.c')
0 files changed, 0 insertions, 0 deletions