This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/15231] New: Local variables in lambdas are not accessible


http://sourceware.org/bugzilla/show_bug.cgi?id=15231

             Bug #: 15231
           Summary: Local variables in lambdas are not accessible
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@sourceware.org
        ReportedBy: poenitz@htwm.de
    Classification: Unclassified


The local variable x does not seem to be "visible" for the debugger in the
following:


echo "
    void breaker() {}
    struct Z
    {
        int b;

        Z() {
            auto a = [&]() {
                int x = 32;
                breaker();
                return x;
            };
            b = a();
        }

    };

    int main()
    {
        Z z;
        return z.b;
    }
" | g++ -g -xc++ -std=c++11 -


gdb -ex 'b breaker' -ex 'run' -ex 'up' -ex 'p x' -ex 'bt full' ./a.out



->   GNU gdb (GDB) 7.5.50.20121013-cvs
->   [...]

->    10      in <stdin>
->    No symbol "x" in current context.


->    #0  breaker () at <stdin>:2
->    No locals.
->    #1  0x0804840e in Z::Z()::{lambda()#1}::operator()() const () at
->    <stdin>:10
->    No locals.
->    #2  0x08048425 in Z::Z (this=0xbffff34c) at <stdin>:13
->            a = {<No data fields>}
->    #3  0x080483f6 in main () at <stdin>:20
->            z = {b = -1208270848}


$ gcc --version
gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]