NVPTX target supports debug info in DWARF-2 format. Patch adds emission
of debug info in DWARF-2 by default.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Driver/ToolChains/Cuda.cpp | ||
---|---|---|
353 ↗ | (On Diff #131602) | 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? |
test/Driver/cuda-dwarf-2.cu | ||
6–11 ↗ | (On Diff #131602) | Nit: you could probably collapse all test cases into two: HAS_DEBUG/NO_DEBUG |
lib/Driver/ToolChains/Cuda.cpp | ||
---|---|---|
353 ↗ | (On Diff #131602) | That's exactly what I want to avoid. I think we can ignore these options and handle only -g option. |
test/Driver/cuda-dwarf-2.cu | ||
6–11 ↗ | (On Diff #131602) | Ok, will do |
lib/Driver/ToolChains/Cuda.cpp | ||
---|---|---|
353 ↗ | (On Diff #131602) | 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?
|
lib/Driver/ToolChains/Cuda.cpp | ||
---|---|---|
353 ↗ | (On Diff #131602) |
|
lib/Driver/ToolChains/Cuda.cpp | ||
---|---|---|
353 ↗ | (On Diff #131602) | Works for me. Please add a test to verify that it's always dwarf2 on device side. |
If you want to force DWARF 2, probably clamping the version in LLVM would be simpler? Although most of the debug-info tests are architecture-specific and wouldn't run for an NVPTX target anyway.
Hi, I think it would be better to do both: make it default in the frontend and in the backend.
lib/Driver/ToolChains/Cuda.cpp | ||
---|---|---|
353 ↗ | (On Diff #131602) | 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. |
- Updated after review.
- Changed the default behavior of --[no]cuda-noopt-device-debug. If the optimization level is not specified or is O0 and debug info must be emitted, the device debug info is emitted. If optimization level is specified and >O0 and debug info must be emitted, the debug info for device is emitted only if --cuda-noopt-device-debug is specified.
lib/Driver/ToolChains/Cuda.cpp | ||
---|---|---|
436–437 ↗ | (On Diff #132016) | Do we need to pass -g to make lineinfo debugging work? |
lib/Driver/ToolChains/Cuda.cpp | ||
---|---|---|
436–437 ↗ | (On Diff #132016) | I checked with nvcc, it does not send -g in line table only mode. |