When I build my source code using two steps:
localhost % clang -g -c factorial.s
localhost % clang -o factorial factorial.o
I get debug info about the assembly source.
localhost % lldb factorial
(lldb) target create "factorial"
Current executable set to '/Users/chris/Dev/assembly/learning-assembly/chapter11/factorial' (x86_64).
(lldb) source info -f factorial.s
Lines found for file factorial.s in compilation unit factorial.s in `factorial
[0x0000000100003f89-0x0000000100003f8b): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:10
[0x0000000100003f8b-0x0000000100003f8d): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:13
[0x0000000100003f92-0x0000000100003f93): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:15
[0x0000000100003f93-0x0000000100003f95): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:16
[0x0000000100003f95-0x0000000100003f9c): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:19
[0x0000000100003f9c-0x0000000100003f9d): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:22
[0x0000000100003f9d-0x0000000100003fa1): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:25
[0x0000000100003fa1-0x0000000100003fa7): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:26
[0x0000000100003fa7-0x0000000100003faa): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:29
[0x0000000100003faa-0x0000000100003fac): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:30
[0x0000000100003fac-0x0000000100003faf): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:33
[0x0000000100003faf-0x0000000100003fb6): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:34
[0x0000000100003fb6-0x0000000100003fb8): /Users/chris/Dev/assembly/learning-assembly/chapter11/factorial.s:35
(lldb)
If I do this in one step I don't:
localhost % clang -g -o factorial factorial.s
localhost % lldb factorial
(lldb) target create "factorial"
Current executable set to '/Users/chris/Dev/assembly/learning-assembly/chapter11/factorial' (x86_64).
(lldb) source info -f factorial.s
error: No source filenames matched 'factorial.s'.
(lldb)
In another example, I did the one step build from source of a main.c along with function.s. In that case lldb knew about the main.c file, but not the assembly file.
Is there an option when building in one step with clang to get it to give me dwarf info for the assembly too?