This is an archive of the discontinued LLVM Phabricator instance.

[Args] Handle backticks
ClosedPublic

Authored by JDevlieghere on Mar 25 2019, 9:49 AM.

Details

Summary

Currently LLDB crashes when autocompleting a command that ends with a backtick.

 ./bin/lldb test.tmp.out
(lldb) target create "test.tmp.out"
Current executable set to 'test.tmp.out' (x86_64).
(lldb) b main
Breakpoint 1: where = TestGDBRemoteRepro.test.tmp.out`main + 22 at simple.c:16:5, address = 0x0000000100000f76
(lldb) r
Process 66563 launched: 'test.tmp.out' (x86_64)
Process 66563 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000f76 TestGDBRemoteRepro.test.tmp.out`main(argc=1, argv=0x00007ffeefbff608) at simple.c:16:5
   13   }
   14
   15   int main (int argc, char const *argv[]) {
-> 16       foo();
   17       return 0;
   18   }
(lldb) bt`Assertion failed: (false && "Unhandled quote character"), function EscapeLLDBCommandArgument, file /Users/jonas/llvm/git-mono/llvm-project/llvm/tools/lldb/source/Utility/Args.cpp, line 650.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

JDevlieghere created this revision.Mar 25 2019, 9:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2019, 9:49 AM
Herald added a subscriber: jdoerfert. · View Herald Transcript

Given the current way lldb command interpreter parser does things (which tries to model a posix shell), (one of) the correct ways to do '-quoting would be to replace each ' char by '\''.

However, this isn't the only problem with how we do tab-completion of quoted strings, so if you want to just fix the crash, I think this is fine.

Given the current way lldb command interpreter parser does things (which tries to model a posix shell), (one of) the correct ways to do '-quoting would be to replace each ' char by '\''.

However, this isn't the only problem with how we do tab-completion of quoted strings, so if you want to just fix the crash, I think this is fine.

Yeah. I didn't dive into the intricacies of this function.

labath accepted this revision.Mar 25 2019, 10:23 AM
This revision is now accepted and ready to land.Mar 25 2019, 10:23 AM
This revision was automatically updated to reflect the committed changes.