What is the difference between objcopy and dsymutil?

Are these two commands in linux:

objcopy --only-keep-debug foo foo.dbg objcopy --add-gnu-debuglink=foo.dbg foo 

equivalently lower on mac

 dsymutil <binary> -o <binary>.dSYM 

Equivalent in the sense that

  • It creates an offline file with debugging information.
  • It creates a link between the executable and the debug information file.

Then for removal

are the commands in linux:

 objcopy --strip-debug foo 

OR

 strip -g <binary> 

equivalently lower on mac

 strip -S <binary> 
+5
source share
1 answer

The --only-keep-debug part of the --only-keep-debug object performs functionally the same as dsymutil.

There is no tool for writing binary location in dSYM. Rather, dSYM and binaries have a common UUID, and clients who want to find character files use the DebugSymbols structure, which uses various tricks (for example, Spotlight importer, search paths, "dSYM find external script", etc.) to find debug file. So there is no need for the --add-gnu-debuglink .

The Mac version of strip -S strips debugging information in the same way as the binutils version. The difference is that strip -S on OS X does not actually reduce the size of the binary. In OS X, debugging information is always stored outside the executable file - it is located either in the .o files or in dSYM. There is only a small "debug map" in the executable that tells lldb or dsymutil how to associate the dwarf with .o files. strip -S need to remove the debug card.

+2
source

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


All Articles