[llvm-bugs] [Bug 43289] New: unable to access optimized away parameters, clang Debugging Optimized Code

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 12 03:20:10 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43289

            Bug ID: 43289
           Summary: unable to access optimized away parameters, clang
                    Debugging Optimized Code
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: new-feature
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: sourav0311 at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

For CLANG compiled following test case, GDB is not able access and locate
optimized away parameters.
CLANG 10, gdb 8.3 --used

$clang++ -Xclang -femit-debug-entry-values -O2 -ggdb test1.cpp

#include <iostream>
int func(int* ptr){

        std::cout << *ptr;
        return *ptr + 5;
}

int main(int argc, char** argv){

        int a = 4;
        int* ptr_a = &a;

        int b = func(ptr_a);

        return 0;
}

gdb -q a.out -ex "b func" -ex "r" -ex "print ptr"
Reading symbols from a.out...
Breakpoint 1 at 0x2010f4: func. (2 locations)
Starting program: /home/sourabh/work/dwarf/c_c++/c++11/a.out

Breakpoint 1, func (ptr=<optimized out>) at ../doc/test1.cpp:4
4               std::cout << *ptr;
$1 = <optimized out>
(gdb) print *ptr
value has been optimized out

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190912/e0929af9/attachment.html>


More information about the llvm-bugs mailing list