[Bug 30568] New: [lldb-mi] -var-assign doesn't accept some valid values

Bug ID 30568
Summary [lldb-mi] -var-assign doesn’t accept some valid values
Product lldb
Version 3.9
Hardware PC
OS All
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter edmunoz@microsoft.com
CC llvm-bugs@lists.llvm.org
Classification Unclassified

Related to https://llvm.org/bugs/show_bug.cgi?id=30423

-var-assign should allow assigning certain values to variables. The supported
types seems to be ints and floats (different encodings).

For example, assigning a valid value such as "true", "false", "'a'" all fail.
These assignments succeed if the "equivalent" integer value is used instead (1,
0, 97 (ascii), respectively). Other debuggers like GDB do support these values
to be used with the command -var-assign.

Repro (where z is a boolean variable):

-var-create - - "z" --thread 1 --frame 0
^done,name="var2",numchild="0",value="true",type="bool",thread-id="1",has_more="0"
(gdb)
## Assigning "false" fails
-var-assign var2 "false"
^error,msg="expression could not be evaluated"
(gdb)
## Assigning "0" succeeds
-var-assign var2 "0"
^done,value="false"
(gdb)
-var-evaluate-expression var2
^done,value="false"
(gdb)

The expected behavior is the same as GDB:
-var-create - * "z"
^done,name="var1",numchild="0",value="true",type="bool",thread-id="1",has_more="0"
(gdb)
-var-assign var1 "false"
^done,value="false"
(gdb)
-var-evaluate-expression var1
^done,value="false"
(gdb)

abidh changed bug 30568