summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a bug introduced in r235737 where code with important sideJason Molenda2017-02-161-1/+2
| | | | | | | | | | effects was passed as an expression to assert() calls. If lldb is built without asserts, the expression was eliminated and we lost the side effects -- these methods stopped working. <rdar://problem/30342959> llvm-svn: 295271
* Really fix build on non-windows platforms :)Pavel Labath2017-02-061-1/+1
| | | | llvm-svn: 294215
* Try to fix build on non-Windows platforms.Zachary Turner2017-02-061-5/+6
| | | | llvm-svn: 294213
* Get rid of Error::PutToLog().Zachary Turner2017-02-061-45/+41
| | | | | | | | | | | | | Instead just rely on LLDB_LOG(). This is part of an effort to sort out dependency hell in LLDB. Error is in Utility, but Log is in Core. Core can depend on Utility, but not vice versa. So this patch moves the knowledge about how to log Errors from the Error class to the Log file. Differential Revision: https://reviews.llvm.org/D29514 llvm-svn: 294210
* Switch std::call_once to llvm::call_onceKamil Rytarowski2017-02-062-31/+34
| | | | | | | | | | | | | | | | | | | | | Summary: The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms. This change is required in the NetBSD LLDB port. std::call_once with libstdc++ results with crashing the debugger. Sponsored by <The NetBSD Foundation> Reviewers: labath, joerg, emaste, mehdi_amini, clayborg Reviewed By: labath, clayborg Subscribers: #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D29288 llvm-svn: 294202
* Move classes from Core -> Utility.Zachary Turner2017-02-0211-14/+14
| | | | | | | | | | | | | | | | | | | | | | | 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
* Document that LaunchProcessPosixSpawn is used on NetBSDKamil Rytarowski2017-02-011-1/+1
| | | | | | | | No functional change. Sponsored by <The NetBSD Foundation> llvm-svn: 293770
* Transform ProcessLauncherLinux to ProcessLauncherPosixForkKamil Rytarowski2017-02-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Use ProcessLauncherPosixFork in Linux and NetBSD. Changes to ProcessLauncherLinux: - Limit personality.h and ASLR code to Linux. - Reuse portable ptrace(2) PT_TRACE_ME operation available on Linux and BSDs. - Limit ETXTBSY error path from execve(2) to Linux. - In LaunchProcess declaration change virtual to override. This code should be readily available for FreeBSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, clayborg, labath, emaste Reviewed By: labath Subscribers: danalbert, srhines, mgorny, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D29347 llvm-svn: 293768
* Add NetBSD support in Host::GetCurrentThreadIDKamil Rytarowski2017-01-311-0/+6
| | | | | | | | | | | | | | | | | | | Summary: To retrieve the native thread ID there must be called _lwp_self(). Sponsored by <The NetBSD Foundation> Reviewers: joerg, clayborg, emaste, labath Reviewed By: joerg, clayborg, labath Subscribers: #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D29264 llvm-svn: 293625
* Address post-commit review remarksPavel Labath2017-01-271-1/+1
| | | | | | | Tamas pointed out that the macro name I used in r293282 was too vague. Rename it to better reflect what it is used for. llvm-svn: 293287
* Refactor the android accept hackPavel Labath2017-01-271-5/+7
| | | | | | | | This moves the accept hack from the android toolchain file into LLDBConfig.cmake. This allows successful lldb android compilation without relying on our custom toolchain file. llvm-svn: 293281
* Include termios.h for definition of struct winsizePavel Labath2017-01-241-0/+1
| | | | | | | | | | On android API level 9 the header does not get included transitively. Include it directly. As far as I can see, all non-windows platforms should have this header. If that turns out to be incorrect, we can add some ifdefs around that. llvm-svn: 292931
* Fix windows unit testsPavel Labath2017-01-161-1/+1
| | | | | | | | | The unit test I added in the previous commit discovered a bug in PrependPathComponent on windows -- it was calling SetFile with the host native path syntax, whereas it should be explicitly specifying the path syntax (as AppendPathComponent does). This fixes it. llvm-svn: 292106
* FileSpec: Fix PrependPathComponent("/")Pavel Labath2017-01-161-24/+22
| | | | | | | | | | | | | | | | Summary: PrependPathComponent was unconditionally inserting path separators between the path components. This is not correct if the prepended path is "/", which caused problems down the line. Fix the function to use the same algorithm as AppendPathComponent and add a test. This fixes one part of llvm.org/pr31611. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D28677 llvm-svn: 292100
* Consolidate file handle usage in Editline.cppPavel Labath2017-01-061-10/+37
| | | | | | | | | | | | | | | | | | | | Summary: To implement wide character reading, editline was mixing FILE*-based access with a Connection-based one (plus it did some selects on the raw FD), which is very fragile. Here, I replace it with one which uses only a Connection-based reads. The code is somewhat longer as I had to read characters one by one to detect the end of the multibyte sequence. I've verified that international characters still work in lldb command line on OSX. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D28356 llvm-svn: 291220
* Add methods to enable using formatv syntax in LLDB.Zachary Turner2016-12-161-4/+47
| | | | | | | | | | | | | This adds formatv-backed formatting functions in various places in LLDB such as StreamString, logging, constructing error messages, etc. A couple of callsites are changed from Printf style syntax to formatv style syntax to illustrate its usage. Additionally, a FileSpec formatter is introduced so that FileSpecs can be formatted natively. Differential Revision: https://reviews.llvm.org/D27632 llvm-svn: 289922
* Fix build for mingw.Hafiz Abid Qadeer2016-12-151-1/+1
| | | | | | | | | | | | Summary: I was building lldb using cross mingw-w64 toolchain on Linux and observed some issues. This is first patch in the series to fix that build. It mostly corrects the case of include files and adjusts some #ifdefs from _MSC_VER to _WIN32 and vice versa. I built lldb on windows with VS after applying this patch to make sure it does not break the build there. Reviewers: zturner, labath, abidh Subscribers: ki.stfu, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D27759 llvm-svn: 289821
* Adopt PrettyStackTrace in LLDBSean Callanan2016-12-141-4/+0
| | | | | | | | | | LLDB needs some minor changes to adopt PrettyStackTrace after https://reviews.llvm.org/D27683. We remove our own SetCrashDescription() function and use LLVM-provided RAII objects instead. We also make sure LLDB doesn't define __crashtracer_info__ which would collide with LLVM's definition. Differential Revision: https://reviews.llvm.org/D27735 llvm-svn: 289711
* Remove superfluous android includePavel Labath2016-12-051-1/+0
| | | | | | | This file is not in the include path when building with a non-standalone toolchain. In does not seem to be necessary anyway. llvm-svn: 288674
* Replace __ANDROID_NDK__ with __ANDROID__Pavel Labath2016-12-022-7/+7
| | | | | | | | | | | | | | | | | | | | Summary: This replaces all the uses of the __ANDROID_NDK__ define with __ANDROID__. This is a preparatory step to remove our custom android toolchain file and rely on the standard android NDK one instead, which does not provide this define. Instead I rely, on __ANDROID__, which is set by the compiler. I haven't yet removed the cmake variable with the same name, as we will need to do something completely different there -- NDK toolchain defines CMAKE_SYSTEM_NAME to Android, while our current one pretends it's linux. Reviewers: tberghammer, zturner Subscribers: danalbert, srhines, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D27305 llvm-svn: 288494
* Fix handling of consecutive slashes in FileSpec::GetNormalizedPath()Pavel Labath2016-11-301-1/+2
| | | | | | | | | | The core of the function was actually handling them correctly. However, the early exit was being too optimistic and did not give the function a chance to fire if the path did not contain dots as well. Fix that and add a couple of unit tests. llvm-svn: 288247
* [lldb] Fix typos in file headersAlexander Shaposhnikov2016-11-266-4/+22
| | | | | | | | | | | | | This diff fixes typos in file headers (incorrect file names). Test plan: Under llvm/tools/lldb/source: find ./* -type f | grep -e '\(cpp\|h\)$' | while read F; do B=$(basename $F); echo $F head -n 1 $F | grep -v $B | wc -l ; done Differential revision: https://reviews.llvm.org/D27115 llvm-svn: 287966
* Introduce Chrono to the Connection class. NFCI.Pavel Labath2016-11-251-2/+2
| | | | llvm-svn: 287922
* Make GetRegisterByName() take a StringRef.Zachary Turner2016-11-171-13/+11
| | | | | | | This one is fairly trivial and only really involves changing function signatures and a few simple call-sites. llvm-svn: 287266
* Remove TimeValue classPavel Labath2016-11-161-155/+0
| | | | | | | | | | | | | | | Summary: All usages have been replaced by appropriate std::chrono funcionality, and the class is now unused. The only used part of the cpp file is the DumpTimePoint function, which I have moved into the only caller (CommandObjectTarget.cpp). Reviewers: clayborg, zturner Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D26451 llvm-svn: 287096
* Fix uninitialized members.Sam McCall2016-11-151-4/+2
| | | | | | | | | | | | Summary: Fix uninitialized members. Reviewers: jingham Subscribers: jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D26528 llvm-svn: 286947
* Make OptionParser::Parse() take StringRef.Zachary Turner2016-11-131-2/+3
| | | | llvm-svn: 286747
* Fix some use-after-frees that my last CL introduced.Zachary Turner2016-11-131-4/+2
| | | | llvm-svn: 286745
* Prevent at compile time converting from Error::success() to Expected<T>Mehdi Amini2016-11-115-10/+10
| | | | | | | | This would trigger an assertion at runtime otherwise. Differential Revision: https://reviews.llvm.org/D26482 llvm-svn: 286562
* Make the Error class constructor protectedMehdi Amini2016-11-115-10/+10
| | | | | | | | | 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
* Remove TimeValue usage from lldb/HostPavel Labath2016-11-091-1/+0
| | | | llvm-svn: 286371
* Remove TimeValue usage from Core/ModulePavel Labath2016-11-091-21/+19
| | | | | | | | | | | | | | | | Summary: The only interesting part here is that TimePoint and TimeValue have different natural string representations, which affects "target modules list" output. It is now "2016-07-09 04:02:21.000000000", whereas previously in was "Sat Jul 9 04:02:21 2016". I wanted to check if we're OK with that. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D26275 llvm-svn: 286349
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-025-6/+5
| | | | | | | | | | Reviewers: zturner, labath Subscribers: tberghammer, danalbert, lldb-commits Differential Revision: https://reviews.llvm.org/D26233 llvm-svn: 285855
* Remove TimeValue usage from FileSpec.hPavel Labath2016-11-012-8/+10
| | | | | | | | | | | | | | | | | | | | | Summary: The only usage there was in GetModificationTime(). I also took the opportunity to move this function from FileSpec to the FileSystem class - since we are using FileSpecs to also represent remote files for which we cannot (easily) retrieve modification time, it makes sense to make the decision to get the modification time more explicit. The new function returns a llvm::sys::TimePoint<>. To aid the transition from TimeValue, I have added a constructor to it which enables implicit conversion from a time_point. Reviewers: zturner, clayborg Subscribers: mehdi_amini, tberghammer, danalbert, beanz, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D25392 llvm-svn: 285702
* Improve ".." handling in FileSpec normalizationPavel Labath2016-10-311-99/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: .. handling for windows path was completely broken because the function was expecting \ as path separators, but we were passing it normalized file paths, where these have been replaced by forward slashes. Apart from this, the function was incorrect for posix paths as well in some corner cases, as well as being generally hard to follow. The corner cases were: - /../bar -> should be same as /bar - /bar/.. -> should be same as / (slightly dodgy as the former depends on /bar actually existing, but since we're doing it in an abstract way, I think the transformation is reasonable) I rewrite the function to fix these corner cases and handle windows paths more correctly. The function should now handle the posix paths (modulo symlinks, but we cannot really do anything about that without a real filesystem). For windows paths, there are a couple of corner cases left, mostly to do with drive letter handling, which cannot be fixed until the rest of the class understands drive letters better. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D26081 llvm-svn: 285593
* Make lldb -Werror clean on Windows.Zachary Turner2016-10-056-29/+40
| | | | | | Differential Revision: https://reviews.llvm.org/D25247 llvm-svn: 283344
* Update FileSpec's interface to use StringRefs.Zachary Turner2016-09-271-120/+100
| | | | | | Differential Revision: https://reviews.llvm.org/D24936 llvm-svn: 282537
* Fix build on Ubuntu.Zachary Turner2016-09-231-5/+5
| | | | | | | This was in some code that was #ifdef'd out on Windows, so I didn't see it. llvm-svn: 282309
* Make lldb::Regex use StringRef.Zachary Turner2016-09-212-11/+11
| | | | | | | | | | This updates getters and setters to use StringRef instead of const char *. I tested the build on Linux, Windows, and OSX and saw no build or test failures. I cannot test any BSD or Android variants, however I expect the required changes to be minimal or non-existant. llvm-svn: 282079
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-0635-9141/+7696
| | | | | | | | | | | | | | | | | | | | | | | *** 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
* [NFC] Darwin llgs support from Week of CodeTodd Fiala2016-09-041-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code represents the Week of Code work I did on bringing up lldb-server LLGS support for Darwin. It does not include the Xcode project changes needed, as we don't want to throw that switch until more support is implemented (i.e. this change is inert, no build systems use it yet. I've verified on Ubuntu 16.04, macOS Xcode and macOS cmake builds). This change does some minimal refactoring of code that is shared with the Linux LLGS portion, moving it from NativeProcessLinux into NativeProcessProtocol. That code is also used by NativeProcessDarwin. Current state on Darwin: * Process launching is implemented. (Attach is not). Launching on devices has not yet been tested (FBS/BKS might need a bit of work). * Inferior waitpid monitoring and communication of exit status via MainLoop callback is implemented. * Memory read/write, breakpoints, thread register context, etc. are not yet implemented. This impacts process stop/resume, as the initial launch suspended immediately starts the process up and running because it doesn't know it is supposed to remain stopped. * I implemented the equivalent of MachThreadList as NativeThreadListDarwin, in anticipation that we might want to factor out common parts into NativeThreadList{Protocol} and share some code here. After writing it, though, the fallout from merging Mach Task/Process into a single concept plus some other minor changes makes the whole NativeThreadListDarwin concept nothing more than dead weight. I am likely going to get rid of this class and just manage it directly in NativeProcessDarwin, much like I did for NativeProcessLinux. * There is a stub-out call for starting a STDIO thread. That will go away and adopt the MainLoop pselect-based IOObject reading. I am developing the fully-integrated changes in the following repo, which contains the necessary Xcode bits and the glue that enables lldb-debugserver on a macOS system: https://github.com/tfiala/lldb/tree/llgs-darwin This change also breaks out a few of the lldb-server tests into their own directory, and adds some $qHostInfo tests (not sure why I didn't write those tests back when I initially implemented that on the Linux side). llvm-svn: 280604
* Change the PathMappingList::FindFile to use FileSpec API'sJim Ingham2016-08-231-0/+3
| | | | | | Also, when appending path components, collapse multiple "/" into one at the join. llvm-svn: 279533
* Centralize all select() calls into one place so that we can take advantage ↵Greg Clayton2016-08-101-5/+5
| | | | | | | | | of system specific optimizations to deal with more file descriptors than FD_SETSIZE on some systems. <rdar://problem/25325383> https://reviews.llvm.org/D22950 llvm-svn: 278299
* Fix build on android and Linux.Zachary Turner2016-08-101-18/+8
| | | | | | | | gettimeofday() isn't defined without a special header. Rather than rely on C apis, let's just use modern C++11 to do this portably on all platforms using std::chrono. llvm-svn: 278182
* Delete Host/windows/win32.hZachary Turner2016-08-094-4/+7
| | | | | | | | | | | | | | | | | | | It's always hard to remember when to include this file, and when you do include it it's hard to remember what preprocessor check it needs to be behind, and then you further have to remember whether it's windows.h or win32.h which you need to include. This patch changes the name to PosixApi.h, which is more appropriately named, and makes it independent of any preprocessor setting. There's still the issue of people not knowing when to include this, because there's not a well-defined set of things it exposes other than "whatever is missing on Windows", but at least this should make it less painful to fix when problems arise. This patch depends on LLVM revision r278170. llvm-svn: 278177
* Remove Android.hPavel Labath2016-08-081-2/+3
| | | | | | | It only contained a reimplementation of std::to_string, which I have replaced with usages of pre-existing llvm::to_string (also, injecting members into the std namespace is evil). llvm-svn: 278000
* Remove _isatty from Android.hPavel Labath2016-08-081-1/+1
| | | | | | it is just #defined to isatty anyway, which lldb already knows how to use. llvm-svn: 277997
* Clean up vestigial remnants of locking primitivesSaleem Abdulrasool2016-07-283-516/+2
| | | | | | | | | | | | | | | | This finally removes the use of the Mutex and Condition classes. This is an intricate patch as the Mutex and Condition classes were tied together. Furthermore, many places had slightly differing uses of time values. Convert timeout values to relative everywhere to permit the use of std::chrono::duration, which is required for the use of std::condition_variable's timeout. Adjust all Condition and related Mutex classes over to std::{,recursive_}mutex and std::condition_variable. This change primarily comes at the cost of breaking the TracingMutex which was based around the Mutex class. It would be possible to write a wrapper to provide similar functionality, but that is beyond the scope of this change. llvm-svn: 277011
* Unify process launching code on linuxPavel Labath2016-07-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | | Summary: We've had two copies of code for launching processes: - one in NativeProcessLinux, used for launching debugged processes - one in ProcessLauncherAndroid, used on android for launching all other kinds of processes These have over time acquired support for various launch options, but neither supported all of them. I now replace them with a single implementation ProcessLauncherLinux, which supports all the options the individual versions supported and set it to be used to launch all processes on linux. This also works around the ETXTBSY issue on android when the process is started from the platform instance, as that used to go through the version which did not contain the workaround. Reviewers: tberghammer Subscribers: tberghammer, danalbert, srhines, lldb-commits Differential Revision: https://reviews.llvm.org/D22457 llvm-svn: 276288
* Typo corrections identified by codespellEd Maste2016-07-191-1/+1
| | | | | | | | | Submitted by giffunip@yahoo.com; I fixed a couple of nearby errors and incorrect changes in the patch. llvm.org/pr27634 llvm-svn: 275983
OpenPOWER on IntegriCloud