Hi, Strictly speaking, this is not a DWARF question, but it relates to DWARF because on the Mac the Mach-O NLIST/STAB symbol table is used as an index into DWARF symbols table. It's kind-of like Split-DWARF, but was invented long before Split-DWARF was added to DWARF 5.
On a Mac OS 14 Sonoma M2 system, I'm seeing gfortran and gcc puts control characters in N_SO STABS: dc3-mac-tvt3 36 02/16 9:20 ~ % gfortran-mp-13 -gdwarf-4 ~/src/totalview.develop/debugger/src/tests/src/tx_f90_1module.f90 dc3-mac-tvt3 37 02/16 9:20 ~ % nm -ap a.out | cat -v | grep SO | grep -F '^' 0000000000000000 - 00 0000 SO /nfs/homes/jdelsign/^B/nfs/homes/jdelsign/src/totalview.develop/debugger/src/tests/src/ dc3-mac-tvt3 38 02/16 9:21 ~ % dc3-mac-tvt3 43 02/16 9:41 ~ % g++-mp-13 -gdwarf-4 ~/src/totalview.develop/debugger/src/tests/src/tx_hello.cxx dc3-mac-tvt3 44 02/16 9:41 ~ % nm -ap a.out | cat -v | grep SO | grep -F '^' 0000000000000000 - 00 0000 SO /nfs/homes/jdelsign/^D/nfs/homes/jdelsign/src/totalview.develop/debugger/src/tests/src/ dc3-mac-tvt3 45 02/16 9:41 ~ % Above, notice the ^B and ^D. I have also seen ^A used. Apparently, the control character separates the current working directory from the directory path of the file passed to the compiler. Does anyone know if this is a "feature" or a "bug"? Is it document somewhere? Here are all of the STABS for the above g++ compile: 0000000000000000 - 00 0000 SO /nfs/homes/jdelsign/^D/nfs/homes/jdelsign/src/totalview.develop/debugger/src/tests/src/ 0000000000000000 - 00 0000 SO tx_hello.cxx 0000000065cf7425 - 00 0001 OSO /var/folders/sm/hl1mjmg569g9yh_x_6fm889w0017hg/T//ccapF4uA.o 0000000100003f3c - 01 0000 BNSYM 0000000100003f3c - 01 0000 FUN _main 000000000000005c - 00 0000 FUN 0000000100003f3c - 01 0000 ENSYM 0000000000000000 - 01 0000 SO And here is the matching DWARF CU: 0x0000000b: DW_TAG_compile_unit DW_AT_producer ("GNU C++17 13.2.0 -fPIC -mmacosx-version-min=14.0.0 -mlittle-endian -mabi=lp64 -gdwarf-4") DW_AT_language (DW_LANG_C_plus_plus) DW_AT_name ("/nfs/homes/jdelsign/src/totalview.develop/debugger/src/tests/src/tx_hello.cxx") DW_AT_comp_dir ("/nfs/homes/jdelsign") DW_AT_GNU_pubnames (true) DW_AT_low_pc (0x0000000100003f3c) DW_AT_high_pc (0x0000000100003f98) DW_AT_stmt_list (0x00000000) The first N_SO is supposed to be the directory and the second is the file name. Notice that the second N_SO has no directory path. Given that the second N_SO is just the base name, having the current working directory and the directory path of the file passed to the compiler is actually helpful, because it provides the same level of detail in the DWARF CU. I was thinking that the debugger could look for a control character in the first N_SO string split the current working directory from the directory path, but if it's a bug in the compiler maybe that's not a good idea. Thanks, John D. This e-mail may contain information that is privileged or confidential. If you are not the intended recipient, please delete the e-mail and any attachments and notify us immediately.
-- Dwarf-discuss mailing list Dwarf-discuss@lists.dwarfstd.org https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss