llvm/lldb/source
Hiroki ffcf571107 [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
2021-08-30 15:14:09 +02:00
..
API Ah, fix formatting, I didn't notice lldb-instr's code 2021-08-16 13:46:54 -07:00
Breakpoint [lldb] Use a struct to pass function search options to Module::FindFunction 2021-08-05 10:18:14 -07:00
Commands [lldb] Allow to register frame recognizers applied beyond the first instruction 2021-08-29 17:28:46 +02:00
Core [LLDB][GUI] Add initial searcher support 2021-08-25 13:55:11 -07:00
DataFormatters [nfc] [lldb] Prevent needless copies of DataExtractor 2021-08-04 20:35:53 +02:00
Expression [lldb] [gdb-remote] Add eOpenOptionReadWrite for future gdb compat 2021-08-09 12:06:59 +02:00
Host [LLDB] Fix 'std::out_of_range' crashing bug when file name completion using file path. 2021-08-30 15:14:09 +02:00
Initialization [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
Interpreter [lldb] [gdb-remote] Add eOpenOptionReadWrite for future gdb compat 2021-08-09 12:06:59 +02:00
Plugins [lldb][NFC] Remove TypeSystemClang::CreateFunctionType overload 2021-08-30 12:28:20 +02:00
Symbol [lldb] Return all line entries matchign a line if no column is specified 2021-08-30 14:45:46 +02:00
Target [lldb] [gdb-remote client] Support minimal fork/vfork handling 2021-08-30 10:24:38 +02:00
Utility [lldb][AArch64] Add memory tag writing to lldb-server 2021-07-27 12:02:17 +01:00
CMakeLists.txt
lldb.cpp [lldb] Reinstate support for LLDB_VERSION_STRING 2021-02-22 16:56:00 -08:00