[llvm-dev] Can we keep debug information of local variable when in the optimization condition?
David Blaikie via llvm-dev
llvm-dev at lists.llvm.org
Thu Feb 16 08:21:07 PST 2017
I don't think there's any simple approach to this - there's been some idea
that -O1 (or -Og, or that -O1 shuold be -Og) could be made to be this mode,
where values are still findable/etc. (though I'm not sure "modifiable" is a
goal there - the ability to see the behavior of the program correctly is
one thing, but making sure all values are modifiable would be a larger goal
and probably really limit the ability to optimize the program)
- Dave
On Thu, Feb 16, 2017 at 7:39 AM Wu Zhao via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> 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.
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170216/8d3ac98e/attachment.html>
More information about the llvm-dev
mailing list