Reading debug symbols from binary

Hello,

I am trying to read debug symbols from a binary obtained from simple "hello world" C code. I use default gcc (Clang) on macos15, then try to install gcc-14 with hombrew

$ gcc -g program.c -o program

then run

$ dsymutil program

I got :

warning: no debug symbols in executable (-arch arm64)

I am doing something wrong here. My final objective is to be able to use my binaries in total view for debugging. Without debugging symbols, I can debug properly .

Thank you

I’m gonna divide this up into two parts:

  • Apple stuff

  • Third-party stuff

On the Apple front, Clang automatically cleans up behind itself which causes grief for dsymutil. One way to fix that is to pass in -save-temps. For example:

% cat hello.c 
#include <stdio.h>

int main(int argc, char ** argv) {
    fprintf(stderr, "Hello Cruel World!\n");
    return 0;
}
% clang -g hello.c -save-temps -o hello
% dsymutil hello
% ls -l
total 200
-rwxr-xr-x  1 quinn  staff  33672  3 Dec 15:11 hello
…
-rw-r--r--@ 1 quinn  staff    116  3 Dec 15:07 hello.c
drwxr-xr-x  3 quinn  staff     96  3 Dec 15:11 hello.dSYM
…
-rw-r--r--  1 quinn  staff  17074  3 Dec 15:11 hello.s

Regarding your third-party tooling, I’m not sure that dsymutil is gonna be super helpful to you. .dSYM files are a very Apple thing.

Regardless, dsymutil is looking in the .o files for DWARF symbols; if it can’t find any, it’s likely because the compiler didn’t generate debug symbols, or generated them in the wrong format, or didn’t include the debug map required to find those .o files [1]. That’s something you’ll need to escalate via the support channel for those tools.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] That is, the OSO symbols:

% nm -a hello | grep OSO
00000000674f220a - 00 0001   OSO /Users/quinn/Test/hello.o
Reading debug symbols from binary
 
 
Q