forked from OSchip/llvm-project
ffcf571107
When I run a lldb command that uses filename completion, if I enter a string that is not only a filename but also a string with a non-file name string added, such as "./" that is relative path string , it will crash as soon as I press the [Tab] key. For example, debugging an executable file named "hello" that is compiled from a file named "hello.c" , and I’ll put a breakpoint on line 3 of hello.c. ``` $ lldb ./hello (lldb) breakpoint set --file hello.c --line 3 ``` This is not a problem, but if I set "--file ./hello." and then press [Tab] key to complete file name, lldb crashes. ``` $ lldb ./hello (lldb) breakpoint set --file ./hello.terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 8) > this->size() (which is 7) ``` The crash was caused because substr() (in lldb/source/Host/common/Editline.cpp) cut out string which size is user's input string from the completion string. I modified the code that erase the user's intput string from current line and then add the completion string. Differential Revision: https://reviews.llvm.org/D108817 |
||
---|---|---|
.. | ||
Makefile | ||
TestIOHandlerCompletion.py | ||
main.c |