[LLVMdev] [PROPOSAL] Attach debugging information with LLVM instruction

Török Edwin edwintorok at gmail.com
Thu Sep 10 13:39:51 PDT 2009

On 2009-09-10 20:48, Devang Patel wrote:
> Now, the optimizer does not need to worry about those llvm.dbg
> hurdles. Instructions do not lose their location information when they
> are rearranged in instruction stream. And the stage is set to produce,
> preserve and emit accurate debug information for inlined functions.
> Any thoughts/suggestions/questions ?

Sounds good.

To ease transition from LLVM 2.6->2.7, could there be a pass that adds
back the llvm.dbg intrinsics based on the metadata on the instructions?
No in-tree pass should need that, but it could help external projects
that rely on stoppoints being present.

Also would it be possible to have source:line debuginfo generated for
macros (at least in clang)?
The debug info generated by gcc, llvm-gcc or clang doesn't deal with
macros in a way that would allow single-stepping through them.
-g3 in gcc allows me to expand a macro from gcc, but thats it, as far as
debugging is concerned it acts like a single instruction, not

I generally tend to avoid the use of macros that do something
non-trivial (i.e. requires debugging), but unfortunately C doesn't
support templates,
so in some situations I am forced to use macros, instead of functions.

Best regards,

More information about the llvm-dev mailing list