How to tell clang to put a debug symbol in executable binaries?

My compilation command is on macOS Seria, clang -std=c11 -g -Wall -Werror -fsanitize=address -file.c -o file after compiling it, it also creates an additional file.dSYM file that includes all debug files. However, when I use WSL or another * nix system, it will not generate such a file, debugging characters would be embedded in the executable binaries. So I'm just wondering if there is a way to do the same in macOS with clang.

+6
source share
1 answer

When compiling a program in one pass clang, it actually launches dsymutilfor you, which is responsible for creating the file .dSYM. Thus, the solution to your problem is to compile and link separately, in which case clangit will not automatically invoke dsymutil.

Check this SO question for more details!

+3
source

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


All Articles