[LLVMdev] Getting llc to emit debug info into a obj file from source .ll

Peter Mackay
Fri, 08 May 2015 06:29:05 -0000

Hello,

I'm working on a binary translator project that emits an .ll file. I'm
trying to debug it in Visual Studio and would like to be able to step
through and see my generated .ll file in the debugger.

Does LLVM support debug information corresponding to an input .ll
file? My hunch is "no, as it expects debug info to come from Clang."

I assemble it using:

llc -filetype=obj -O0 -mtriple=x86_64-pc-windows-msvc -o=output.obj input.ll

I've ran objdump on the file as follows:

llvm-objdump -section-headers output.obj

and see the following output:

output.obj:   file format COFF-x86-64

Sections:
Idx Name          Size      Address          Type
  0 .text         00000012 0000000000000000 TEXT
  1 .data         00000000 0000000000000000 DATA
  2 .bss          00000000 0000000000000000 BSS
  3 .drectve      00000018 0000000000000000
  4 .xdata        00000008 0000000000000000 DATA
  5 .pdata        0000000c 0000000000000000 DATA

I don't think there's debugging information there, as the .text
section is very small.

Thanks,
Peter