From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9091 invoked by alias); 30 Nov 2012 02:55:28 -0000 Received: (qmail 9004 invoked by uid 48); 30 Nov 2012 02:55:11 -0000 From: "chihin.ko at oracle dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55541] New: unable to see local variables due extra lexical block was generated Date: Fri, 30 Nov 2012 02:55:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: chihin.ko at oracle dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg02957.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55541 Bug #: 55541 Summary: unable to see local variables due extra lexical block was generated Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: chihin.ko@oracle.com There is a regression present gcc4.4.4: the compiler generates a bogus lexical block marker in the debug info, more precisely between the parameters and the local variables of functions. This is related to http://gcc.gnu.org/ml/gcc-patches/2010-08/msg02111.html This affect gdb/dbx behavior, that debugger users are not able to inspect local variable value when stop at "}" line of a function, for detail, please refer to gdb bugzilla http://sourceware.org/bugzilla/show_bug.cgi?id=14850 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) This is due to "i" was within DW_TAG_lexical_block: < 1><0x00000025> DW_TAG_subprogram DW_AT_external yes(1) DW_AT_name "main" DW_AT_decl_file 0x00000001 /tmp/t.cc DW_AT_decl_line 0x00000003 DW_AT_type <0x00000059> DW_AT_low_pc 0x08050990 DW_AT_high_pc 0x080509a4 DW_AT_frame_base [ 0]DW_OP_breg4+4 [ 1]DW_OP_breg4+8 [ 2]DW_OP_breg5+8 [ 3]DW_OP_breg4+4 DW_AT_GNU_all_call_sites yes(1) DW_AT_sibling <0x00000059> < 2><0x00000042> DW_TAG_lexical_block DW_AT_low_pc 0x08050996 DW_AT_high_pc 0x0805099d < 3><0x0000004b> DW_TAG_variable DW_AT_name "i" DW_AT_decl_file 0x00000001 /tmp/t.cc DW_AT_decl_line 0x00000004 DW_AT_type <0x00000059> DW_AT_location DW_OP_fbreg -12 < 1><0x00000059> DW_TAG_base_type DW_AT_byte_size 0x00000004 DW_AT_encoding DW_ATE_signed DW_AT_name "int"