[lldb-dev] issue with lldb-mi -var-update with pointers
I have a simple testcase that modifies the value pointed to by an int *. I've created a variable with -var-create, and then after the value has been updated, check it with -var-update. -var-update returns no changes, but the value has changed. test.c: #include int main(void) { int vec[] = {1, 2, 3, 4}; int foo = 0; int *bar = &foo; int i = 0; for (i = 0; i < 4; i++) *bar += vec[i]; return foo; } Commands: -break-insert -t -f test.c:10 -break-insert -t -f test.c:13 -exec-run -var-create --thread 1 --frame 0 - * bar -var-list-children var0 -var-evaluate-expression var0.*bar -exec-continue -var-update 1 var0 -var-evaluate-expression var0.*bar Output: (gdb) -var-create --thread 1 --frame 0 - * bar ^done,name="var0",numchild="1",value="0x7fffed30",type="int *",thread-id="1",has_more="0" (gdb) -var-list-children var0 ^done,numchild="1",children=[child={name="var0.*bar",exp="*bar",numchild="0" ,type="int",thread-id="1",has_more="0"}],has_more="0" (gdb) -var-evaluate-expression var0.*bar ^done,value="0" ***Value is 0 (gdb) -exec-continue ^running (gdb) =thread-exited,id="1",group-id="i1" (gdb) *running,thread-id="all" (gdb) =thread-created,id="1",group-id="i1" (gdb) *stopped,reason="breakpoint-hit",disp="del",bkptno="2",frame={level="0",addr ="0x00400530",func="main",args=[],file="test.c",fullname="/local/scr atch/ted/tip/newfull/test.c",line="13"},thread-id="1",stopped-threads="all" (gdb) -var-update 1 var0 ^done,changelist=[] ***No changes (gdb) -var-evaluate-expression var0.*bar ^done,value="10" ***Value is 10, even though we reported no changes. The child shows an update: (gdb) -var-update 1 var0.*bar ^done,changelist=[{name="var0.*bar",value="10",in_scope="true",type_changed= "false",has_more="0"}] -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ___ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
Re: [lldb-dev] issue with lldb-mi -var-update with pointers
I see 2 problems here. CMICmdCmdVarUpdate::ExamineSBValueForChange seems to ignore the changes in in children for pointer and references. It is easy enough to fix. The other issue is that we dont not print the changed child value. For example, with the first issue fixed, I get -var-update 1 var0 ^done,changelist=[{name="var0",value="0x7fffed30",in_scope="true",type_changed="false",has_more="0"}] This problem exist for aggregate types too. I think I can put the fix for the first problem if it will help you. Please let me know. Thanks, Abid From: lldb-dev on behalf of Ted Woodward via lldb-dev Sent: Tuesday, May 30, 2017 9:50 PM To: 'LLDB' Subject: [lldb-dev] issue with lldb-mi -var-update with pointers I have a simple testcase that modifies the value pointed to by an int *. I've created a variable with -var-create, and then after the value has been updated, check it with -var-update. -var-update returns no changes, but the value has changed. test.c: #include int main(void) { int vec[] = {1, 2, 3, 4}; int foo = 0; int *bar = &foo; int i = 0; for (i = 0; i < 4; i++) *bar += vec[i]; return foo; } Commands: -break-insert -t -f test.c:10 -break-insert -t -f test.c:13 -exec-run -var-create --thread 1 --frame 0 - * bar -var-list-children var0 -var-evaluate-expression var0.*bar -exec-continue 1 var0 -var-evaluate-expression var0.*bar Output: (gdb) -var-create --thread 1 --frame 0 - * bar ^done,name="var0",numchild="1",value="0x7fffed30",type="int *",thread-id="1",has_more="0" (gdb) -var-list-children var0 ^done,numchild="1",children=[child={name="var0.*bar",exp="*bar",numchild="0" ,type="int",thread-id="1",has_more="0"}],has_more="0" (gdb) -var-evaluate-expression var0.*bar ^done,value="0" ***Value is 0 (gdb) -exec-continue ^running (gdb) =thread-exited,id="1",group-id="i1" (gdb) *running,thread-id="all" (gdb) =thread-created,id="1",group-id="i1" (gdb) *stopped,reason="breakpoint-hit",disp="del",bkptno="2",frame={level="0",addr ="0x00400530",func="main",args=[],file="test.c",fullname="/local/scr atch/ted/tip/newfull/test.c",line="13"},thread-id="1",stopped-threads="all" (gdb) -var-update 1 var0 ^done,changelist=[] ***No changes (gdb) -var-evaluate-expression var0.*bar ^done,value="10" ***Value is 10, even though we reported no changes. The child shows an update: (gdb) -var-update 1 var0.*bar ^done,changelist=[{name="var0.*bar",value="10",in_scope="true",type_changed= "false",has_more="0"}] -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ___ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev ___ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
Re: [lldb-dev] issue with lldb-mi -var-update with pointers
Yes, please fix the first problem. Thanks! -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project > -Original Message- > From: Abid, Hafiz [mailto:hafiz_a...@mentor.com] > Sent: Wednesday, May 31, 2017 7:09 AM > To: Ted Woodward > Cc: lldb-dev@lists.llvm.org > Subject: Re: [lldb-dev] issue with lldb-mi -var-update with pointers > > I see 2 problems here. CMICmdCmdVarUpdate::ExamineSBValueForChange > seems to ignore the changes in in children for pointer and references. It is > easy enough to fix. The other issue is that we dont not print the changed > child value. > For example, with the first issue fixed, I get > > -var-update 1 var0 > ^done,changelist=[{name="var0",value="0x7fffed30",in_scope="tru > e",type_changed="false",has_more="0"}] > > This problem exist for aggregate types too. > > I think I can put the fix for the first problem if it will help you. Please let me > know. > > Thanks, > Abid > ____ > From: lldb-dev on behalf of Ted > Woodward via lldb-dev > Sent: Tuesday, May 30, 2017 9:50 PM > To: 'LLDB' > Subject: [lldb-dev] issue with lldb-mi -var-update with pointers > > I have a simple testcase that modifies the value pointed to by an int *. > I've created a variable with -var-create, and then after the value has been > updated, check it with -var-update. -var-update returns no changes, but the > value has changed. > > test.c: > #include > > int main(void) > { > int vec[] = {1, 2, 3, 4}; > int foo = 0; > int *bar = &foo; > int i = 0; > > for (i = 0; i < 4; i++) > *bar += vec[i]; > > return foo; > } > > Commands: > -break-insert -t -f test.c:10 > -break-insert -t -f test.c:13 > -exec-run > -var-create --thread 1 --frame 0 - * bar -var-list-children var0 -var-evaluate- > expression var0.*bar -exec-continue > 1 var0 > -var-evaluate-expression var0.*bar > > > Output: > (gdb) > -var-create --thread 1 --frame 0 - * bar > ^done,name="var0",numchild="1",value="0x7fffed30",type="int > *",thread-id="1",has_more="0" > (gdb) > -var-list-children var0 > ^done,numchild="1",children=[child={name="var0.*bar",exp="*bar",numch > ild="0" > ,type="int",thread-id="1",has_more="0"}],has_more="0" > (gdb) > -var-evaluate-expression var0.*bar > ^done,value="0" > > ***Value is 0 > > (gdb) > -exec-continue > ^running > (gdb) > =thread-exited,id="1",group-id="i1" > (gdb) > *running,thread-id="all" > (gdb) > =thread-created,id="1",group-id="i1" > (gdb) > *stopped,reason="breakpoint- > hit",disp="del",bkptno="2",frame={level="0",addr > ="0x00400530",func="main",args=[],file="test.c",fullname="/local/s > cr > atch/ted/tip/newfull/test.c",line="13"},thread-id="1",stopped-threads="all" > (gdb) > -var-update 1 var0 > ^done,changelist=[] > > ***No changes > > (gdb) > -var-evaluate-expression var0.*bar > ^done,value="10" > > ***Value is 10, even though we reported no changes. > > The child shows an update: > (gdb) > -var-update 1 var0.*bar > ^done,changelist=[{name="var0.*bar",value="10",in_scope="true",type_ch > anged= > "false",has_more="0"}] > > > -- > Qualcomm Innovation Center, Inc. > The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a > Linux Foundation Collaborative Project > > > ___ > lldb-dev mailing list > lldb-dev@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev ___ lldb-dev mailing list lldb-dev@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev