[LLVMdev] Generate .debug_info for asm files?
Frédéric Riss
friss at apple.com
Thu May 28 07:57:47 PDT 2015
> On May 28, 2015, at 7:36 AM, Alex <alexinbeijing at gmail.com> wrote:
>
> Dear LLVM devs,
>
> I've noticed that LLVM's assembler (and hence clang) doesn't generate debug data when assembling, even when run with "-g”.
What are you seeing exactly? because my clang using the integrated as on Darwin definitely produces debug info for assembly input:
$ cat test.s
.globl func
func:
ret
$ clang -g test.s -c
$ llvm-dwarfdump test.o
test.o: file format Mach-O 64-bit x86-64
[…]
.debug_info contents:
0x00000000: Compile Unit: length = 0x0000008e version = 0x0002 abbr_offset = 0x0000 addr_size = 0x08 (next CU at 0x00000092)
0x0000000b: DW_TAG_compile_unit [1] *
0x0000000c: DW_AT_stmt_list [DW_FORM_data4] (0x00000000)
0x00000010: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
0x00000018: DW_AT_high_pc [DW_FORM_addr] (0x0000000000000001)
0x00000020: DW_AT_name [DW_FORM_string] ("test.s")
0x00000027: DW_AT_comp_dir [DW_FORM_string] ("/Users/fred/tmp")
0x00000037: DW_AT_producer [DW_FORM_string] ("Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)")
0x00000076: DW_AT_language [DW_FORM_data2] (0x8001)
0x00000078: DW_TAG_label [2] *
0x00000079: DW_AT_name [DW_FORM_string] ("func")
0x0000007e: DW_AT_decl_file [DW_FORM_data4] (0x00000001)
0x00000082: DW_AT_decl_line [DW_FORM_data4] (0x00000006)
0x00000086: DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
0x0000008e: DW_AT_prototyped [DW_FORM_flag] (0x00)
0x0000008f: DW_TAG_unspecified_parameters [3]
0x00000090: NULL
0x00000091: NULL
[…]
.debug_lines contents:
[…]
Address Line Column File ISA Flags
------------------ ------ ------ ------ --- -------------
0x0000000000000000 4 0 1 0 is_stmt
0x0000000000000001 4 0 1 0 is_stmt end_sequence
> Users can add their own CFI/line number data with assembler directives. But GDB ignores the line number data if you don't have a DIE in the .debug_info section which identifies the compilation unit. (I'm not an expert on GDB, but this is the conclusion I have drawn from single-stepping through GDB on some test binaries.)
I’m not sure how that interacts with user supplied debug annotations though.
Fred
> Would you be interested in a patch which makes the assembler generate .debug_info?
>
> Thanks,
> Alex Dowad
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list