diff options
| author | Zachary Turner <zturner@google.com> | 2014-07-18 20:36:08 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2014-07-18 20:36:08 +0000 |
| commit | c9bf0c70b5cffd6cc3032683e18cc582a98ffe8a (patch) | |
| tree | 75b33278f03f3a6b98e5d2da40fb6a9189ca51d6 /lldb/source | |
| parent | 754d54fcf8ccf972d0785596aaf83aed4a1edf7f (diff) | |
| download | bcm5719-llvm-c9bf0c70b5cffd6cc3032683e18cc582a98ffe8a.tar.gz bcm5719-llvm-c9bf0c70b5cffd6cc3032683e18cc582a98ffe8a.zip | |
Make lldb -P work on Windows.
lldb -P, which outputs its python path, works by using Host-layer
facilities to get information about the loaded python module. This
Host functionality was unimplemented on Windows, so this patch
implements it. Additionally, it removes a pexpect dependency from
the test runner and uses an equivalent invocation of subprocess.
Reviewed by: Todd Fiala
Differential Revision: http://reviews.llvm.org/D4548
llvm-svn: 213410
Diffstat (limited to 'lldb/source')
| -rw-r--r-- | lldb/source/Host/common/Host.cpp | 6 | ||||
| -rw-r--r-- | lldb/source/Host/windows/Host.cpp | 14 |
2 files changed, 19 insertions, 1 deletions
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 79ae92ace4d..0006a61df0c 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -1152,6 +1152,10 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec) { char raw_path[PATH_MAX]; char resolved_path[PATH_MAX]; +#if defined(_WIN32) + lldb_file_spec.AppendPathComponent("../lib/site-packages"); + lldb_file_spec.GetPath(raw_path, sizeof(raw_path)); +#else lldb_file_spec.GetPath(raw_path, sizeof(raw_path)); #if defined (__APPLE__) @@ -1174,7 +1178,7 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec) ::strncat(raw_path, python_version_dir.c_str(), sizeof(raw_path) - strlen(raw_path) - 1); - +#endif #if defined (__APPLE__) } #endif diff --git a/lldb/source/Host/windows/Host.cpp b/lldb/source/Host/windows/Host.cpp index e2197caf024..9fa265200e4 100644 --- a/lldb/source/Host/windows/Host.cpp +++ b/lldb/source/Host/windows/Host.cpp @@ -247,6 +247,20 @@ FileSpec Host::GetModuleFileSpecForHostAddress (const void *host_addr) { FileSpec module_filespec; + + HMODULE hmodule = NULL; + if (!::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCTSTR)host_addr, &hmodule)) + return module_filespec; + + std::vector<char> buffer(MAX_PATH); + DWORD chars_copied = 0; + do { + chars_copied = ::GetModuleFileName(hmodule, &buffer[0], buffer.size()); + if (chars_copied == buffer.size() && ::GetLastError() == ERROR_INSUFFICIENT_BUFFER) + buffer.resize(buffer.size() * 2); + } while (chars_copied >= buffer.size()); + + module_filespec.SetFile(&buffer[0], false); return module_filespec; } |

