[PATCH] D42581: [NVPTX] Emit debug info in DWARF-2 by default for Cuda devices.

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 26 10:18:16 PST 2018


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:
> 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.


================
Comment at: test/Driver/cuda-dwarf-2.cu:6-11
+// DEFAULT: "-fcuda-is-device"
+// DEFAULT-SAME: "-dwarf-version=2"
+// DEFAULT: ptxas
+// DEFAULT-NOT: "-g"
+// DEFAULT: fatbinary
+// DEFAULT-NOT: "-g"
----------------
tra wrote:
> Nit: you could probably collapse all test cases into two: HAS_DEBUG/NO_DEBUG
Ok, will do


Repository:
  rC Clang

https://reviews.llvm.org/D42581





More information about the cfe-commits mailing list