summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Utility
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove lldb streams from the Log class completelyPavel Labath2017-03-151-49/+65
| | | | | | | | | | | | | | | | | | | | | Summary: previously we switched to llvm streams for log output, this completes the switch for the error streams. I also clean up the includes and remove the unused argument from DisableAllLogChannels(). This required adding a bit of boiler plate to convert the output in the command interpreter, but that should go away when we switch command results to use llvm streams as well. Reviewers: zturner, eugene Subscribers: lldb-commits, emaste Differential Revision: https://reviews.llvm.org/D30894 llvm-svn: 297812
* Fix remaining threading issues in Log.hPavel Labath2017-03-091-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This fixes two threading issues in the logging code. The access to the mask and options flags had data races when we were trying to enable/disable logging while another thread was writing to the log. Since we can log from almost any context, and we want it to be fast, so I avoided locking primitives and used atomic variables instead. I have also removed the (unused) setters for the mask and flags to make sure that the only way to set them is through the enable/disable channel functions. I also add tests, which when run under tsan, verify that the use cases like "doing an LLDB_LOGV while another thread disables logging" are data-race-free. Reviewers: zturner, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D30702 llvm-svn: 297368
* Update log_options unit testPavel Labath2017-03-061-36/+41
| | | | | | | | | | it was accessing the details of the Log class directly. Let it go through the channel class instead. This also discovered a bug when we were setting but not clearing the log options when enabling a channel. llvm-svn: 297053
* Fix Log unit testsPavel Labath2017-03-061-3/+2
| | | | | | | the llvm function for getting the thread name dropped the _np suffix during review. Zachary's commit did not reflect that. llvm-svn: 297013
* Move Log from Core -> Utility.Zachary Turner2017-03-032-0/+213
| | | | | | | | | All references to Host and Core have been removed, so this class can now safely be lowered into Utility. Differential Revision: https://reviews.llvm.org/D30559 llvm-svn: 296909
* Fix a couple of corner cases in NameMatchesPavel Labath2017-02-202-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I originally set out to move the NameMatches closer to the relevant function and add some unit tests. However, in the process I've found a couple of bugs in the implementation: - the early exits where not always correct: - (test==pattern) does not mean the match will always suceed because of regular expressions - pattern.empty() does not mean the match will fail because the "" is a valid prefix of any string So I cleaned up those and added some tests. The only tricky part here was that regcomp() implementation on darwin did not recognise the empty string as a regular expression and returned an REG_EMPTY error instead. The simples fix here seemed to be to replace the empty expression with an equivalent non-empty one. Reviewers: clayborg, zturner Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D30094 llvm-svn: 295651
* Fix VASprintfTest on darwinPavel Labath2017-02-171-2/+2
| | | | | | | | | The way of injecting an error into the printf call was not working on darwin - the C library still happily format the character. It only returns an error after we use a wide character that does not fit into a single byte, so switch the test to use that. llvm-svn: 295443
* Fix breakage caused by r295368Pavel Labath2017-02-172-2/+22
| | | | | | | Also move the ErrorTest into the Utility package, to follow the class it is testing. llvm-svn: 295436
* Fix buildZachary Turner2017-02-161-1/+1
| | | | llvm-svn: 295369
* Finish breaking the dependency from Utility.Zachary Turner2017-02-162-1/+60
| | | | | | Differential Revision: https://reviews.llvm.org/D29964 llvm-svn: 295368
* Remove dependencies from Utility to Core and Target.Zachary Turner2017-02-144-184/+0
| | | | | | | | | | With this patch, the only dependency left is from Utility to Host. After this is broken, Utility will finally be standalone. Differential Revision: https://reviews.llvm.org/D29909 llvm-svn: 295088
* UriParser cleanupPavel Labath2017-02-101-21/+19
| | | | | | | - move the header file to the include folder - enclose the class in the proper namespace llvm-svn: 294741
* Add a format_provider for the Timeout classPavel Labath2017-02-101-5/+13
| | | | | | | | | | and use it in the appropriate log statements. Formatting of chrono types in log messages was very clunky. This should make it much nicer to use and give better output. For details of the formatting options see the chrono formatter in llvm. llvm-svn: 294738
* Remove LIBLLDB_LOG_VERBOSE categoryPavel Labath2017-02-052-0/+19
| | | | | | | | | | | | | | | | | | | | | Summary: Per discussion in D28616, having two ways two request logging (log enable lldb XXX verbose && log enable -v lldb XXX) is confusing. This removes the first option and standardizes all code to use the second one. I've added a LLDB_LOGV macro as a shorthand for if(log && log->GetVerbose()) and switched most of the affected log statements to use that (I've only left a couple of cases that were doing complex computations in an if(log) block). Reviewers: jingham, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D29510 llvm-svn: 294113
* [CMake] Update unit tests with accurate dependenciesChris Bieneman2017-02-011-0/+9
| | | | | | This is extending the updates from r293696 to the LLDB unit tests. llvm-svn: 293821
* Introduce chrono to the Communication classPavel Labath2016-11-252-0/+23
| | | | | | | | This replaces the raw integer timeout parameters in the class with their chrono-based equivalents. To achieve this, I have moved the Timeout class to a more generic place and added a quick unit test for it. llvm-svn: 287920
* Convert UriParser to use StringRef.Zachary Turner2016-11-171-9/+29
| | | | llvm-svn: 287190
* Prevent at compile time converting from Error::success() to Expected<T>Mehdi Amini2016-11-111-1/+1
| | | | | | | | 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-111-1/+1
| | | | | | | | | 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
* unittests: Specify types in a bunch of unittest EXPECT'sJustin Bogner2016-10-171-54/+54
| | | | | | | The EXPECT and ASSERT macros in gtest don't do the usual arithmetic conversions. Specify types in several of them to fix -Werror. llvm-svn: 284405
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-065-947/+864
| | | | | | | | | | | | | | | | | | | | | | | *** 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
* Add more unit tests for StringExtractor hex/endian functions.Zachary Turner2016-08-311-19/+133
| | | | | | | There were a few corner cases that weren't tested for dealing with extraction of an odd number of nibbles. Add tests for those here. llvm-svn: 280253
* Revert r280137 and 280139 and subsequent build fixesPavel Labath2016-08-311-14/+24
| | | | | | | | | | The rewrite of StringExtractor::GetHexMaxU32 changes functionality in a way which makes lldb-server crash. The crash (assert) happens when parsing the "qRegisterInfo0" packet, because the function tries to drop_front more bytes than the packet contains. It's not clear to me whether we should consider this a bug in the caller or the callee, but it any case, it worked before, so I am reverting this until we can figure out what the proper interface should be. llvm-svn: 280207
* A few minor stylistic cleanups in StringExtractor.Zachary Turner2016-08-301-24/+14
| | | | | | | | | | | Makes Peek() return a StringRef instead of a const char*. This leads to a few callers of Peek() being able to be made a little nicer (for example using StringRef member functions instead of c-style strncmp and related functions) and generally safer usage. llvm-svn: 280139
* Add a few more unit tests for StringExtractor.Zachary Turner2016-08-301-0/+165
| | | | | | | | This is a NFC that adds more unit test coverage of the GetHex*** functions as well as the functions to extract numbers with a specific endianness. llvm-svn: 280124
* Convert some StringExtractor functions to accept MutableArrayRefs.Zachary Turner2016-08-301-6/+6
| | | | | | | | | | MutableArrayRef<T> is essentially a safer version of passing around (T*, length) pairs and provides some convenient functions for working with the data without having to manually manipulate indices. This is a minor NFC. llvm-svn: 280123
* Convert GetNameColonValue to return StringRefs.Zachary Turner2016-08-291-8/+8
| | | | | | | | | | | | StringExtractor::GetNameColonValue() looks for a substring of the form "<name>:<value>" and returns <name> and <value> to the caller. This results in two unnecessary string copies, since the name and value are not translated in any way and simply returned as-is. By converting this to return StringRefs we can get rid of hundreds of string copies. llvm-svn: 280000
* Add some unit tests for StringExtractor::GetNameColonValue.Zachary Turner2016-08-271-0/+53
| | | | | | | | These are helpful on their own, but will be even more useful once the GetNameColonValue is updated to return StringRefs instead of std::strings. llvm-svn: 279919
* Add unit tests for ModuleCachePavel Labath2016-05-254-0/+192
| | | | | | | | | | Reviewers: ovyalov, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D20570 llvm-svn: 270684
* Add a new task pool class to LLDBTamas Berghammer2015-10-202-0/+63
| | | | | | | | | | | | | | | | | | | | | | The purpose of the class is to make it easy to execute tasks in parallel Basic design goals: * Have a very lightweight and easy to use interface where a list of lambdas can be executed in parallel * Use a global thread pool to limit the number of threads used (std::async don't do it on Linux) and to eliminate the thread creation overhead * Destroy the thread currently not in use to avoid the confusion caused by them during debugging LLDB Possible future improvements: * Possibility to cancel already added, but not yet started tasks * Parallel for_each implementation * Optimizations in the thread creation destroyation code Differential revision: http://reviews.llvm.org/D13727 llvm-svn: 250820
* Make UriParser to support [$HOSTNAME] notation.Oleksiy Vyalov2015-08-201-0/+24
| | | | | | http://reviews.llvm.org/D12025 llvm-svn: 245639
* Fix StringExtractor.h issues.Bruce Mitchener2015-07-071-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Fix StringExtractor.h issues. * source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (#include "Utility/StringExtractor.h): Not needed, this is already included by ProcessKDP.h * unittests/Utility/StringExtractorTest.cpp (#include "Utility/StringExtractor.h): Update include path to the new location. Reviewers: labath, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10995 llvm-svn: 241596
* Fix linking of unit tests via CMake on Windows.Zachary Turner2015-03-181-5/+0
| | | | | | | A previous attempt to make the unit tests link properly on Linux broke it for Windows. This patch fixes it for both platforms. llvm-svn: 232648
* Convert CRLF to LF.Zachary Turner2015-03-171-9/+9
| | | | | | | I accidentally let some Windows line endings slip in. This is a good reminder for me to use core.eol=lf. llvm-svn: 232560
* Fix the clang -Werror build & make the unit tests link under LinuxDavid Blaikie2015-03-172-37/+42
| | | | | | | | The order of libraries passed to the linker didn't work under linux (you need the llvm libraries first, then the lldb libraries). I modelled this after clang's setup here. Seemed simple enough to just be consistent. llvm-svn: 232461
* Rework the gtest directory structure.Zachary Turner2015-03-133-0/+545
This makes the directory structure mirror the canonical LLVM directory structure for a gtest suite. Additionally, this patch deletes the xcode project. Nobody is currently depending on this, and it would be better to have gtest unit tests be hand-maintained in the Xcode workspace rather than using this python test runner. Patches to that effect will be submitted as followups. llvm-svn: 232211
OpenPOWER on IntegriCloud