[lldb-dev] issue with lldb-mi -var-update with pointers

Ted Woodward via lldb-dev lldb-dev at lists.llvm.org
Wed May 31 11:11:51 PDT 2017


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_Abid at mentor.com]
> Sent: Wednesday, May 31, 2017 7:09 AM
> To: Ted Woodward <ted.woodward at codeaurora.org>
> Cc: lldb-dev at 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="0x00007fffffffed30",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 <lldb-dev-bounces at lists.llvm.org> on behalf of Ted
> Woodward via lldb-dev <lldb-dev at lists.llvm.org>
> 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 <stdlib.h>
> 
> 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="0x00007fffffffed30",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
> ="0x0000000000400530",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 at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev



More information about the lldb-dev mailing list