[Bug 14602] New: expr command should allow casting variables for assignment

http://llvm.org/bugs/show_bug.cgi?id=14602

             Bug #: 14602
           Summary: expr command should allow casting variables for
                    assignment
           Product: lldb
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
        AssignedTo: lldb-dev@cs.uiuc.edu
        ReportedBy: kyle@omnigroup.com
    Classification: Unclassified

I'm trying to poke a private AppKit global variable for testing within my app.

The following command fails:

(lldb) expr __NSStringDrawingShouldAdjustBounds = 1
error: read-only variable is not assignable
error: 1 errors parsing expression

...because lldb has given __NSStringDrawingShouldAdjustBounds the type `void
*const`.

So then I tried this:

(lldb) expr (int)__NSStringDrawingShouldAdjustBounds = 1
error: cast from pointer to smaller type 'int' loses information
error: 1 errors parsing expression

...which isn't what I expected, but okay. This should work:

(lldb) expr (void *)__NSStringDrawingShouldAdjustBounds = 1
error: assignment to cast is illegal, lvalue casts are not supported
error: 1 errors parsing expression

I expected this to work, but it's a gdb-ism. Can lldb do the right thing here
too?

Ashok Thirumurthi changed bug 14602