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

Abid, Hafiz via lldb-dev lldb-dev at lists.llvm.org
Wed May 31 05:09:21 PDT 2017

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

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. 

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.

#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;

-break-insert -t -f test.c:10
-break-insert -t -f test.c:13
-var-create --thread 1 --frame 0 - * bar
-var-list-children var0
-var-evaluate-expression var0.*bar
 1 var0
-var-evaluate-expression var0.*bar

-var-create --thread 1 --frame 0 - * bar
-var-list-children var0
-var-evaluate-expression var0.*bar

***Value is 0

-var-update 1 var0

***No changes

-var-evaluate-expression var0.*bar

***Value is 10, even though we reported no changes.

The child shows an update:
-var-update 1 var0.*bar

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

More information about the lldb-dev mailing list