Skip to content

Missed feature in llvm::getLocationInfo (can't retrieve function's debugging information) #9584

@llvmbot

Description

@llvmbot
Bugzilla Link 9212
Resolution FIXED
Resolved on Feb 17, 2011 05:40
Version trunk
OS All
Attachments My simple modification
Reporter LLVM Bugzilla Contributor

Extended Description

'llvm::getLocationInfo' can't retrieve the dbg info of 'Function' (while instructions and global variables are working) because it looks like that it wasn't simply implemented yet. I don't have an access to update the patch, so I'd like to let you know via this system.

Z:\dev\my-llvm\lib\Analysis>diff -u DebugInfo.cpp DebugInfo_old.cpp
--- DebugInfo.cpp 2011-02-09 15:15:39 -0500
+++ DebugInfo_old.cpp 2011-02-13 23:19:27 -0500
@@ -1592,23 +1592,6 @@
return 0;
}

-/// Find the debug info descriptor corresponding to this function.
-static Value *findDbgSubprogramDeclare(Function *V) {

  • const Module *M = V->getParent();
  • NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.sp");
  • if (!NMD)
  • return 0;
  • for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
  • DIDescriptor DIG(cast(NMD->getOperand(i)));
  • if (!DIG.isSubprogram())
  •  continue;
    
  • if (DISubprogram(DIG).getFunction() == V)
  •  return DIG;
    
  • }
  • return 0;
    -}

/// Finds the llvm.dbg.declare intrinsic corresponding to this value if any.
/// It looks through pointer casts too.
static const DbgDeclareInst *findDbgDeclare(const Value *V) {
@@ -1646,17 +1629,6 @@

 StringRef D = Var.getDisplayName();
 if (!D.empty())
  •  DisplayName = D;
    
  • LineNo = Var.getLineNumber();
  • Unit = Var.getCompileUnit();
  • TypeD = Var.getType();
  • } else if (Function F = dyn_cast(const_cast<Value>(V))){
  • Value *DIF = findDbgSubprogramDeclare(F);
  • if (!DIF) return false;
  • DISubprogram Var(cast(DIF));
  • StringRef D = Var.getDisplayName();
  • if (!D.empty())
    DisplayName = D;
    LineNo = Var.getLineNumber();
    Unit = Var.getCompileUnit();

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions