summaryrefslogtreecommitdiff
path: root/lldb/source/Host/posix/FileSystem.cpp
AgeCommit message (Collapse)Author
2019-11-15Rename posix/FileSystem.cpp to FileSystemPosix.cppAdrian Prantl
to avoid a linker warning on Darwin about two files having the same name.
2019-03-21[lldb] Add missing EINTR handlingMichal Gorny
Differential Revision: https://reviews.llvm.org/D59606 llvm-svn: 356703
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
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
2018-11-02[FileSystme] Move ::open abstraction into FileSystem.Jonas Devlieghere
This moves the abstraction around ::open into the FileSystem, as is already the case for ::fopen. llvm-svn: 346002
2018-11-01[FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere
This patch removes the logic for resolving paths out of FileSpec and updates call sites to rely on the FileSystem class instead. Differential revision: https://reviews.llvm.org/D53915 llvm-svn: 345890
2018-06-13[FileSpec] Make style argument mandatory for SetFile. NFCJonas Devlieghere
SetFile has an optional style argument which defaulted to the native style. This patch makes that argument mandatory so clients of the FileSpec class are forced to think about the correct syntax. At the same time this introduces a (protected) convenience method to update the file from within the FileSpec class that keeps the current style. These two changes together prevent a potential pitfall where the style might be forgotten, leading to the path being updated and the style unintentionally being changed to the host style. llvm-svn: 334663
2018-05-29Remove Linux-specific includes for posix/FileSystem.cppBruce Mitchener
Summary: This improves the process of cross-compiling from macOS to Linux since these files aren't used / needed at all. Reviewers: clayborg, labath Subscribers: lldb-commits, krytarowski Differential Revision: https://reviews.llvm.org/D47420 llvm-svn: 333400
2017-07-18Clean up lldb-types.hPavel Labath
Summary: It defined a couple of types (condition_t) which we don't use anymore, as we have c++11 goodies now. I remove these definitions. Also it unnecessarily included a couple of headers which weren't necessary for it's operation. I remove these, and place the includes in the relevant files (usually .cpp, usually in Host code) which use them. This allows us to reduce namespace pollution in most of the lldb files which don't need the OS-specific definitions. Reviewers: zturner, jingham Subscribers: ki.stfu, lldb-commits Differential Revision: https://reviews.llvm.org/D35113 llvm-svn: 308304
2017-05-12Rename Error -> Status.Zachary Turner
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
2017-03-21Resubmit r298334 after fixing OSX build errors.Zachary Turner
Hopefully this works, I can't test since I don't have Mac hardware, however. llvm-svn: 298340
2017-03-21Revert r298334 until Zachary has a chance to fix the buildbot failureJason Molenda
on macosx. llvm-svn: 298338
2017-03-21Delete various lldb FileSystem functions.Zachary Turner
Use LLVM's equivalent versions instead. Differential Revision: https://reviews.llvm.org/D31111 llvm-svn: 298334
2017-03-19Remove FileSystem::Get/SetFilePermissionsZachary Turner
Differential Revision: https://reviews.llvm.org/D31089 llvm-svn: 298205
2017-03-19Remove FileSystem::MakeDirectory.Zachary Turner
Have callers use llvm::sys::fs::create_directory() instead. Differential Revision: https://reviews.llvm.org/D31086 llvm-svn: 298203
2017-03-09Remove LLDB's recursive directory deletion function.Zachary Turner
LLVM now has such a function, so we use that instead. llvm-svn: 297360
2017-03-08Resubmit FileSystem changes.Zachary Turner
This was originall reverted due to some test failures in ModuleCache and TestCompDirSymlink. These issues have all been resolved and the code now passes all tests. Differential Revision: https://reviews.llvm.org/D30698 llvm-svn: 297300
2017-03-07Revert "Use LLVM for all stat-related functionality."Pavel Labath
this reverts r297116 because it breaks the unittests and TestCompDirSymlink. The ModuleCache unit test is trivially fixable, but the CompDirSymlink failure is a symptom of a deeper problem: llvm's stat functionality is not a drop-in replacement for lldb's. The former is based on stat(2) (which does symlink resolution), while the latter is based on lstat(2) (which does not). This also reverts subsequent build fixes (r297128, r297120, 297117) and r297119 (Remove FileSpec dependency on FileSystem) which builds on top of this. llvm-svn: 297139
2017-03-07Use LLVM for all stat-related functionality.Zachary Turner
This deletes LLDB's FileType enumeration and replaces all users, and all calls to functions that check whether a file exists etc with corresponding calls to LLVM. Differential Revision: https://reviews.llvm.org/D30624 llvm-svn: 297116
2017-02-02Move classes from Core -> Utility.Zachary Turner
This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
2016-11-11Prevent at compile time converting from Error::success() to Expected<T>Mehdi Amini
This would trigger an assertion at runtime otherwise. Differential Revision: https://reviews.llvm.org/D26482 llvm-svn: 286562
2016-11-11Make the Error class constructor protectedMehdi Amini
This is forcing to use Error::success(), which is in a wide majority of cases a lot more readable. Differential Revision: https://reviews.llvm.org/D26481 llvm-svn: 286561
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
2016-03-22Unicode support on Win32.Zachary Turner
Win32 API calls that are Unicode aware require wide character strings, but LLDB uses UTF8 everywhere. This patch does conversions wherever necessary when passing strings into and out of Win32 API calls. Patch by Cameron Differential Revision: http://reviews.llvm.org/D17107 Reviewed By: zturner, amccarth llvm-svn: 264074
2016-02-26Fix all of the unannotated switch cases to annotate the fall through or do ↵Greg Clayton
the right thing and break. llvm-svn: 261950
2015-10-14Make uses of /dev/null portable across OSes.Zachary Turner
Most platforms have "/dev/null". Windows has "nul". Instead of hardcoding the string /dev/null at various places, make a constant that contains the correct value depending on the platform, and use that everywhere instead. llvm-svn: 250331
2015-09-18Moved ResolveSymbolicLink() to the FileSystem where it belongs, thanksSean Callanan
zturner! http://reviews.llvm.org/D12984 llvm-svn: 248055
2015-09-18Remove unused modules from module cache.Oleksiy Vyalov
http://reviews.llvm.org/D12971 llvm-svn: 248017
2015-09-09NetBSD doesn't provide struct statfs, make use of struct statvfsStephane Sezer
Reviewers: joerg, sas Subscribers: labath, lldb-commits Differential Revision: http://reviews.llvm.org/D12661 Change by Kamil Rytarowski <n54@gmx.com> llvm-svn: 247115
2015-06-29Avoid a recursive function call that could run LLDB out of file descriptors ↵Greg Clayton
in FileSystem::DeleteDirectory(...). Fixes include: - use FileSystem::Unlink() instead of a direct call to ::unlink(...) when deleting files when iterating through the current directory - save directories from current directory in a list and iterate through those _after_ the current directory has been iterated - Use new FileSpec::ForEachItemInDirectory() instead of manually iterating across directories with opendir()/readdir()/closedir() We should switch all code over to using FileSpec::ForEachItemInDirectory(...) in the near future and get rid of FileSpec::EnumerateDirectory(). This is a follow up patch to: http://reviews.llvm.org/D10787 llvm-svn: 240978
2015-06-27Replace `rm -rf` with more portable implementation.Chaoren Lin
Reviewers: clayborg, vharron Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10787 llvm-svn: 240895
2015-05-29Refactor many file functions to use FileSpec over strings.Chaoren Lin
Summary: This should solve the issue of sending denormalized paths over gdb-remote if we stick to GetPath(false) in GDBRemoteCommunicationClient, and let the server handle any denormalization. Reviewers: ovyalov, zturner, vharron, clayborg Reviewed By: clayborg Subscribers: tberghammer, emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D9728 llvm-svn: 238604
2015-05-08Use hard links to link sysroot files within ModuleCache.Oleksiy Vyalov
http://reviews.llvm.org/D9587 llvm-svn: 236917
2015-04-27Fix LLDB ARM build error on ubuntu precise with gcc4.7Omair Javaid
Differential revision: http://reviews.llvm.org/D9100 llvm-svn: 235865
2015-02-24Fix typo that breaks FileSystem::IsLocalVince Harron
llvm-svn: 230312
2015-02-24Compile fix for FileSystem::IsLocal on LinuxVince Harron
llvm-svn: 230311
2015-02-23Avoid crashing by not mmap'ing files on network mounted file systems.Greg Clayton
This is implemented by making a new FileSystem function: bool FileSystem::IsLocal(const FileSpec &spec) Then using this in a new function: DataBufferSP FileSpec::MemoryMapFileContentsIfLocal(off_t file_offset, size_t file_size) const; This function only mmaps data if the file is a local file since that means we can reliably page in data. We were experiencing crashes where people would use debug info files on network mounted file systems and that mount would go away and cause the next access to a page that wasn't paged in to crash LLDB. We now avoid this by just copying the data into a heap buffer and keeping a permanent copy to avoid the crash. Updated all previous users of FileSpec::MemoryMapFileContentsIfLocal() in ObjectFile subclasses over to use the new FileSpec::MemoryMapFileContentsIfLocal() function. <rdar://problem/19470249> llvm-svn: 230283
2015-02-20Introduce FileSystem::CalculateMD5AsString that supports any platform and ↵Oleksiy Vyalov
make existing FileSystem::CalculateMD5 to use it. http://reviews.llvm.org/D7771 llvm-svn: 230036
2014-08-15Move FileSystem functions out of Host and into their own classes.Zachary Turner
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