This is an archive of the discontinued LLVM Phabricator instance.

Fix handling of double quotes (MI)
ClosedPublic

Authored by ki.stfu on Feb 24 2015, 8:05 AM.

Details

Summary
  • Clean CMICmdArgValString::Validate: now it's based on CMIUtilString::SplitConsiderQuotes method:

A bit of introduction:

  1. Command line is wrapped into CMICmdArgContext.
  2. CMICmdArgSet is a set of arguments to be parsed. This class contains CMICmdArgContext as a private member.
  3. MI command is class which is inhereted from CMICmdBase. It contains CMICmdArgSet as a private member.

When command is executed CMICmdBase::ParseArgs() is called. This method adds args for parsing using CMICmdArgSet::Add(). Then CMICmdBase::ParseValidateCmdOptions() is called, which calls CMICmdArgSet::Validate(). Then it gets a number of arguments (using SplitConsiderQuotes().array_length) and for each arguments registered in ParseArgs() tries to validate it using CMICmdArgValBase::Validate(). Every user commands parses this string again (first time it was made in SplitConsiderQuotes) and in case of CMICmdArgValString it was made incorrectly. It searches the first and last quotes (but it should be first and next after first). Besides, it was splitted into 4 cases.
I'm just using SplitConsiderQuotes directly, and I don't split them by hand again.

Actually, I think we should do so in every CMICmdArgVal_XXX::Validate() method.

  • Enable MiInterpreterExecTestCase.test_lldbmi_target_create test
  • Fix MiExecTestCase.test_lldbmi_exec_arguments_set test

All tests pass on OS X.

Diff Detail

Event Timeline

ki.stfu updated this revision to Diff 20599.Feb 24 2015, 8:05 AM
ki.stfu retitled this revision from to Fix handling of double quotes (MI).
ki.stfu updated this object.
ki.stfu edited the test plan for this revision. (Show Details)
ki.stfu added reviewers: abidh, clayborg, emaste, zturner.
ki.stfu added subscribers: abidh, clayborg, emaste and 2 others.
clayborg accepted this revision.Feb 24 2015, 11:10 AM
clayborg edited edge metadata.
This revision is now accepted and ready to land.Feb 24 2015, 11:10 AM
ki.stfu updated this revision to Diff 20759.Feb 26 2015, 7:02 AM
ki.stfu edited edge metadata.

Add CMIUtilString::AddSlashes/StripSlashes; Fix --executable option; Fix -symbol-list-lines command

ki.stfu requested a review of this revision.Feb 26 2015, 7:08 AM
ki.stfu edited edge metadata.
clayborg accepted this revision.Feb 26 2015, 9:43 AM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Feb 26 2015, 9:43 AM
ki.stfu closed this revision.Feb 26 2015, 10:23 AM