summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/Core/LogTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move Log from Core -> Utility.Zachary Turner2017-03-031-212/+0
| | | | | | | | | 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 gcc compilation of LogTest.cppPavel Labath2017-03-011-1/+1
| | | | llvm-svn: 296595
* Modernize Enable/DisableLogChannel interface a bitPavel Labath2017-03-011-13/+13
| | | | | | | | | | | | | | Summary: Use StringRef and ArrayRef where possible. This adds an accessor to the Args class to get a view of the arguments as ArrayRef<const char *>. Reviewers: zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D30402 llvm-svn: 296592
* Log: Fix a regression in handling log optionsPavel Labath2017-02-271-0/+14
| | | | | | | | The channel refactor introduced a regression where we were not honoring the log options passed when enabling the channel. Fix that and add a test. llvm-svn: 296329
* Log: Fix race in accessing the stream variablePavel Labath2017-02-211-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The code was attempting to copy the shared pointer member in order to guarantee atomicity, but this is not enough. Instead, protect the pointer with a proper read-write mutex. This bug was present here for a long time, but my recent refactors must have altered the timings slightly, such that now this fails fairly often when running the tests: the test runner runs the "log disable" command just as the thread monitoring the lldb-server child is about to report that the server has exited. I add a test case for this. It's not possible to reproduce the race deterministically in normal circumstances, but I have verified that before the fix, the test failed when run under tsan, and was running fine afterwards. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D30168 llvm-svn: 295712
* Reapply "Refactor log channel registration mechanism"Pavel Labath2017-02-171-0/+113
| | | | | | | | | Changes wrt. previous version: - add #include <atomic>: fix build on windows - add extra {} around the string literals used to initialize llvm::StringLiteral: fix gcc build llvm-svn: 295442
* Revert "Refactor log channel registration mechanism"Pavel Labath2017-02-151-113/+0
| | | | | | | The change breaks on Windows and NetBSD bots. Revert while I investigate. llvm-svn: 295201
* Refactor log channel registration mechanismPavel Labath2017-02-151-0/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We currently have two log channel registration mechanisms. One uses a set of function pointers and the other one is based on the PluginManager. The PluginManager dependency is unfortunate, as logging is also used in lldb-server, and the PluginManager pulls in a lot of classes which are not used in lldb-server. Both approach have the problem that they leave too much to do for the user, and so the individual log channels end up reimplementing command line argument parsing, category listing, etc. Here, I replace the PluginManager-based approach with a one. The new API is more declarative, so the user only needs to specify the list of list of channels, their descriptions, etc., and all the common tasks like enabling/disabling categories are hadled by common code. I migrate the LogChannelDWARF (only user of the PluginManager method) to the new API. In the follow-up commits I'll replace the other channels with something similar. Reviewers: clayborg, zturner, beanz Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D29895 llvm-svn: 295190
* Convert Log class to llvm streamsPavel Labath2017-02-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This converts LLDB's logging to use llvm streams instead of lldb_private::Stream and friends. The changes are mostly straight-forward and amount to s/lldb_private::Stream/llvm::raw_ostream. The part worth calling out is the rewrite of the StreamCallback class. Previously this class contained a per-thread buffer of data written. I assume this had something to do with it trying to make sure each log line is delivered as a single event, instead of multiple (possibly interleaved) events. However, this is no longer relevant as the Log class already writes things to a temporary buffer and then delivers the message as a single "write", so I have just removed the code in question. Reviewers: zturner, clayborg Subscribers: emaste, lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D29615 llvm-svn: 294736
* Move classes from Core -> Utility.Zachary Turner2017-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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
* Fix new Log unit testPavel Labath2017-01-181-1/+1
| | | | | | | the test was flaky because I specified the format string for the process id incorrectly. This should fix it. llvm-svn: 292414
* Fix windows build for previous commitPavel Labath2017-01-181-1/+2
| | | | | | We get an error about a redefinition of getcwd(). This seems to fix it. llvm-svn: 292364
* Add a more succinct logging syntaxPavel Labath2017-01-181-0/+56
This adds the LLDB_LOG macro, which enables one to write more succinct log statements. if (log) log->Printf("log something: %d", var); becomes LLDB_LOG(log, "log something: {0}, var); The macro still internally does the "if(log)" dance, so the arguments are only evaluated if logging is enabled, meaning it has the same overhead as the previous syntax. Additionally, the log statements will be automatically prefixed with the file and function generating the log (if the corresponding new argument to the "log enable" command is enabled), so one does not need to manually specify this in the log statement. It also uses the new llvm formatv syntax, which means we don't have to worry about PRIx64 macros and similar, and we can log complex object (llvm::StringRef, lldb_private::Error, ...) more easily. Differential Revision: https://reviews.llvm.org/D27459 llvm-svn: 292360
OpenPOWER on IntegriCloud