I want to change the debug information of the llvm instruction so that the changed debug information is subsequently passed to the binary executable. So if I use the "addr2line" utility in binary format, it will return my modified debugging information.
I tried to change using the following code snippet:
MDNode *N = Inst->getMetadata("dbg"); DebugLoc Loc = DebugLoc::get(newLine, newCol, N); Inst->setDebugLoc(Loc);
I read DebugLoc using
const DebugLoc D = Inst->getDebugLoc(); unsigned Line = D.getLine(); outs() << Line <<"\n";
But I can not set debug info correctly. How to change debug info correctly through llvm pass?
user source share