ABataev added inline comments.
================ Comment at: lib/Driver/ToolChains/Cuda.cpp:353 CmdArgs.push_back(Args.MakeArgString(Output.getFilename())); + if (mustEmitDebugInfo(Args) && Args.hasArg(options::OPT_g_Flag)) + CmdArgs.push_back("-g"); ---------------- tra wrote: > ABataev wrote: > > tra wrote: > > > ABataev wrote: > > > > tra wrote: > > > > > There's more than one -g option. Presumably you still want -g here > > > > > for -g{1,2,3} or -ggdb{1,2,3} or -gdwarf2. > > > > > > > > > > Speaking of dwarf, what's going to happen if someone passes -gdwarf5? > > > > > Should we downgrade it to -gdwarf2 on device side and issue a > > > > > warning? > > > > > > > > > That's exactly what I want to avoid. I think we can ignore these > > > > options and handle only `-g` option. > > > > Or I can add a function to ToolChain class to force using the default > > > > settings for debugger tuning and DWARF version rather than take them > > > > from the driver options. > > > You should handle at least -gN/-gline-tables-only/-g. Now that we can > > > emit dwarf debug info, I would want to be able to control it to some > > > degree -- off/line-info-only/full. > > > > > > I'm still not sure what's the plan for -gdwarfN unsupported on device > > > side? > > > - do we ignore it and always emit dwarf2? > > > - do we accept it, emit requested version and let user stare at ptxas (or > > > cuda-gdb) errors when it fails to deal with it? > > > > > > > > > > > > > > 1. Ok, will look at this > > 2. -gdwarfN should be ignored, we should always emit DWARF2, otherwise, it > > will break ptxas. > Works for me. Please add a test to verify that it's always dwarf2 on device > side. After some thoughts, I think it would better to follow Paul's suggestion, i.e. force DWARF2 for NVPTX in the backend. In this case, -gdwarfN will not break anything in the debug info for NVPTX. Repository: rC Clang https://reviews.llvm.org/D42581 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits