[llvm] [NVPTX] add support for .debug_loc section (PR #110905)

William G Hatch via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 13:37:30 PDT 2024


================
@@ -1324,7 +1322,12 @@ void DwarfDebug::finalizeModuleInfo() {
     // ranges for all subprogram DIEs for mach-o.
     DwarfCompileUnit &U = SkCU ? *SkCU : TheCU;
 
-    if (unsigned NumRanges = TheCU.getRanges().size()) {
+    if (Asm->TM.getTargetTriple().isNVPTX() && tuneForGDB()) {
+      // PTX does not support subtracting labels from the code section in the
+      // debug_loc section.  To work around this, the NVPTX backend needs the
+      // compile unit to have no low_pc in order to have a zero base_address
+      // when handling debug_loc in cuda-gdb.
----------------
willghatch wrote:

I've moved the PTX test inside the other block, which is probably easier to read.  I don't want to merge the two conditions, exactly, since one is an assignment, and a type-preserving merge would be ugly there.

https://github.com/llvm/llvm-project/pull/110905


More information about the llvm-commits mailing list