Match LLVM IR back to assembly

Hi all,

I am trying to write a pass which matches LLVM IR back to assembly in order to track PCs corresponding to certain LLVM IR instructions on an x86-64 machine. LLVM’s debug-ir options is/was doing exactly this, but on older versions (i.e. pre-3.6) it crashes while on newer versions it has been deprecated.

I’ve recently tried debug-ir with 3.4 and 3.5, but this assert fails:
llc: llvm-3.4/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1614: void llvm::DwarfDebug::beginFunction(const llvm::MachineFunction*): Assertion `TheCU && “Unable to find compile unit!”’ failed

There is a previous discussion on this, yet no fix:!topic/llvm-dev/Oawy2-_lqCU

Any tips for how to solve this would be greatly appreciated.

Thank you,