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

Walter Erquinigo via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 13:15:13 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.
----------------
walter-erquinigo wrote:

These if/else blocks read a bit weird. Better collapse them into a single if condition

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


More information about the llvm-commits mailing list