<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - lldb-mi expressions that have spaces aren't parsed properly for -var-create"
   href="https://llvm.org/bugs/show_bug.cgi?id=29129">29129</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lldb-mi expressions that have spaces aren't parsed properly for -var-create
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.9
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>edmunoz@microsoft.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When creating a variable in lldb-mi through "-var-create", if the expression
has any spaces, the parsing will fail.

Sample debug session

-gdb-set solib-search-path "/Users/edmunoz/code/cpp"
^done
(gdb)
-file-exec-and-symbols /Users/edmunoz/code/cpp/test2
^done
(gdb)
-break-insert main
(gdb)
[...]
-exec-run
^running
[...]
-var-create - - "x = 2" --thread 1 --frame 0
^error,msg="Command 'var-create'. Command Args. Validation failed. Args missing
additional information: thread, frame. Not all arguments or options were
recognised: 1 0"
(gdb)
# Executing it with no spaces succeeds
-var-create - - "x=2" --thread 1 --frame 0
^done,name="var1",numchild="0",value="2",type="int",thread-id="1",has_more="0"


The problem lies in the extraction of the options for "long options" (starting
with "--"). It's using `MIUtilString::SplitConsiderQuotes` or
`MIUtilString::Split` depending on the type it expects the next option to be.
For example, for the option "--thread", it expects the next option to be a
number (thread id).

However, splitting the whole command considering quotes or not based on the
type of the next option is incorrect.

I will be sending a patch with a fix.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>