[llvm-dev] Can we keep debug information of local variable when in the optimization condition?
Wu Zhao via llvm-dev
llvm-dev at lists.llvm.org
Thu Feb 16 07:18:13 PST 2017
Hi, I'm curious that whether we can keep debug information of local variable when in the optimization condition (for example -O2, -O3) in LLVM.
For example this simple C source code:
int main()
{
int i = 5;
if(i > 5) {
return 1;
} else {
return 0;
}
}
If we compile clang -g a.c, we can get our expected result. We can check and update the local variable i in the debugger.
However, when we compile it using clang -O3 -g a.c, we can only check the variable i but we can not update the local variable i.
I know, the design of LLVM opt-debug is that debug can not affect optimization, so this case llvm-opt will turn the llvm.dbg.declare and related alloc / store instruction to llvm.dbg.value, we don't have symbol of local variable i. So we can only check local variable i but we can not update the value of local variable i like set variable i = 7 in the gdb.
I think keep debug information of local variable in some condition is very useful and I want to explore it. However, I find there are many places do this work of local variable debug info. I want to know whether I have one simple way like disabling some passes or modify some llvm code to continue this way.
Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170216/733f4929/attachment.html>
More information about the llvm-dev
mailing list