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++/14850] unable to print local variable when stopped atfunction closing brace '}'


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.


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