public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15231] New: Local variables in lambdas are not accessible
@ 2013-03-05 22:07 poenitz at htwm dot de
  2013-03-06  2:42 ` [Bug c++/15231] " tromey at redhat dot com
  2015-03-15  8:10 ` cemkalyoncu at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: poenitz at htwm dot de @ 2013-03-05 22:07 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/15231] Local variables in lambdas are not accessible
  2013-03-05 22:07 [Bug c++/15231] New: Local variables in lambdas are not accessible poenitz at htwm dot de
@ 2013-03-06  2:42 ` tromey at redhat dot com
  2015-03-15  8:10 ` cemkalyoncu at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: tromey at redhat dot com @ 2013-03-06  2:42 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at redhat dot com

--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2013-03-06 02:42:56 UTC ---
gdb ignores the outer function due to missing PC bounds:

 <1><5a>: Abbrev Number: 8 (DW_TAG_subprogram)
    <5b>   DW_AT_specification: <0x3d>    
    <5f>   DW_AT_inline      : 2    (declared as inline but ignored)
    <60>   DW_AT_object_pointer: <0x68>    
    <64>   DW_AT_sibling     : <0x15c>    

and

  /* Ignore functions with missing or invalid low and high pc attributes.  */
  if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
    {
      attr = dwarf2_attr (die, DW_AT_external, cu);
[...]
      return;

So the lambda's locals are never processed.

-- 
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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/15231] Local variables in lambdas are not accessible
  2013-03-05 22:07 [Bug c++/15231] New: Local variables in lambdas are not accessible poenitz at htwm dot de
  2013-03-06  2:42 ` [Bug c++/15231] " tromey at redhat dot com
@ 2015-03-15  8:10 ` cemkalyoncu at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: cemkalyoncu at gmail dot com @ 2015-03-15  8:10 UTC (permalink / raw)
  To: gdb-prs

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

Cem Kalyoncu <cemkalyoncu at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cemkalyoncu at gmail dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-15  7:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-05 22:07 [Bug c++/15231] New: Local variables in lambdas are not accessible poenitz at htwm dot de
2013-03-06  2:42 ` [Bug c++/15231] " tromey at redhat dot com
2015-03-15  8:10 ` cemkalyoncu at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).