This is the mail archive of the archer@sourceware.org mailing list for the Archer 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] |
Tom Tromey wrote: > I'm checking this in on the python branch. > > Last week on irc, Vladimir asked about the handling of the has_more > field when a varobj whose children have not been requested transitioned > from not having children to having children. > > This patch implements what I think is reasonable behavior in this case. I have tested this. Now, when I push an item to an empty vector, KDevelop notices it and marks the variable expandable, and all is good. There's another issue I've run into. I had: std::vector<std::string> v2; I've set breakpoint on this line, and when breakpoint was hit, tried to examine v2. GDB said it has >0 elemens (because v2 is not initialized yet), and then failed to pretty-print the requested members, and did "raw" pretty printing. Is this expected? See http://lvk.cs.msu.su/~ghost/raw.png for a somewhat scary result. Worse, I then run to a place where vector is initialized, but: (gdb) -var-update --all-values * ^done,changelist=[{name="var0",value="{...}",in_scope="true",type_changed="false",new_num_children="2",displayhint="array",has_more="0"}] And this point the vector has 2 elements, which is right. But it does not report any change, so the above scary row value is still displyed. Creating new varobj does show right string values. I could not produce a simple example, I attach the source and makefile that I use for testing. - Volodya (gdb) -var-create var1 @ v2 ^done,name="var1",numchild="0",value="{...}",type="std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >",thread-id="1",has_more="1" (gdb) -var-list-children --all-values "var1" 0 5 Traceback (most recent call last): File "/home/ghost/Build/python/libstdcxx/v6/printers.py", line 469, in to_string return self.val['_M_dataplus']['_M_p'].string (encoding, length = len) RuntimeError: Cannot access memory at address 0x1fa Traceback (most recent call last): File "/home/ghost/Build/python/libstdcxx/v6/printers.py", line 469, in to_string return self.val['_M_dataplus']['_M_p'].string (encoding, length = len) RuntimeError: Cannot access memory at address 0xfffffff4 Traceback (most recent call last): File "/home/ghost/Build/python/libstdcxx/v6/printers.py", line 469, in to_string return self.val['_M_dataplus']['_M_p'].string (encoding, length = len) RuntimeError: Cannot access memory at address 0x1a6 Traceback (most recent call last): File "/home/ghost/Build/python/libstdcxx/v6/printers.py", line 469, in to_string return self.val['_M_dataplus']['_M_p'].string (encoding, length = len) RuntimeError: Cannot access memory at address 0x6 Traceback (most recent call last): File "/home/ghost/Build/python/libstdcxx/v6/printers.py", line 469, in to_string return self.val['_M_dataplus']['_M_p'].string (encoding, length = len) RuntimeError: Cannot access memory at address 0xcf ^done,numchild="5",displayhint="array",children=[child={name="var1 [0]",exp="[0]",numchild="0",value="{\n _M_dataplus = {\n <std::allocator<char>> = {\n <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, \n members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider: \n _M_p = 0x206 <Address 0x206 out of bounds>\n }\n}",type="std::string",thread-id="1"},child={name="var1 [1]",exp="[1]",numchild="0",value="{\n _M_dataplus = {\n <std::allocator<char>> = {\n <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, \n members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider: \n _M_p = 0x0\n }\n}",type="std::string",thread-id="1"},child={name="var1 [2]",exp="[2]",numchild="0",value="{\n _M_dataplus = {\n <std::allocator<char>> = {\n <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, \n members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider: \n _M_p = 0x1b2 <Address 0x1b2 out of bounds>\n }\n}",type="std::string",thread-id="1"},child={name="var1 [3]",exp="[3]",numchild="0",value="{\n _M_dataplus = {\n <std::allocator<char>> = {\n <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, \n members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider: \n _M_p = 0x12 <Address 0x12 out of bounds>\n }\n}",type="std::string",thread-id="1"},child={name="var1 [4]",exp="[4]",numchild="0",value="{\n _M_dataplus = {\n <std::allocator<char>> = {\n <__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, \n members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider: \n _M_p = 0xdb <Address 0xdb out of bounds>\n }\n}",type="std::string",thread-id="1"}],has_more="1"
Attachment:
Makefile
Description: Text document
#include <QtCore/QString> #include <vector> struct B { int i; int j; static int k; }; struct C { int a[3]; }; struct D { int *ptr; }; int B::k = 11; typedef int (*fp)(int); int g = 10; int g2 = 23; void func2() { int foobar = 123; printf("func2\n"); } void func(QString& xs) { int ac = 10; std::string s; func2(); g = 10; xs = "foo"; } class Test { public: QString n; int b; }; struct S1 { int a; int b; }; struct S2 { int a; int b; int c; }; void test_type_changes() { S1 s = {1, 2}; s.a++; { S2 s = {1, 2, 3}; s.c++; s.a++; } } int test_main(int ac, char* av[]) { printf("Hello world\n"); int i = 10; ++i; ++i; ++i; int* p1 = 0x00000000; int** p1_p = &p1; p1 = &g; B* p2 = (B*)0x12345678; g = 77; int (*p3)(int) = (fp)0x000000AE; B p4 = {1, 3}; p4.i = 3; p2 = &p4; int p5[] = {5, 6, 7}; int* p6[] = {&g, &g2}; int p7[][2] = {{1,2}, {5,6}}; B p8[] = {{1,2}, {3,4}}; C p9 = {{7, 8, 9}}; g = 77; const D p9_1 = {&g}; { B p9_1; int i = 15; printf("p9_1\n"); } B& p10 = p4; int& p11 = *p1; int (*p12)[3] = &p5; int (&p13)[3] = p5; char p14[6] = "abc"; wchar_t* p15 = L"test1"; QString s = "test test test test"; std::string ss = "test test test test"; QString* sp = &s; const QString& sr = s; func(s); i = 15; std::vector<int> v; v.push_back(10); v.push_back(11); v.pop_back(); std::vector<std::string> v2; v2.push_back("hi"); v2.push_back("there"); std::vector<int> v3; for (int i = 0; i < 20; ++i) v3.push_back(i); Test* test = new Test; Test& test2 = *test; test->n = "foo"; printf("hi\n"); test = 0; printf("hi2\n"); //printf("hi %d\n", test->b); p5[1] = 14; return 7; } int main(int ac, char* av[]) { test_type_changes(); return test_main(ac, av); }
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |