llvm-project/lldb
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
..
cmake Use the correct Python lib for each build configuration generated by the Visual Studio CMake generator 2015-10-01 07:47:38 +00:00
docs Have debugserver send the OS version string plus 2015-08-12 03:27:33 +00:00
examples Fix typos. 2015-09-22 05:07:56 +00:00
include Introduce a FormattersMatchData class which contains all the information that data formatters need in one place, and also allows for lazy computation of expensive chunks of information if need be 2015-10-06 01:02:47 +00:00
lib Fix Makefile build by adding LLVMSupport to liblldb 2015-09-18 21:32:10 +00:00
lit Create a check-lldb-unit target to run unit tests. 2015-03-13 20:55:07 +00:00
lldb.xcodeproj Introduce a FormattersMatchData class which contains all the information that data formatters need in one place, and also allows for lazy computation of expensive chunks of information if need be 2015-10-06 01:02:47 +00:00
lldb.xcworkspace Working on getting the OSX build green 2015-05-12 02:20:27 +00:00
resources Only export public symbols with the cmake build. 2015-09-04 00:00:41 +00:00
scripts SBTarget::Attach(SBAttachInfo &) was changed to not be asynchronous back in February and this affected Xcode's abililty to cancel an attach to process by name. 2015-10-05 22:58:37 +00:00
source Fix segmentation fault in lldb_private::Symbols::LocateExecutableSymbolFile() 2015-10-06 10:17:34 +00:00
test [LLDB][MIPS] Skip invalid size watchpoint testcase for MIPS 2015-10-05 10:56:19 +00:00
tools [lldb-mi] Add support for StopAtEntry in MI via "-exec-run --start". 2015-10-01 21:15:43 +00:00
unittests Fix segmentation fault in lldb_private::Symbols::LocateExecutableSymbolFile() 2015-10-06 10:17:34 +00:00
utils Adjustments to syncsource.py. 2015-09-17 19:23:50 +00:00
www Rename clang_type -> compiler_type for variables. 2015-09-24 03:54:50 +00:00
.arcconfig Update .arcconfig to point to reviews.llvm.org 2014-05-20 21:24:59 +00:00
.clang-format Update build instructions / coding conventions. 2015-03-10 23:22:25 +00:00
.gitignore Fix .gitignore to ignore symlinks. 2015-03-31 00:03:00 +00:00
CMakeLists.txt cmake: ensure readline python module target is added before finishing swig. 2015-10-04 01:28:51 +00:00
CODE_OWNERS.txt Convert CRLF to LF in CODE_OWNERS.txt 2015-03-23 14:00:54 +00:00
INSTALL.txt Revert the patch to Test Commit Access 2015-07-06 11:26:51 +00:00
LICENSE.TXT
Makefile Test commit 2015-07-22 08:41:18 +00:00