Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell clang to put debug symbol into executable binaries? [duplicate]

Tags:

c++

c

macos

llvm

clang

My compile command is in macOS Seria isclang -std=c11 -g -Wall -Werror -fsanitize=address -file.c -o file after it compile, it also generate an extra file.dSYM file which included all debug sybols. However, when I use WSL or other *nix system it will not generate such file, debug symbols were into embedded into executable binaries. So I just wondering is there a way to do the same in macOS with clang.

like image 353
X.Yang Avatar asked Mar 31 '17 15:03

X.Yang


1 Answers

When you compile a program in one pass, clang actually runs dsymutil for you, which is responsible for creating the .dSYM file. Thus, the solution to your problem is to compile and link separately, in which case clang won't automatically call dsymutil.

Check this SO question for more details!

like image 51
filaton Avatar answered Sep 20 '22 08:09

filaton