hi, Is there any solution about how to add some dwarf info to the IR bitcode file.

Hi,

I create the function A with llvm api, and make implement about function, that function A call function B, and add some write/read operation of variants to function A. and compile it to machine code, run it debug it.

And I want to debug the function A, is there any ways I can add some dwarf info (or debug info ), so that I can the check variant ‘s value is ok.

BR

Owen

Have a look at the DebugInfo API.

include/llvm/DebugInfo/*

It requires using the C++ API instead of the C API.

Hi Andrew

I am newbie. There are many headers and classes, I do not know how to use to add dwarf info to bc file.

Can you show me the demo or example, is there any info about how to use these classes step by step.

BR

Owen

There might be no step-by-step example, but you can check links below:

If you wish to have LLVM IR in debug info, There used to be a pass called “debugir” which bitrotted. I’m bringing it up-to-date, the code is available here: https://github.com/bollu/llvm/tree/revive-debug-ir

Give it a shot if it makes sense for your use-case.

Cheers,
~Siddharth.