Commit Graph

44 Commits

Author SHA1 Message Date
Hafiz Abid Qadeer 01db53848e Added a missing call to 'Reset'.
HostThreadWindows::Join() did not call the Reset as is done by
the HostThreadPosix::Join(). As a result, future call to 
IsJoinable() can fail.

Committed as obvious.
 

llvm-svn: 220651
2014-10-26 21:38:43 +00:00
Zachary Turner 047a070f7c Make ProcessWindows just use Host::LaunchProcess.
llvm-svn: 220574
2014-10-24 17:51:56 +00:00
Hafiz Abid Qadeer ae9446088b Fix code where goto jumped over local variable initialization.
llvm-svn: 220473
2014-10-23 10:36:53 +00:00
Zachary Turner 10687b0ea5 Remove LLDB_DEFAULT_SHELL #define, and determine this at runtime.
Differential Revision: http://reviews.llvm.org/D5805
Reviewed by: Greg Clayton

llvm-svn: 220217
2014-10-20 17:46:43 +00:00
Zachary Turner 172d37d3b9 Create a process launcher abstraction.
This implements Host::LaunchProcess for windows, and in doing so
does some minor refactor to move towards a more modular process
launching design.

The original motivation for this is that launching processes on
windows needs some very windows specific code, which would live
most appropriately in source/Host/windows somewhere.  However,
there is already some common code that all platforms use when
launching a process before delegating to the platform specific
stuff, which lives in source/Host/common/Host.cpp which would
be nice to reuse without duplicating.

This commonality has been abstracted into MonitoringProcessLauncher,
a class which abstracts out the notion of launching a process using
an arbitrary algorithm, and then monitoring it for state changes.

The windows specific launching code lives in ProcessLauncherWindows,
and the posix specific launching code lives in ProcessLauncherPosix.
When launching a process MonitoringProcessLauncher is created, and
then an appropriate delegate launcher is created and given to the
MonitoringProcessLauncher.

Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D5781

llvm-svn: 219731
2014-10-14 21:55:08 +00:00
Zachary Turner 8ada0b9713 Correctly fix ScriptInterpreterPython::ExecuteOneLine for windows.
llvm-svn: 219435
2014-10-09 20:17:53 +00:00
Zachary Turner b2df30d652 Fix deadlock in Python one-line execution.
Python one-line execution was using ConnectionFileDescriptor to do
a non-blocking read against a pipe.  This won't work on Windows,
as CFD is implemented using select(), and select() only works with
sockets on Windows.

The solution is to use ConnectionGenericFile on Windows, which uses
the native API to do overlapped I/O on the pipe.  This in turn
requires re-implementing Host::Pipe on Windows using native OS
handles instead of the more portable _pipe CRT api.

Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D5679

llvm-svn: 219339
2014-10-08 20:38:41 +00:00
Zachary Turner 5cbeb850fb Fix compile error on Windows.
llvm-svn: 219232
2014-10-07 20:34:36 +00:00
Zachary Turner 12792af026 Create a ConnectionGenericFile class for Windows.
This is the first step in getting ConnectionFileDescriptor ported
to Windows. It implements a connection against a disk file for
windows. This supports connection strings of the form file://PATH
which are currently supported only on posix platforms in
ConnectionFileDescriptor.

Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D5608

llvm-svn: 219145
2014-10-06 21:23:09 +00:00
Zachary Turner c76a445279 Fixup some minor issues with HostProcess.
llvm-svn: 218684
2014-09-30 16:56:40 +00:00
Zachary Turner acee96ae52 Fix up the HostThread interface, making the interface simpler.
Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D5417

llvm-svn: 218325
2014-09-23 18:32:09 +00:00
Zachary Turner f5e4f37cb6 Update HostProcess to use the same facade pattern as HostThread.
llvm-svn: 217632
2014-09-11 22:22:16 +00:00
Zachary Turner 39de311071 Create a HostThread abstraction.
This patch moves creates a thread abstraction that represents a
thread running inside the LLDB process.  This is a replacement for
otherwise using lldb::thread_t, and provides a platform agnostic
interface to managing these threads.

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

Reviewed by: Jim Ingham

llvm-svn: 217460
2014-09-09 20:54:56 +00:00
Zachary Turner 4e82ec9caa Create a HostProcess class.
This is a lightweight wrapper around a pid.  It is intended to be
lightweight enough to serve as a replacement anywhere we currently
store a pid.  It provides convenience methods and common process
operations.

This patch does not yet make use of HostProcess anywhere.

llvm-svn: 216607
2014-08-27 20:15:30 +00:00
Zachary Turner 58a559c07e Update LLDB to use LLVM's DynamicLibrary.
LLDB had implemented its own DynamicLibrary class for plugin
support.  LLVM has an equivalent mechanism, so this patch deletes
the duplicated code in LLDB and updates LLDB to reference the
mechanism provided by LLVM.

llvm-svn: 216606
2014-08-27 20:15:09 +00:00
Greg Clayton 0d8400c89c Change back all paths returns for lldb::PathType enumerations from HostInfo::GetLLDBPath() to return the directories in the FileSpec.m_directory field to match previous implementations. This change previously broke some path stuff in upstream branches.
llvm-svn: 216398
2014-08-25 18:21:06 +00:00
Zachary Turner a21fee0ee4 Move the rest of the HostInfo functions over.
This should bring HostInfo up to 99% completion.  The remainder
of code in Host will be split into instantiatable classes
representing host processes, threads, dynamic libraries, and
process launching strategies.

llvm-svn: 216230
2014-08-21 21:49:24 +00:00
Zachary Turner b245ecac79 Move GetUsername and GetGroupname to HostInfoPosix
llvm-svn: 216210
2014-08-21 20:02:17 +00:00
Zachary Turner 42ff0ad882 Move Host::GetLLDBPath to HostInfo.
This continues the effort to get Host code moved over to HostInfo,
and removes many more instances of preprocessor defines along the
way.

llvm-svn: 216195
2014-08-21 17:29:12 +00:00
Zachary Turner 97a14e60b2 Move some Host logic into HostInfo class.
This patch creates a HostInfo class, a static class used to answer
basic queries about the host platform.  As part of this change,
some functionality is moved from Host to HostInfo, and relevant
fixups are performed in the rest of the codebase.

This is part of a larger effort to isolate more code in the Host
layer into platform-specific groups, to make it easier to make
platform specific changes for a particular Host without breaking
other hosts.

Reviewed by: Greg Clayton

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

llvm-svn: 215992
2014-08-19 17:18:29 +00:00
Zachary Turner 4ec5d0d0e1 In the CMake build, convert lldbHost to be a single static library.
Previously lldbHost was built as multiple static libraries such as
lldbHostCommon, lldbHostLinux, etc.  With this patch, the CMake
build produces only a single static library, lldbHost, whose file
set is dynamically created based on the platform.

llvm-svn: 215792
2014-08-15 23:50:36 +00:00
Zachary Turner c00cf4a068 Move FileSystem functions out of Host and into their own classes.
More specifically, this change can be summarized as follows:
1) Makes an lldbHostPosix library which contains code common to
   all posix platforms.
2) Creates Host/FileSystem.h which defines a common FileSystem
   interface.
3) Implements FileSystem.h in Host/windows and Host/posix.
4) Creates Host/FileCache.h, implemented in Host/common, which
   defines a class useful for storing handles to open files needed
   by the debugger.

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

llvm-svn: 215775
2014-08-15 22:04:21 +00:00
Zachary Turner e88be264de Implement some common file operations on Windows.
llvm-svn: 215273
2014-08-09 01:29:07 +00:00
Zachary Turner 12f6f53618 [Windows] Delegate str[n]casecmp to the appropriate MSVCRT func.
llvm-svn: 214197
2014-07-29 19:08:55 +00:00
Zachary Turner c9bf0c70b5 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
2014-07-18 20:36:08 +00:00
Zachary Turner 310035a4f9 Implment "platform process list" for Windows.
This patch implements basic functionality of the "platform process
list" command for Windows.  Currently this has the following
limitations.

* Certain types of filtering are not enabled (e.g. filtering by
  architecture with -a), although most filters work.
* The username of the process is not yet obtained.
* Using -v to list verbose information generates an error.
* The architecture column displays the entire triple, leading to
  misaligned formatting of the printed table.

Reviewed by: Greg Clayton
Differential Revision: http://reviews.llvm.org/D4413

llvm-svn: 212510
2014-07-08 04:52:15 +00:00
Colin Riley 740ed90626 Windows fix: Condition::Wait returned failure when it actually succeeded (SleepConditionVariableCS returns non-zero for success)
llvm-svn: 210104
2014-06-03 14:33:41 +00:00
Todd Fiala 4dc625281d Fix most of the remaining Windows build warnings.
See http://reviews.llvm.org/D3944 for more details.

Change by Zachary Turner.

llvm-svn: 210035
2014-06-02 17:30:22 +00:00
Hafiz Abid Qadeer 10511b2a73 Change the type in va_arg call from char to int.
It is supposed to take fully promoted types.

llvm-svn: 204336
2014-03-20 11:24:44 +00:00
Hafiz Abid Qadeer a1b42ec0f2 Change type of a few members of a struct from unsigned to signed.
They are used in Windows APIs which expect a signed argument and
cause a build failure on Mingw.

llvm-svn: 203783
2014-03-13 10:47:49 +00:00
Hafiz Abid Qadeer 6eff101926 Replace some _MSC_VER with _WIN32.
This allows to use some code for mingw which was previously only
used for MSVC.

llvm-svn: 203651
2014-03-12 10:45:23 +00:00
Hafiz Abid Qadeer bdb515916c Added some missing header files.
They help fix mingw build.

llvm-svn: 203650
2014-03-12 10:39:46 +00:00
Deepak Panickal d582f69469 Move Windows getopt for building the DLL
llvm-svn: 202725
2014-03-03 15:52:27 +00:00
Deepak Panickal 627f4ae811 Build liblldb.dll in Windows
llvm-svn: 202724
2014-03-03 15:50:36 +00:00
Deepak Panickal 99fbc07600 Fix Windows build using portable types for formatting the log outputs
llvm-svn: 202723
2014-03-03 15:39:47 +00:00
Deepak Panickal ff4ac8a6e7 Replaced custom variable arguments to standard library for correcting 64 bit Windows build
llvm-svn: 201523
2014-02-17 17:52:22 +00:00
Ed Maste 10c82017b6 Update header comment to match filename
llvm-svn: 200647
2014-02-02 19:25:11 +00:00
Deepak Panickal 914b8d989b Fixing the Windows build for the changes brought in from the iohandler merge.
llvm-svn: 200565
2014-01-31 18:48:46 +00:00
Virgile Bello d87fc157d2 Added some MSVC required functions in Windows.cpp. Moved MSVC specific getopt code inside its own folder.
llvm-svn: 190238
2013-09-07 05:05:49 +00:00
Virgile Bello e2607b50ea Add OptionParser.h
llvm-svn: 190063
2013-09-05 16:42:23 +00:00
Virgile Bello 0a3b151fdf Remove <windows.h> from lldb-types.h.
llvm-svn: 189934
2013-09-04 13:56:11 +00:00
Virgile Bello bdae3787ef Cleanup/rearrange includes:
- factorize unistd.h and stdbool.h in lldb-types.h.
- Add <functional> and <string> where required.

llvm-svn: 189477
2013-08-28 12:14:27 +00:00
Virgile Bello ae12a3640d Fix MinGW build after lldb-platform-work merge:
- mode_t is defined in <sys/types.h>
- reorganized S_* user rights into win32.h
- Use Host::Kill instead of kill
- Currently #ifdef functions using pread/pwrite.

llvm-svn: 189364
2013-08-27 16:21:49 +00:00
Virgile Bello b2f1fb2943 MingW compilation (windows). Includes various refactoring to improve portability.
llvm-svn: 189107
2013-08-23 12:44:05 +00:00