GDB/LLDB plugin: correctly handle string escaping and unescaping
ClosedPublic

Authored by qi437103 on Aug 9 2016, 2:03 AM.

Details

Summary
  • Fix wrong implementation of quoteExpression/unquoteExpression, add unit tests for it

quoteExpression is used in MIVariable when creating new watch variables, original code didn't
escape '\\' in the expression, so the user can't input expression containing '\\'.

unqouteExpression in used in MIBreakpointcontroller to extract path from breakpoint notification
emitted from debugger, because GDB escapes these paths twice, so after regular unescape happens when
parsing the MI response, extra escape is needed.

However, in practice, neither GDB nor LLDB can handle reliably paths with special characters
like '\\' or '\"', so no unit test is added to verify the use of unquoteExpression.

  • Improve LLDB data formatter output for non-ascii char, which should be displayed in UI correctly.

LLDB emits unicode escape sequence for non-ascii code. Correct unescape them in the UI.

Test Plan

Added/Changed unit tests:

  • GdbTest::testVariablesWatchesQuotes
  • LldbTest::testVariablesWatchesQuotes
  • LldbTest::testVariablesNonascii

Diff Detail

Repository
R32 KDevelop
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
qi437103 updated this revision to Diff 5748.Aug 9 2016, 2:03 AM
qi437103 retitled this revision from to GDB/LLDB plugin: correctly handle string escaping and unescaping.
qi437103 updated this object.
qi437103 edited the test plan for this revision. (Show Details)
qi437103 added a reviewer: apol.
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptAug 9 2016, 2:03 AM
apol accepted this revision.Aug 13 2016, 11:16 AM
apol edited edge metadata.
apol added inline comments.
debuggers/lldb/unittests/test_lldb.cpp
1872

Unrelated change

This revision is now accepted and ready to land.Aug 13 2016, 11:16 AM
qi437103 marked an inline comment as done.Aug 14 2016, 12:44 AM

Done

qi437103 updated this revision to Diff 5900.Aug 14 2016, 12:47 AM
qi437103 edited edge metadata.

Address inline comments

This revision was automatically updated to reflect the committed changes.