hanchenye-llvm-project/lldb/unittests
Bruce Mitchener eb284e4667 Fix segmentation fault in lldb_private::Symbols::LocateExecutableSymbolFile()
Summary:
When `module_spec.GetFileSpec().GetDirectory().AsCString()` returned a `nullptr` this line caused a segmentation fault:

`std::string module_directory = module_spec.GetFileSpec().GetDirectory().AsCString()`

Some context:
I was remote debugging an executable built with Clang in an Ubuntu VM on my Windows machine using lldb-mi. I copied the executable and nothing else from the Ubuntu VM to the Windows machine.

Then started lldb-server in the Ubuntu VM:

```
./bin/lldb-server gdbserver *:8888 -- /home/enlight/Projects/dbgmits/build/Debug/data_tests_target
```

And ran `lldb-mi --interpreter` on Windows with the following commands:

```
-file-exec-and-symbols C:\Projects\data_tests_target
-target-select remote 192.168.56.101:8888
-exec-continue

```

After which the segmentation fault occurred at the aforementioned line. Inside this method `module_spec.GetFileSpec()` returns an empty `FileSpec` (no dir, no filename), while `module_spec.GetSymbolFileSpec().GetFilename()` returns `"libc-2.19.so"`.

Patch thanks to Vadim Macagon.

Reviewers: brucem, zturner, clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D13201

llvm-svn: 249387
2015-10-06 10:17:34 +00:00
..
Host Fix segmentation fault in lldb_private::Symbols::LocateExecutableSymbolFile() 2015-10-06 10:17:34 +00:00
Interpreter Fix linking of unit tests via CMake on Windows. 2015-03-18 16:56:24 +00:00
Utility Make UriParser to support [$HOSTNAME] notation. 2015-08-20 23:09:34 +00:00
CMakeLists.txt Convert the ScriptInterpreter system to a plugin-based one. 2015-07-30 20:28:07 +00:00
gtest_common.h Fix linking of unit tests via CMake on Windows. 2015-03-18 16:56:24 +00:00