[lldb-dev] [Bug 29129] New: lldb-mi expressions that have spaces aren't parsed properly for -var-create

via lldb-dev lldb-dev at lists.llvm.org
Wed Aug 24 16:19:53 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=29129

            Bug ID: 29129
           Summary: lldb-mi expressions that have spaces aren't parsed
                    properly for -var-create
           Product: lldb
           Version: 3.9
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: edmunoz at microsoft.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160824/5c93f87a/attachment.html>


More information about the lldb-dev mailing list