[LLVMdev] Debugging LLVM IR with GDB

Robinson, Paul Paul.Robinson at am.sony.com
Fri Oct 19 10:50:42 PDT 2012


> On 18/10/12 03:58, Robinson, Paul wrote:
> > There's always what the integrated assembler does if you say "-g" and
> > there aren't any debug-info directives in the assembler source.
>
> Do you mean passing "-g" to llc or to llvm-as? Both return with an
> "unknown command line option: -g" error.

Sorry, I wasn't clear.  My thought would be along the lines of teaching
llc to understand "-g".  This option would mean, if there is no debug
metadata, then pretend that each IR instruction in the input source file
had metadata, which pointed to the source line for that instruction in
the .ll file.

My inspiration was the case where you write a target-machine assembler
file with no debug-info directives (.loc etcetera) and then do
  clang -g foo.s
This will put debug info into the foo.o file, and that info will point
to the foo.s source lines for each machine instruction.
--paulr




More information about the llvm-dev mailing list