diff options
author | Hiroki <h.imai.833@nitech.jp> | 2021-08-30 14:12:29 +0200 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2021-08-30 15:14:09 +0200 |
commit | ffcf571107594ff5d02bc2410266efe527787fb0 (patch) | |
tree | 4488b55217ad7f45b94a8e407e788312d3f4ae22 /llvm/lib/Support/SmallVector.cpp | |
parent | 21d11c87a21b007da20cb3b55bfe6a4c33679ee3 (diff) | |
download | llvm-ffcf571107594ff5d02bc2410266efe527787fb0.zip llvm-ffcf571107594ff5d02bc2410266efe527787fb0.tar.gz llvm-ffcf571107594ff5d02bc2410266efe527787fb0.tar.bz2 |
[LLDB] Fix 'std::out_of_range' crashing bug when file name completion using file path.
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
Diffstat (limited to 'llvm/lib/Support/SmallVector.cpp')
0 files changed, 0 insertions, 0 deletions