public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14850] New: unable to print local variable if stop at function }
@ 2012-11-16  3:49 chihinko at yahoo dot com
  2012-11-16  3:51 ` [Bug c++/14850] unable to print local variable when stopped at function closing brace '}' chihinko at yahoo dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: chihinko at yahoo dot com @ 2012-11-16  3:49 UTC (permalink / raw)
  To: gdb-prs

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

             Bug #: 14850
           Summary: unable to print local variable if stop at function }
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@sourceware.org
        ReportedBy: chihinko@yahoo.com
    Classification: Unclassified


g++ 4.5.3 and up
gdb 7.1

for following test cast

int
main() {
    int i;
    i = 10;
}

if I stop at  } of main and print i, gdb gave error:
tarting program: /home/chko/core/g++/g45/a.out

Breakpoint 1, main () at t.cc:4
4           i = 10;
(gdb) p i
$1 = 0
(gdb) n
5       }
(gdb) p i
No symbol "i" in current context.
(gdb)

-- 
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] 7+ messages in thread

* [Bug c++/14850] unable to print local variable when stopped at function closing brace '}'
  2012-11-16  3:49 [Bug c++/14850] New: unable to print local variable if stop at function } chihinko at yahoo dot com
@ 2012-11-16  3:51 ` chihinko at yahoo dot com
  2012-11-19 16:56 ` tromey at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: chihinko at yahoo dot com @ 2012-11-16  3:51 UTC (permalink / raw)
  To: gdb-prs

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

chihinko at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chihinko at yahoo dot com
            Summary|unable to print local       |unable to print local
                   |variable if stop at         |variable when stopped at
                   |function }                  |function closing brace '}'

-- 
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] 7+ messages in thread

* [Bug c++/14850] unable to print local variable when stopped at function closing brace '}'
  2012-11-16  3:49 [Bug c++/14850] New: unable to print local variable if stop at function } chihinko at yahoo dot com
  2012-11-16  3:51 ` [Bug c++/14850] unable to print local variable when stopped at function closing brace '}' chihinko at yahoo dot com
@ 2012-11-19 16:56 ` tromey at redhat dot com
  2012-11-19 22:47 ` chihinko at yahoo dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-11-19 16:56 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |tromey at redhat dot com
         Resolution|                            |INVALID

--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2012-11-19 16:56:45 UTC ---
I think this is not a gdb bug -- it is just doing what the
compiler tells it to.

First, dump the line table:

barimba. readelf --debug-dump=decodedline ./pr
Decoded dump of debug contents of section .debug_line:

CU: pr.cc:
File name                            Line number    Starting address
pr.cc                                          2            0x4004d4
pr.cc                                          4            0x4004d8
pr.cc                                          5            0x4004e4


line 5 == 0x4004e4


Now look at the DWARF:

barimba. readelf -wi ./pr 
Contents of the .debug_info section:
[...]
 <1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2e>   DW_AT_external    : 1    
    <2e>   DW_AT_name        : (indirect string, offset: 0x67): main    
    <32>   DW_AT_decl_file   : 1    
    <33>   DW_AT_decl_line   : 2    
    <34>   DW_AT_type        : <0x6d>    
    <38>   DW_AT_low_pc      : 0x4004d4    
    <40>   DW_AT_high_pc     : 0x4004e6    
    <48>   DW_AT_frame_base  : 1 byte block: 9c     (DW_OP_call_frame_cfa)
    <4a>   DW_AT_GNU_all_call_sites: 1    
    <4a>   DW_AT_sibling     : <0x6d>    
 <2><4e>: Abbrev Number: 3 (DW_TAG_lexical_block)
    <4f>   DW_AT_low_pc      : 0x4004d8    
    <57>   DW_AT_high_pc     : 0x4004df    
 <3><5f>: Abbrev Number: 4 (DW_TAG_variable)
    <60>   DW_AT_name        : i    
    <62>   DW_AT_decl_file   : 1    

This says that 'i' is defined in the inner lexical block which
stops at 0x4004df -- it isn't defined at 0x4004e4.

-- 
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] 7+ messages in thread

* [Bug c++/14850] unable to print local variable when stopped at function closing brace '}'
  2012-11-16  3:49 [Bug c++/14850] New: unable to print local variable if stop at function } chihinko at yahoo dot com
  2012-11-16  3:51 ` [Bug c++/14850] unable to print local variable when stopped at function closing brace '}' chihinko at yahoo dot com
  2012-11-19 16:56 ` tromey at redhat dot com
@ 2012-11-19 22:47 ` chihinko at yahoo dot com
  2012-11-20 21:00 ` tromey at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: chihinko at yahoo dot com @ 2012-11-19 22:47 UTC (permalink / raw)
  To: gdb-prs

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

chihinko at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |
     Ever Confirmed|1                           |0

--- Comment #2 from chihinko at yahoo dot com 2012-11-19 22:47:44 UTC ---
(In reply to comment #1)
> I think this is not a gdb bug -- it is just doing what the
> compiler tells it to.
> 
> First, dump the line table:
> 
> barimba. readelf --debug-dump=decodedline ./pr
> Decoded dump of debug contents of section .debug_line:
> 
> CU: pr.cc:
> File name                            Line number    Starting address
> pr.cc                                          2            0x4004d4
> pr.cc                                          4            0x4004d8
> pr.cc                                          5            0x4004e4
> 
> 
> line 5 == 0x4004e4
> 
> 
> Now look at the DWARF:
> 
> barimba. readelf -wi ./pr 
> Contents of the .debug_info section:
> [...]
>  <1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
>     <2e>   DW_AT_external    : 1    
>     <2e>   DW_AT_name        : (indirect string, offset: 0x67): main    
>     <32>   DW_AT_decl_file   : 1    
>     <33>   DW_AT_decl_line   : 2    
>     <34>   DW_AT_type        : <0x6d>    
>     <38>   DW_AT_low_pc      : 0x4004d4    
>     <40>   DW_AT_high_pc     : 0x4004e6    
>     <48>   DW_AT_frame_base  : 1 byte block: 9c     (DW_OP_call_frame_cfa)
>     <4a>   DW_AT_GNU_all_call_sites: 1    
>     <4a>   DW_AT_sibling     : <0x6d>    
>  <2><4e>: Abbrev Number: 3 (DW_TAG_lexical_block)
>     <4f>   DW_AT_low_pc      : 0x4004d8    
>     <57>   DW_AT_high_pc     : 0x4004df    
>  <3><5f>: Abbrev Number: 4 (DW_TAG_variable)
>     <60>   DW_AT_name        : i    
>     <62>   DW_AT_decl_file   : 1    
> 
> This says that 'i' is defined in the inner lexical block which
> stops at 0x4004df -- it isn't defined at 0x4004e4.

But from user's point of view, this is a tool issue, debugging is not working,
although the cause is compiler, compiler shouldn't generate this extra
W_TAG_lexical_block that prevent user to see value of local variables, 
you should file an IZ against gcc.
Older compiler/gdb worked regarding this functionality.

-- 
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] 7+ messages in thread

* [Bug c++/14850] unable to print local variable when stopped at function closing brace '}'
  2012-11-16  3:49 [Bug c++/14850] New: unable to print local variable if stop at function } chihinko at yahoo dot com
                   ` (2 preceding siblings ...)
  2012-11-19 22:47 ` chihinko at yahoo dot com
@ 2012-11-20 21:00 ` tromey at redhat dot com
  2012-11-21  3:18 ` asmwarrior at gmail dot com
  2012-11-22  3:57 ` chihinko at yahoo dot com
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-11-20 21:00 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Tom Tromey <tromey at redhat dot com> 2012-11-20 21:00:41 UTC ---
I don't know if it is a gcc bug or not.
You can file a gcc bug report if you want.
It definitely is not a gdb bug, so I am closing this.

-- 
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] 7+ messages in thread

* [Bug c++/14850] unable to print local variable when stopped at function closing brace '}'
  2012-11-16  3:49 [Bug c++/14850] New: unable to print local variable if stop at function } chihinko at yahoo dot com
                   ` (3 preceding siblings ...)
  2012-11-20 21:00 ` tromey at redhat dot com
@ 2012-11-21  3:18 ` asmwarrior at gmail dot com
  2012-11-22  3:57 ` chihinko at yahoo dot com
  5 siblings, 0 replies; 7+ messages in thread
From: asmwarrior at gmail dot com @ 2012-11-21  3:18 UTC (permalink / raw)
  To: gdb-prs

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

asmwarrior <asmwarrior at gmail dot com> changed:

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

--- Comment #4 from asmwarrior <asmwarrior at gmail dot com> 2012-11-21 03:18:09 UTC ---
Quote: Older compiler/gdb worked regarding this functionality.


Does this related to the change of gcc in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49951

-- 
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] 7+ messages in thread

* [Bug c++/14850] unable to print local variable when stopped at function closing brace '}'
  2012-11-16  3:49 [Bug c++/14850] New: unable to print local variable if stop at function } chihinko at yahoo dot com
                   ` (4 preceding siblings ...)
  2012-11-21  3:18 ` asmwarrior at gmail dot com
@ 2012-11-22  3:57 ` chihinko at yahoo dot com
  5 siblings, 0 replies; 7+ messages in thread
From: chihinko at yahoo dot com @ 2012-11-22  3:57 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from chihinko at yahoo dot com 2012-11-22 03:57:16 UTC ---
(In reply to comment #4)
> Quote: Older compiler/gdb worked regarding this functionality.
> 
> 
> Does this related to the change of gcc in
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49951

No, it's not related.

-- 
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] 7+ messages in thread

end of thread, other threads:[~2012-11-22  3:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-16  3:49 [Bug c++/14850] New: unable to print local variable if stop at function } chihinko at yahoo dot com
2012-11-16  3:51 ` [Bug c++/14850] unable to print local variable when stopped at function closing brace '}' chihinko at yahoo dot com
2012-11-19 16:56 ` tromey at redhat dot com
2012-11-19 22:47 ` chihinko at yahoo dot com
2012-11-20 21:00 ` tromey at redhat dot com
2012-11-21  3:18 ` asmwarrior at gmail dot com
2012-11-22  3:57 ` chihinko at yahoo 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).