[llvm-dev] Emit DWARF sections with NVPTX

Tim Besard via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 10 03:00:00 PST 2015


Hi all,

I'm emitting PTX code from an LLVM module using
TargetMachine::addPassesToEmitFile, and I'm currently trying to add
debug information to the mix. The goal is to load and run my PTX code
under cuda-memcheck.

My IR contains proper debug information, which results in `.loc`
statements generated by NVPTX. Additionally, I set the -debug-compile
flag (using cl::ParseCommandLineOptions, is there another way to do
this?). The resulting PTX code doesn't contain a debug_info section
though, making it invalid (ptxas complains "Debug information not found
in presence of .target debug").

How do I configure LLVM to emit those DWARF sections? I found
MCContext::GenDwarfForAssembly, but that doesn't seem easy to modify
when using addPassesToEmitFile, and when I did (hackishly) the resulting
PTX only contained a seemingly invalid top-level "Lline_table_start0:".

Thanks,
-- 
Tim Besard
Computer Systems Lab
Department of Electronics & Information Systems
Ghent University


More information about the llvm-dev mailing list