[cfe-commits] r86862 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Devang Patel dpatel at apple.com
Wed Nov 11 11:10:19 PST 2009


Author: dpatel
Date: Wed Nov 11 13:10:19 2009
New Revision: 86862

URL: http://llvm.org/viewvc/llvm-project?rev=86862&view=rev
Log:
Do not eagerly set stop point for arguments. This misleads the debugger in identifying beginning of function body. Instead, create new location to attach with llvm.dbg.declare. This location is only used to find the context of the variable by the code generator, and it is not used to emit line number info.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=86862&r1=86861&r2=86862&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Nov 11 13:10:19 2009
@@ -941,7 +941,6 @@
 
   // Push function on region stack.
   RegionStack.push_back(SP);
-  EmitStopPoint(Fn, Builder);
 }
 
 
@@ -1166,9 +1165,16 @@
     DebugFactory.CreateVariable(Tag, RegionStack.back(),Decl->getNameAsString(),
                                 Unit, Line, Ty);
   // Insert an llvm.dbg.declare into the current block.
-  llvm::Instruction *Call = 
+  llvm::Instruction *Call =
     DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertBlock());
-  Builder.SetDebugLocation(Call);
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+    llvm::DIDescriptor DR = RegionStack.back();
+    llvm::DIScope DS = llvm::DIScope(DR.getNode());
+    llvm::DILocation DO(NULL);
+    llvm::DILocation DL = 
+      DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
+    Builder.SetDebugLocation(Call, DL.getNode());
+#endif
 }
 
 /// EmitDeclare - Emit local variable declaration debug info.
@@ -1363,7 +1369,16 @@
                                        Decl->getNameAsString(), Unit, Line, Ty,
                                        addr);
   // Insert an llvm.dbg.declare into the current block.
-  DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertPoint());
+  llvm::Instruction *Call = 
+    DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertPoint());
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+    llvm::DIDescriptor DR = RegionStack.back();
+    llvm::DIScope DS = llvm::DIScope(DR.getNode());
+    llvm::DILocation DO(NULL);
+    llvm::DILocation DL = 
+      DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
+    Builder.SetDebugLocation(Call, DL.getNode());
+#endif
 }
 
 void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *Decl,





More information about the cfe-commits mailing list