From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11033 invoked by alias); 18 Feb 2012 13:30:04 -0000 Received: (qmail 11002 invoked by uid 22791); 18 Feb 2012 13:30:03 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 18 Feb 2012 13:29:49 +0000 From: "dodji at seketeli dot org" To: gdb-prs@sourceware.org Subject: [Bug varobj/13708] New: erasure of an element from std::vector isn't reported by -var-update, when pretty printing is enabled Date: Sat, 18 Feb 2012 13:30:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: varobj X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dodji at seketeli dot org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2012-q1/txt/msg00284.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=3D13708 Bug #: 13708 Summary: erasure of an element from std::vector isn't reported by -var-update, when pretty printing is enabled Product: gdb Version: unknown Status: NEW Severity: normal Priority: P2 Component: varobj AssignedTo: unassigned@sourceware.org ReportedBy: dodji@seketeli.org Classification: Unclassified Consider this short code snippet: 1 #include 2 #include 3 #include 4 5 int 6 main() 7 { 8 std::string s1 =3D "k=C3=A9l=C3=A9", s2 =3D "fila", s3 =3D "sab= a"; 9 std::vector v; 10 v.push_back(s1); 11 v.push_back(s2); 12 v.push_back(s3); 13 14 std::vector::iterator i =3D v.begin (); 15 i +=3D 2; 16 17 v.erase (i); 18 19 unsigned s =3D v.size (); 20 std::cout << "v.size (): " << s; 21 22 return 0; 23 } Here are the actions I perform: First, I enable pretty printing in MI2 mode.=20=20 Then I create a variable object for vector 'v' right after executing line 9= and I -var-list-children it there. Then after each step, I -var-update the varobj. Everything goes fine.=20 -var-update correctly reports the new string being appended to the vector '= v' at each step. But then after line 17, (that erases the last element of the vector), -var-update on the varobj does not report the fact that the variable got deleted. This is annoying as the front end can not update their graphical representa= tion of the variable 'v' accordingly. Below is the detail of the GDB session. $ libtool e gdb --interpreter=3Dmi2 ./prettyprint=20 =3Dthread-group-added,id=3D"i1" ~"GNU gdb (GDB) Fedora (7.3.50.20110722-10.fc16)\n" ~"Copyright (C) 2011 Free Software Foundation, Inc.\n" ~"License GPLv3+: GNU GPL version 3 or later \nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted = by law. Type \"show copying\"\nand \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-redhat-linux-gnu\".\nFor bug reporting instructions, please see:\n" ~"...\n" ~"Reading symbols from /devel/dodji/git/nemiver/better-variable-update/build/tests/prettyprint..." ~"done.\n" (gdb)=20 -enable-pretty-printing ^done (gdb)=20 b main &"b main\n" ~"Breakpoint 1 at 0x400c4d: file /home/dodji/devel/git/nemiver/better-variable-update/tests/pretty-print.cc, line 8.\n" =3Dbreakpoint-created,bkpt=3D{number=3D"1",type=3D"breakpoint",disp=3D"keep= ",enabled=3D"y",addr=3D"0x0000000000400c4d",func=3D"main()",file=3D"/home/d= odji/devel/git/nemiver/better-variable-update/tests/pretty-print.cc",fullna= me=3D"/devel/dodji/git/nemiver/better-variable-update/tests/pretty-print.cc= ",line=3D"8",times=3D"0",original-location=3D"main"} ^done (gdb)=20 run &"run\n" ~"Starting program: /devel/dodji/git/nemiver/better-variable-update/build/tests/prettyprint \n" =3Dthread-group-started,id=3D"i1",pid=3D"13812" =3Dthread-created,id=3D"1",group-id=3D"i1" ^running *running,thread-id=3D"all" (gdb)=20 =3Dlibrary-loaded,id=3D"/lib64/ld-linux-x86-64.so.2",target-name=3D"/lib64/= ld-linux-x86-64.so.2",host-name=3D"/lib64/ld-linux-x86-64.so.2",symbols-loa= ded=3D"0",thread-group=3D"i1" =3Dlibrary-loaded,id=3D"/usr/lib64/libstdc++.so.6",target-name=3D"/usr/lib6= 4/libstdc++.so.6",host-name=3D"/usr/lib64/libstdc++.so.6",symbols-loaded=3D= "0",thread-group=3D"i1" =3Dlibrary-loaded,id=3D"/lib64/libm.so.6",target-name=3D"/lib64/libm.so.6",= host-name=3D"/lib64/libm.so.6",symbols-loaded=3D"0",thread-group=3D"i1" =3Dlibrary-loaded,id=3D"/lib64/libgcc_s.so.1",target-name=3D"/lib64/libgcc_= s.so.1",host-name=3D"/lib64/libgcc_s.so.1",symbols-loaded=3D"0",thread-grou= p=3D"i1" =3Dlibrary-loaded,id=3D"/lib64/libc.so.6",target-name=3D"/lib64/libc.so.6",= host-name=3D"/lib64/libc.so.6",symbols-loaded=3D"0",thread-group=3D"i1" =3Dbreakpoint-modified,bkpt=3D{number=3D"1",type=3D"breakpoint",disp=3D"kee= p",enabled=3D"y",addr=3D"0x0000000000400c4d",func=3D"main()",file=3D"/home/= dodji/devel/git/nemiver/better-variable-update/tests/pretty-print.cc",fulln= ame=3D"/devel/dodji/git/nemiver/better-variable-update/tests/pretty-print.c= c",line=3D"8",times=3D"1",original-location=3D"main"} ~"\nBreakpoint " ~"1, main () at /home/dodji/devel/git/nemiver/better-variable-update/tests/pretty-print.cc:= 8\n" ~"8\t std::string s1 =3D \"k\303\251l\303\251\", s2 =3D \"fila\", s3 =3D \"saba\";\n" *stopped,frame=3D{addr=3D"0x0000000000400c4d",func=3D"main",args=3D[],file= =3D"/home/dodji/devel/git/nemiver/better-variable-update/tests/pretty-print= .cc",fullname=3D"/devel/dodji/git/nemiver/better-variable-update/tests/pret= ty-print.cc",line=3D"8"},thread-id=3D"1",stopped-threads=3D"all",core=3D"2" (gdb)=20 -enable-pretty-printing ^done (gdb)=20 n &"n\n" ^running *running,thread-id=3D"1" (gdb)=20 ~"9\t std::vector v;\n" *stopped,frame=3D{addr=3D"0x0000000000400cd4",func=3D"main",args=3D[],file= =3D"/home/dodji/devel/git/nemiver/better-variable-update/tests/pretty-print= .cc",fullname=3D"/devel/dodji/git/nemiver/better-variable-update/tests/pret= ty-print.cc",line=3D"9"},thread-id=3D"1",stopped-threads=3D"all",core=3D"3" (gdb)=20 n &"n\n" ^running *running,thread-id=3D"1" (gdb)=20 ~"10\t v.push_back(s1);\n" *stopped,frame=3D{addr=3D"0x0000000000400ce0",func=3D"main",args=3D[],file= =3D"/home/dodji/devel/git/nemiver/better-variable-update/tests/pretty-print= .cc",fullname=3D"/devel/dodji/git/nemiver/better-variable-update/tests/pret= ty-print.cc",line=3D"10"},thread-id=3D"1",stopped-threads=3D"all",core=3D"2" (gdb)=20 -var-create - * v ^done,name=3D"var1",numchild=3D"0",value=3D"{...}",type=3D"std::vector, std::allocator >, std::allocator, std::allocator > > >",thread-id=3D"1",displayhint=3D"array",dynamic=3D"1",has_more=3D"0" (gdb)=20 -var-list-children --all-values var1 ^done,numchild=3D"0",displayhint=3D"array",has_more=3D"0" (gdb)=20 n &"n\n" ^running *running,thread-id=3D"1" (gdb)=20 ~"11\t v.push_back(s2);\n" *stopped,frame=3D{addr=3D"0x0000000000400cf3",func=3D"main",args=3D[],file= =3D"/home/dodji/devel/git/nemiver/better-variable-update/tests/pretty-print= .cc",fullname=3D"/devel/dodji/git/nemiver/better-variable-update/tests/pret= ty-print.cc",line=3D"11"},thread-id=3D"1",stopped-threads=3D"all",core=3D"0" (gdb)=20 -var-update --all-values var1 ^done,changelist=3D[{name=3D"var1",value=3D"{...}",in_scope=3D"true",type_c= hanged=3D"false",new_num_children=3D"1",displayhint=3D"array",dynamic=3D"1"= ,has_more=3D"0",new_children=3D[{name=3D"var1.[0]",exp=3D"[0]",numchild=3D"= 0",value=3D" \"k\303\251l\303\251\"",type=3D"std::basic_string, std::allocator >",thread-id=3D"1",displayhint=3D"string",dynamic=3D"1= "}]}] (gdb)=20 n &"n\n" ^running *running,thread-id=3D"1" (gdb)=20 ~"12\t v.push_back(s3);\n" *stopped,frame=3D{addr=3D"0x0000000000400d06",func=3D"main",args=3D[],file= =3D"/home/dodji/devel/git/nemiver/better-variable-update/tests/pretty-print= .cc",fullname=3D"/devel/dodji/git/nemiver/better-variable-update/tests/pret= ty-print.cc",line=3D"12"},thread-id=3D"1",stopped-threads=3D"all",core=3D"1" (gdb)=20 -var-update --all-values var1 ^done,changelist=3D[{name=3D"var1",value=3D"{...}",in_scope=3D"true",type_c= hanged=3D"false",new_num_children=3D"2",displayhint=3D"array",dynamic=3D"1"= ,has_more=3D"0",new_children=3D[{name=3D"var1.[1]",exp=3D"[1]",numchild=3D"= 0",value=3D" \"fila\"",type=3D"std::basic_string, std::allocator >",thread-id=3D"1",displayhint=3D"string",dynamic=3D"1= "}]}] (gdb)=20 n &"n\n" ^running *running,thread-id=3D"1" (gdb)=20 ~"14\t std::vector::iterator i =3D v.begin ();\n" *stopped,frame=3D{addr=3D"0x0000000000400d19",func=3D"main",args=3D[],file= =3D"/home/dodji/devel/git/nemiver/better-variable-update/tests/pretty-print= .cc",fullname=3D"/devel/dodji/git/nemiver/better-variable-update/tests/pret= ty-print.cc",line=3D"14"},thread-id=3D"1",stopped-threads=3D"all",core=3D"2" (gdb)=20 n &"n\n" ^running *running,thread-id=3D"1" (gdb)=20 ~"15\t i +=3D 2;\n" *stopped,frame=3D{addr=3D"0x0000000000400d29",func=3D"main",args=3D[],file= =3D"/home/dodji/devel/git/nemiver/better-variable-update/tests/pretty-print= .cc",fullname=3D"/devel/dodji/git/nemiver/better-variable-update/tests/pret= ty-print.cc",line=3D"15"},thread-id=3D"1",stopped-threads=3D"all",core=3D"0" (gdb)=20 n &"n\n" ^running *running,thread-id=3D"1" (gdb)=20 ~"17\t v.erase (i);\n" *stopped,frame=3D{addr=3D"0x0000000000400d44",func=3D"main",args=3D[],file= =3D"/home/dodji/devel/git/nemiver/better-variable-update/tests/pretty-print= .cc",fullname=3D"/devel/dodji/git/nemiver/better-variable-update/tests/pret= ty-print.cc",line=3D"17"},thread-id=3D"1",stopped-threads=3D"all",core=3D"2" (gdb)=20 n &"n\n" ^running *running,thread-id=3D"1" (gdb)=20 ~"19\t unsigned s =3D v.size ();\n" *stopped,frame=3D{addr=3D"0x0000000000400d57",func=3D"main",args=3D[],file= =3D"/home/dodji/devel/git/nemiver/better-variable-update/tests/pretty-print= .cc",fullname=3D"/devel/dodji/git/nemiver/better-variable-update/tests/pret= ty-print.cc",line=3D"19"},thread-id=3D"1",stopped-threads=3D"all",core=3D"2" (gdb)=20 -var-update --all-values var1 ^done,changelist=3D[] (gdb)=20 Note here, how, after erasing the last element of the vector, -var-update --all-values var1 says that nothing has changed in the variable. I think it should report the change, somehow. --=20 Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=3Demail ------- You are receiving this mail because: ------- You are on the CC list for the bug.