summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/windows
Commit message (Collapse)AuthorAgeFilesLines
* [Host] Return status directly from RunShellCommandJonas Devlieghere2019-10-041-4/+2
| | | | | | Thanks for catching this, Pavel! llvm-svn: 373783
* [Host] Don't discard return value from RunShellCommandJonas Devlieghere2019-10-041-2/+8
| | | | | | | The recent change to expand arguments with the user's shell sometimes caused a timeout and the error was not propagated. llvm-svn: 373776
* Convert FileSystem::Open() to return Expected<FileUP>Lawrence D'Anna2019-09-261-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch converts FileSystem::Open from this prototype: Status Open(File &File, const FileSpec &file_spec, ...); to this one: llvm::Expected<std::unique_ptr<File>> Open(const FileSpec &file_spec, ...); This is beneficial on its own, as llvm::Expected is a more modern and recommended error type than Status. It is also a necessary step towards https://reviews.llvm.org/D67891, and further developments for lldb_private::File. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67996 llvm-svn: 373003
* Revert r372788 "Host: use the platform identifiers from LLVM (NFC)"Hans Wennborg2019-09-251-5/+4
| | | | | | | | | | | | | | | | > Use symbolic constants for the platform identifiers rather than replicating them > locally. This broke the build of LLDB on Windows, see http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/9182 which fails with e.g. E:\build_slave\lldb-x64-windows-ninja\llvm\include\llvm/BinaryFormat/COFF.h(96): error C2059: syntax error: 'constant' E:\build_slave\lldb-x64-windows-ninja\llvm\include\llvm/BinaryFormat/COFF.h(96): error C3805: 'constant': unexpected token, expected either '}' or a ',' E:\build_slave\lldb-x64-windows-ninja\llvm\include\llvm/BinaryFormat/COFF.h(128): error C2059: syntax error: 'constant' ... llvm-svn: 372847
* Host: use the platform identifiers from LLVM (NFC)Saleem Abdulrasool2019-09-241-4/+5
| | | | | | | Use symbolic constants for the platform identifiers rather than replicating them locally. llvm-svn: 372788
* [LLDB] [Windows] Map COFF ARM machine ids to the right triple architecturesMartin Storsjo2019-09-231-0/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D67913 llvm-svn: 372658
* [LLDB] Remove a now redundant windows specific workaroundMartin Storsjo2019-09-231-5/+0
| | | | | | | | | | | | | | | | vsnprintf(NULL, 0, ...) works for measuring the needed string size on all supported Windows variants; it's supported since at least MSVC 2015 (and LLVM requires a newer version than that), and works on both msvcrt.dll (since at least XP) and UCRT with MinGW. The previous use of ifdefs was wrong as well, as __MINGW64__ only is defined for 64 bit targets, and the define without trailing underscores is never defined automatically (neither by clang nor by gcc). Differential Revision: https://reviews.llvm.org/D67861 llvm-svn: 372591
* [LLDB] Add a void* cast when passing object pointers to printf %pMartin Storsjo2019-09-231-14/+10
| | | | | | | | | | This fixes build warnings in MinGW mode. Also remove leftover if (log) {} around the log macro. Differential Revision: https://reviews.llvm.org/D67896 llvm-svn: 372590
* Fix error in ProcessLauncherWindows.cppAdrian McCarthy2019-09-131-1/+1
| | | | | | Restored missing parens on a function call. llvm-svn: 371882
* Enable lldb-server on WindowsAaron Smith2019-08-131-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit contains three small changes to enable lldb-server on Windows. - Add lldb-server for Windows to the build - Disable pty redirection on Windows for the initial lldb-server bring up - Add a support to get the parent pid for a process on Windows - Ifdef some signals which aren't supported on Windows Thanks to Hui Huang for the help with this patch! Reviewers: labath Reviewed By: labath Subscribers: JDevlieghere, compnerd, Hui, amccarth, xiaobai, srhines, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D61686 llvm-svn: 368774
* Various build fixes for lldb on MinGWHaibo Huang2019-08-061-0/+1
| | | | | | | | | | Subscribers: mstorsjo, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65691 llvm-svn: 368069
* Remove usage of usleep in generic codePavel Labath2019-08-051-5/+0
| | | | | | | | This function is not portable, and there are only a handful of usages of it anyway. Replacing it with std::this_thread::sleep_for enables us to get rid of the compatibility code in PosixApi.h. llvm-svn: 367814
* [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)Jonas Devlieghere2019-07-241-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces explicit calls to log::Printf with the new LLDB_LOGF macro. The macro is similar to LLDB_LOG but supports printf-style format strings, instead of formatv-style format strings. So instead of writing: if (log) log->Printf("%s\n", str); You'd write: LLDB_LOG(log, "%s\n", str); This change was done mechanically with the command below. I replaced the spurious if-checks with vim, since I know how to do multi-line replacements with it. find . -type f -name '*.cpp' -exec \ sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" + Differential revision: https://reviews.llvm.org/D65128 llvm-svn: 366936
* [lldb, windows] Update two more locations that use LaunchThread to the new ↵Stella Stamenova2019-07-091-2/+2
| | | | | | function signature llvm-svn: 365526
* [lldb, windows] When StartMonitoring fails, return a proper errorStella Stamenova2019-07-081-7/+8
| | | | | | This is possible now that the function returns an llvm::Expected llvm-svn: 365400
* [lldb] Fix two more issues in Windows following rL365226: Change ↵Stella Stamenova2019-07-081-1/+1
| | | | | | | | LaunchThread interface to return an expected A couple of the function signatures changed and they were not updated in the Windows HostProcess llvm-svn: 365388
* [Host] Fix out-of-line definition on WindowsJonas Devlieghere2019-07-082-2/+2
| | | | | | Add missing interface changes after r365295. llvm-svn: 365358
* [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'Konrad Kleine2019-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: On Windows `lldb::thread_result_t` resolves to `typedef unsigned thread_result_t;` and on other platforms it resolves to `typedef void *thread_result_t;`. Therefore one cannot use `nullptr` when returning from a function that returns `thread_result_t`. I've made this change because a windows build bot fails with these errors: ``` E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Communication.cpp(362): error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t' E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Communication.cpp(362): note: A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type ``` and ``` E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619): error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t' E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619): note: A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664): error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t' E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664): note: A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type ``` This is the failing build: http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/5035/steps/build/logs/stdio Reviewers: JDevlieghere, teemperor, jankratochvil, labath, clayborg, RKSimon, courbet, jhenderson Reviewed By: labath, clayborg Subscribers: labath, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D62305 llvm-svn: 361503
* Fix LLDB warnings when compiling with Clang 8.0Alexandre Ganea2019-05-212-3/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D62021 llvm-svn: 361295
* Clear the output string passed to GetHostName()Aaron Smith2019-04-171-0/+2
| | | | | | | | LLVM's wchar to UTF8 conversion routine expects an empty string to store the output. GetHostName() on Windows is sometimes called with a non-empty string which triggers an assert. The simple fix is to clear the output string before the conversion. llvm-svn: 358550
* Move ProcessInfo from Host to Utility.Zachary Turner2019-03-041-1/+3
| | | | | | | | | | | | | | | | | | | | | There are set of classes in Target that describe the parameters of a process - e.g. it's PID, name, user id, and similar. However, since it is a bare description of a process and contains no actual functionality, there's nothing specifically that makes this appropriate for being in Target -- it could just as well be describing a process on the host, or some hypothetical virtual process that doesn't even exist. To cement this, I'm moving these classes to Utility. It's possible that we can find a better place for it in the future, but as it is neither Host specific nor Target specific, Utility seems like the most appropriate place for the time being. After this there is only 2 remaining references to Target from Host, which I'll address in a followup. Differential Revision: https://reviews.llvm.org/D58842 llvm-svn: 355342
* Fix Windows build after UserIDResolver patch.Zachary Turner2019-03-041-0/+20
| | | | | | | | | That patch added a function to HostInfo that returns an instance of UserIDResolver, but this function was unimplemented on Windows, leading to linker errors. For now, just return a dummy implementation that doesn't resolve user ids to get the build green. llvm-svn: 355329
* Improve process launch comments for WindowsAdrian McCarthy2019-02-281-3/+7
| | | | | | | | | | | | | The existing comment about over-allocating the command line was incorrect. The contents of the command line may be changed, but it's not necessary to over allocate. The changes will be limited to the existing contents of the string (e.g., by replacing spaces with L'\0' to tokenize the command line). Also added a comment explaining a possible cause of failure to save the next programmer some time when they try to debug a 64-bit process from a 32-bit LLDB. llvm-svn: 355121
* [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenvAaron Smith2019-02-071-1/+14
| | | | | | | | | | | | Reviewers: zturner, llvm-commits, labath, serge-sans-paille Reviewed By: labath Subscribers: Hui, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56230 llvm-svn: 353440
* Move FileAction, ProcessInfo and ProcessLaunchInfo from Target to HostPavel Labath2019-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: These classes describe the details of the process we are about to launch, and so they are naturally used by the launching code in the Host module. Previously they were present in Target because that is the most important (but by far not the only) user of the launching code. Since the launching code has other customers, must of which do not care about Targets, it makes sense to move these classes to the Host layer, next to the launching code. This move reduces the number of times that Target is included from host to 8 (it used to be 14). Reviewers: zturner, clayborg, jingham, davide, teemperor Subscribers: emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D56602 llvm-svn: 353047
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1912-48/+36
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [lldb-server] Add unnamed pipe support to PipeWindowsAaron Smith2019-01-101-16/+63
| | | | | | | | | | | | | | | | | Summary: This adds unnamed pipe support in PipeWindows to support communication between a debug server and child process. Modify PipeWindows::CreateNew to support the creation of an unnamed pipe. Rename the previous method that created a named pipe to PipeWindows::CreateNewNamed. Reviewers: zturner, llvm-commits Reviewed By: zturner Subscribers: Hui, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56234 llvm-svn: 350784
* Remove header grouping comments.Jonas Devlieghere2018-11-111-4/+0
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Remove comments after header includes.Jonas Devlieghere2018-11-111-1/+1
| | | | | | | | | | This patch removes the comments following the header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. Differential revision: https://reviews.llvm.org/D54385 llvm-svn: 346625
* Fix some windows-specific fallout from the FileSpec change.Zachary Turner2018-11-031-2/+3
| | | | llvm-svn: 346058
* [FileSystme] Move ::open abstraction into FileSystem.Jonas Devlieghere2018-11-021-0/+9
| | | | | | | This moves the abstraction around ::open into the FileSystem, as is already the case for ::fopen. llvm-svn: 346002
* [Windows] Fix Windows build after be053dd5a384a03da5a77552686900ddc7bfc178Aleksandr Urakov2018-11-024-8/+8
| | | | llvm-svn: 345956
* [FileSystem] Fix Exists call sitesJonas Devlieghere2018-11-011-1/+2
| | | | | | | There were some calls left to Exists() on non-darwin platforms (Windows, Linux and FreeBSD) that weren't yet updated to use the FileSystem. llvm-svn: 345857
* [Windows] Fix threads comparison on WindowsAleksandr Urakov2018-10-181-0/+4
| | | | | | | | | | | | | | | | | | | | | Summary: This patch makes Windows threads to compare by a thread ID, not by a handle. It's because the same thread can have different handles on Windows (for example, `GetCurrentThread` always returns the fake handle `-2`). This leads to some incorrect behavior. For example, in `Process::GetRunLock` always `m_public_run_lock` is returned without this patch. Reviewers: zturner, clayborg, stella.stamenova Reviewed By: stella.stamenova Subscribers: stella.stamenova, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D53357 llvm-svn: 344729
* Do not create new terminals when launching process on Windows with --no-stdioDavid Bolvansky2018-09-121-0/+3
| | | | | | | | | | | | | | Summary: Partially fixes PR38222 Reviewers: teemperor, zturner, stella.stamenova Reviewed By: zturner, stella.stamenova Subscribers: JDevlieghere, clayborg, labath, abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D51966 llvm-svn: 342075
* [windows] Use a well-known path for ComSpec if we fail to retrieve itStella Stamenova2018-07-181-2/+7
| | | | | | | | | | | | | | Summary: Right now we always try to retrieve ComSpec and if we fail, we give up. This rarely fails, but we can update the logic so that we fail even less frequently. Since there is a well-known path (albeit not always correct), try the path when we failed to retrieve it. Note that on other platforms, we generally just return a well-known path without any checking. Reviewers: asmith, zturner, labath Reviewed By: zturner, labath Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D49451 llvm-svn: 337395
* Remove dependency from Host to pythonPavel Labath2018-06-201-12/+0
| | | | | | | | | | | | | | | | Summary: The only reason python was used in the Host module was to compute the python path. I resolve this the same way as D47384 did for clang, by moving the path computation into the python plugin and modifying SBHostOS class to call into this module for ePathTypePythonDir. Reviewers: zturner, jingham, davide Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D48215 llvm-svn: 335104
* Replace HostInfo::GetLLDBPath with specific functionsPavel Labath2018-06-192-5/+4
| | | | | | | | | | | | | | | | | | | | | Summary: Instead of a function taking an enum value determining which path to return, we now have a suite of functions, each returning a single path kind. This makes it easy to move the python-path function into a specific plugin in a follow-up commit. All the users of GetLLDBPath were converted to call specific functions instead. Most of them were hard-coding the enum value anyway, so this conversion was simple. The only exception was SBHostOS, which I've changed to use a switch on the incoming enum value. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48272 llvm-svn: 335052
* Attempt to fix windows&freebsd builds broken by r334950Pavel Labath2018-06-181-3/+3
| | | | llvm-svn: 334952
* Use llvm::VersionTuple instead of manual version marshallingPavel Labath2018-06-181-10/+5
| | | | | | | | | | | | | | | | | | Summary: This has multiple advantages: - we need only one function argument/instance variable instead of three - no need to default initialize variables - no custom parsing code - VersionTuple has comparison operators, which makes version comparisons much simpler Reviewers: zturner, friss, clayborg, jingham Subscribers: emaste, lldb-commits Differential Revision: https://reviews.llvm.org/D47889 llvm-svn: 334950
* [FileSpec] Make style argument mandatory for SetFile. NFCJonas Devlieghere2018-06-134-4/+4
| | | | | | Fix SetFile uses in hosts that I missed in r334663. llvm-svn: 334664
* [lit] Split test_set_working_dir TestProcessLaunch into two tests and fix it ↵Stella Stamenova2018-06-131-1/+8
| | | | | | | | | | | | | | | | | | | | | | on Windows Summary: test_set_working_dir was testing two scenario: failure to set the working dir because of a non existent directory and succeeding to set the working directory. Since the negative case fails on both Linux and Windows, the positive case was never tested. I split the test into two which allows us to always run both the negative and positive cases. The positive case now succeeds on Linux and the negative case still fails. During the investigation, it turned out that lldbtest.py will try to execute a process launch command up to 3 times if the command failed. This means that we could be covering up intermittent failures by running any test that does process launch multiple times without ever realizing it. I've changed the counter to 1 (though it can still be overwritten with the environment variable). This change also fixes both the positive and negative cases on Windows. There were a few issues: 1) In ProcessLauncherWindows::LaunchProcess, the error was not retrieved until CloseHandle was possibly called. Since CloseHandle is also a system API, its success would overwrite any existing error that could be retrieved using GetLastError. So by the time the error was retrieved, it was now a success. 2) In DebuggerThread::StopDebugging TerminateProcess was called on the process handle regardless of whether it was a valid handle. This was causing the process to crash when the handle was LLDB_INVALID_PROCESS (0xFFFFFFFF). 3) In ProcessWindows::DoLaunch we need to check that the working directory exists before launching the process to have the same behavior as other platforms which first check the directory and then launch process. This way we also control the exact error string. Reviewers: labath, zturner, asmith, jingham Reviewed By: labath Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D48050 llvm-svn: 334642
* Fix windows&mac builds broken by r331970 (RunShellCommand/Timeout) refactorPavel Labath2018-05-101-1/+1
| | | | llvm-svn: 331974
* Reflow paragraphs in comments.Adrian Prantl2018-04-306-61/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
* Fix windows and freebsd builds for r322174 (Environment)Pavel Labath2018-01-101-6/+6
| | | | llvm-svn: 322176
* Add Utility/Environment class for handling... environmentsPavel Labath2018-01-101-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There was some confusion in the code about how to represent process environment. Most of the code (ab)used the Args class for this purpose, but some of it used a more basic StringList class instead. In either case, the fact that the underlying abstraction did not provide primitive operations for the typical environment operations meant that even a simple operation like checking for an environment variable value was several lines of code. This patch adds a separate Environment class, which is essentialy a llvm::StringMap<std::string> in disguise. To standard StringMap functionality, it adds a couple of new functions, which are specific to the environment use case: - (most important) envp conversion for passing into execve() and likes. Instead of trying to maintain a constantly up-to-date envp view, it provides a function which creates a envp view on demand, with the expectation that this will be called as the very last thing before handing the value to the system function. - insert(StringRef KeyEqValue) - splits KeyEqValue into (key, value) pair and inserts it into the environment map. - compose(value_type KeyValue) - takes a map entry and converts in back into "KEY=VALUE" representation. With this interface most of the environment-manipulating code becomes one-liners. The only tricky part was maintaining compatibility in SBLaunchInfo, which expects that the environment entries are accessible by index and that the returned const char* is backed by the launch info object (random access into maps is hard and the map stores the entry in a deconstructed form, so we cannot just return a .c_str() value). To solve this, I have the SBLaunchInfo convert the environment into the "envp" form, and use it to answer the environment queries. Extra code is added to make sure the envp version is always in sync. (This also improves the layering situation as Args was in the Interpreter module whereas Environment is in Utility.) Reviewers: zturner, davide, jingham, clayborg Subscribers: emaste, lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D41359 llvm-svn: 322174
* Remove dead Core/StreamFile includesPavel Labath2017-06-301-5/+3
| | | | llvm-svn: 306817
* Move StructuredData from Core to UtilityPavel Labath2017-06-271-1/+1
| | | | | | | | | | | | | | | | Summary: It had a dependency on StringConvert and file reading code, which is not in Utility. I've replaced that code by equivalent llvm operations. I've added a unit test to demonstrate that parsing a file still works. Reviewers: zturner, jingham Subscribers: kubamracek, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D34625 llvm-svn: 306394
* Remove home-grown thread-local storage wrappersPavel Labath2017-06-201-13/+0
| | | | | | | | | | | | | | Summary: Use c++11 thread_local variables instead. As far as I am aware, they are supported by all compilers/targets we care about. Reviewers: zturner, jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D34274 llvm-svn: 305779
* Rename Error -> Status.Zachary Turner2017-05-128-80/+83
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
OpenPOWER on IntegriCloud