What is the difference between starting a process from a dock and a command line on OS X

I am debugging an issue in OS X that only occurs when starting the application from the dock. This does not happen when the application is launched from the command line. What is the difference between these two scenarios? The code I'm working with is a C ++-based plug-in, loaded into a third-party application. I joined the process with GDB in both scenarios, and the only difference that I see is that when I start from the command line a couple extra dylibs are loaded, and the base address of my library is slightly different in two scripts. I tried to change my binding to -prebind and / or -bind_at_load to no avail.

+3
source share
4 answers

An important difference is that the original working directory will be different in each case. Applications should never make any assumptions about the working directory and will be interesting if they do.

+1
source

An application launched from the Dock icon will not display the same environment variables that can be set in the shell you are using. If you rely on getting something from the environment, you need to look for a different approach. You will get some of env vars like PATH, HOME, LOGNAME etc. But if you are looking for HOSTTYPE, LANG, OSTYPE, etc., they will not be present.

+1
source

. , . . , .

0

. , , . . free() delete.

It seems that application packages are dynamically linked to another implementation free/deletethat resets / modifies freed memory.

This type of error may not be displayed using other platforms / compilers (for example, Linux / gcc, Windows / Visual Studio, macOS / clang from the command line) and appears only when the program is executed from the application package (macOS / clang from Crawler / Dock )

0
source

Source: https://habr.com/ru/post/1739316/


All Articles