GDB kind of doesn't work on macOS Sierra

前端 未结 8 768
梦毁少年i
梦毁少年i 2020-12-02 07:55

It is a problem that appeared when I first updated to macOS Sierra yesterday.

GDB itself is running OK. However, somehow, it cannot run my program. When I type \'run

8条回答
  •  悲&欢浪女
    2020-12-02 08:09

    This is due to a Runtime Integrity Protection feature in Sierra - you can deactivate it by following the instructions here.

    1. Reboot your system Keep command+R pressed until the Apple logo appears on the screen.
    2. Select the menu Utilities/Terminal Type "csrutil enable --without debug" in the terminal
    3. Finally, reboot your machine again

    Note that disabling this will lower the security of your system, so doing the above should really be your decision.

    Another impact of this change is that the DYLD_LIBRARY_PATH variable is no longer reset when spawning new processes via the shell. This variable is used by the dynamic linker to find dynamic libraries. It takes precedence over the search path coded in the executables, so is considered as unsafe by the OS. As a result, macOS by default unsets the variable so that the executable you spawn uses its own libraries. We recommend using the DYLD_FALLBACK_LIBRARY_PATH instead, which comes after the application's library search path, in case some libraries are still not found.

提交回复
热议问题