summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove an expensive lock from TimerPavel Labath2017-05-151-2/+2
| | | | | | | | | | | | | The Timer destructor would grab a global mutex in order to update execution time. Add a class to define a category once, statically; the class adds itself to an atomic singly linked list, and thus subsequent updates only need to use an atomic rather than grab a lock and perform a hashtable lookup. Differential Revision: https://reviews.llvm.org/D32823 Patch by Scott Smith <scott.smith@purestorage.com>. llvm-svn: 303058
* Rename Error -> Status.Zachary Turner2017-05-1225-329/+330
| | | | | | | | | | | | | | | 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
* Fix !N and !-N commands and add a test case.Jim Ingham2017-04-191-1/+5
| | | | | | <rdar://problem/31713267> llvm-svn: 300785
* Add back code to implement "frame var -a,-l,-g" filters.Jim Ingham2017-04-181-35/+55
| | | | | | | | | | r285226 dropped the code that did these checks. I am pretty sure that was inadvertent, so I added that back in and added a test for it. <rdar://problem/31661252> llvm-svn: 300564
* Fix crash when completing in the current directory.Zachary Turner2017-04-151-1/+4
| | | | llvm-svn: 300386
* iwyu fixes for lldbCore.Zachary Turner2017-04-061-0/+1
| | | | | | | | | | | | | | This adjusts header file includes for headers and source files in Core. In doing so, one dependency cycle is eliminated because all the includes from Core to that project were dead includes anyway. In places where some files in other projects were only compiling due to a transitive include from another header, fixups have been made so that those files also include the header they need. Tested on Windows and Linux, and plan to address failures on OSX and FreeBSD after watching the bots. llvm-svn: 299714
* getAsInteger is not a equivalent replacement for strtolJim Ingham2017-04-061-2/+10
| | | | | | | | work around that fact for CommandObjectMemoryWrite. <rdar://problem/31457148> llvm-svn: 299609
* Delete some more dead includes.Zachary Turner2017-03-2220-8/+20
| | | | | | | This breaks the cycle between Target and PluginLanguageC++, reducing the overall cycle count from 43 to 42. llvm-svn: 298561
* Move FileSpec from Host -> Utility.Zachary Turner2017-03-223-3/+3
| | | | llvm-svn: 298536
* Move StringList from Core -> Utility.Zachary Turner2017-03-212-2/+2
| | | | llvm-svn: 298412
* [Support] Support both Windows and Posix paths on both platforms.Zachary Turner2017-03-161-1/+2
| | | | | | | | | | | | | | | | | | Previously which path syntax we supported dependend on what platform we were compiling LLVM on. While this is normally desirable, there are situations where we need to be able to handle a path that we know was generated on a remote host. Remote debugging, for example, or parsing debug info. 99% of the code in LLVM for handling paths was platform agnostic and literally just a few branches were gated behind pre-processor checks, so this changes those sites to use runtime checks instead, and adds a flag to every path API that allows one to override the host native syntax. Differential Revision: https://reviews.llvm.org/D30858 llvm-svn: 298004
* Remove lldb streams from the Log class completelyPavel Labath2017-03-151-6/+17
| | | | | | | | | | | | | | | | | | | | | 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 up some enumerate() callsites in LLDB.Zachary Turner2017-03-132-5/+5
| | | | llvm-svn: 297640
* Use LLVM for file / directory enumeration.Zachary Turner2017-03-131-1/+1
| | | | | | | | | | FileSpec::EnumerateDirectory has a bunch of platform-specific gunk in it for posix and non-posix platforms. We can get rid of all this by using LLVM's easy-to-use directory iterators. Differential Revision: https://reviews.llvm.org/D30807 llvm-svn: 297598
* Resubmit "Make file / directory completion work properly on Windows."Zachary Turner2017-03-131-166/+132
| | | | | | This fixes the compilation failures with the original patch. llvm-svn: 297597
* Revert "Make file / directory completion work properly on Windows."Zachary Turner2017-03-121-132/+166
| | | | | | | | | This reverts commit a6a29374662716710f80c8ece96629751697841e. It has a few compilation failures that I don't have time to fix at the moment. llvm-svn: 297589
* Make file / directory completion work properly on Windows.Zachary Turner2017-03-121-166/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were a couple of problems with this function on Windows. Different separators and differences in how tilde expressions are resolved for starters, but in addition there was no clear indication of what the function's inputs or outputs were supposed to be, and there were no tests to demonstrate its use. To more easily paper over the differences between Windows paths, non-Windows paths, and tilde expressions, I've ported this function to use LLVM-based directory iteration (in fact, I would like to eliminate all of LLDB's directory iteration code entirely since LLVM's is cleaner / more efficient (i.e. it invokes fewer stat calls)). and llvm's portable path manipulation library. Since file and directory completion assumes you are referring to files and directories on your local machine, it's safe to assume the path syntax properties of the host in doing so, so LLVM's APIs are perfect for this. I've also added a fairly robust set of unit tests. Since you can't really predict what users will be on your machine, or what their home directories will be, I added an interface called TildeExpressionResolver, and in the unit test I've mocked up a fake implementation that acts like a unix password database. This allows us to configure some fake users and home directories in the test, so we can exercise all of those hard-to-test codepaths that normally otherwise depend on the host. Differential Revision: https://reviews.llvm.org/D30789 llvm-svn: 297585
* Resubmit FileSystem changes.Zachary Turner2017-03-082-8/+11
| | | | | | | | | | 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
* Revert "Use LLVM for all stat-related functionality."Pavel Labath2017-03-072-10/+6
| | | | | | | | | | | | | | | 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
* Use LLVM for all stat-related functionality.Zachary Turner2017-03-072-6/+10
| | | | | | | | | | 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
* Remove FileSpec::ReadFileContents.Zachary Turner2017-03-061-2/+4
| | | | | | | | | | | | | | | | This functionality is subsumed by DataBufferLLVM, which is also more efficient since it will try to mmap. However, we don't yet support mmaping writable private sections, and in some cases we were using ReadFileContents and then modifying the buffer. To address that I've added a flag to the DataBufferLLVM methods that allow you to map privately, which disables the mmaping path entirely. Eventually we should teach DataBufferLLVM to use mmap with writable private, but that is orthogonal to this effort. Differential Revision: https://reviews.llvm.org/D30622 llvm-svn: 297095
* Move many other files from Core -> Utility.Zachary Turner2017-03-061-1/+0
| | | | llvm-svn: 297043
* Move DataBuffer / DataExtractor and friends from Core -> Utility.Zachary Turner2017-03-043-3/+3
| | | | llvm-svn: 296943
* Isolate Target-specific functionality of DataExtractor.Zachary Turner2017-03-031-9/+9
| | | | | | | | | | | | | | | | In an effort to move the various DataBuffer / DataExtractor classes from Core -> Utility, we have to separate the low-level functionality from the higher level functionality. Only a few functions required anything other than reading/writing raw bytes, so those functions are separated out into a more appropriate area. Specifically, Dump() and DumpHexBytes() are moved into free functions in Core/DumpDataExtractor.cpp, and GetGNUEHPointer is moved into a static function in the only file that it's referenced from. Differential Revision: https://reviews.llvm.org/D30560 llvm-svn: 296910
* Move Log from Core -> Utility.Zachary Turner2017-03-031-1/+1
| | | | | | | | | 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 MSVC buildPavel Labath2017-03-021-1/+1
| | | | | | | | MSVC (at least the version I am using) does not want to implicitly capture a const bool variable. Move it into the lambda, as it is not used outside anyway. llvm-svn: 296738
* Fix various warnings. NFCZachary Turner2017-03-022-6/+4
| | | | llvm-svn: 296717
* Modernize Enable/DisableLogChannel interface a bitPavel Labath2017-03-011-3/+3
| | | | | | | | | | | | | | 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
* Fix a couple of corner cases in NameMatchesPavel Labath2017-02-202-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Reapply "Refactor log channel registration mechanism"Pavel Labath2017-02-171-34/+10
| | | | | | | | | 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-10/+34
| | | | | | | The change breaks on Windows and NetBSD bots. Revert while I investigate. llvm-svn: 295201
* Refactor log channel registration mechanismPavel Labath2017-02-151-34/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Clean up debug loggingPavel Labath2017-02-131-4/+0
| | | | | | | | | | | | | | | | | | | | | Summary: We've had two ways to print a "debug" log message. - Log::GetDebug() was testing a Stream flag which was never set. - Log::Debug() was checking for the presence of "log enable --debug" flag. Given that these two were used very rarely and we already have a different way to specify "I want a more verbose log", I propose to remove these two functions and migrate the callers to LLDB_LOGV. This commit does that. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D29823 llvm-svn: 294939
* [cmake] add missing dependency lldbCommands->lldbBasePavel Labath2017-02-091-0/+1
| | | | | | | | | | CommandObjectVersion.cpp calls lldb_private::GetVersion (present in lldbBase). This should fix the unittest link on windows. I am not sure why is this not present on other platforms -- my guess is that there lldbBase is included in the link through some other dependency chain. llvm-svn: 294549
* Switch std::call_once to llvm::call_onceKamil Rytarowski2017-02-061-2/+3
| | | | | | | | | | | | | | | | | | | | | 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
* Add a missing break statementPavel Labath2017-02-031-0/+1
| | | | llvm-svn: 294036
* Move classes from Core -> Utility.Zachary Turner2017-02-026-9/+9
| | | | | | | | | | | | | | | | | | | | | | | 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
* Break some dependencies in lldbUtility.Zachary Turner2017-02-011-1/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D29359 llvm-svn: 293806
* [CMake] Add accurate dependency specificationsChris Bieneman2017-01-311-0/+15
| | | | | | | | | | | | | | | | | Summary: This patch adds accurate dependency specifications to the mail LLDB libraries and tools. In all cases except lldb-server, these dependencies are added in addition to existing dependencies (making this low risk), and I performed some code cleanup along the way. For lldb-server I've cleaned up the LLVM dependencies down to just the minimum actually required. This is more than lldb-server actually directly references, and I've left a todo in the code to clean that up. Reviewers: labath, zturner Subscribers: lldb-commits, danalbert, srhines, ki.stfu, mgorny, jgosnell Differential Revision: https://reviews.llvm.org/D29333 llvm-svn: 293686
* Provide option to set pc of the file loaded in memory.Hafiz Abid Qadeer2017-01-241-3/+9
| | | | | | | | | | | | | | Summary: This commit adds an option to set PC to the entry point of the file loaded using "target module load" command. In D28804, Greg asked me to separate this part under a different option. Reviewers: clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D28944 llvm-svn: 292989
* Provide a substitute to load command of gdb.Hafiz Abid Qadeer2017-01-191-0/+28
| | | | | | | | | | | | | | | For bare-metal targets, lldb was missing a command like 'load' in gdb which can be used to create executable image on the target. This was discussed in http://lists.llvm.org/pipermail/lldb-dev/2016-December/011752.html This commits adds an option to "target module load" command to provide that functionality. It does not set the PC to entry address which will be done separately. Reviewed in https://reviews.llvm.org/D28804 llvm-svn: 292499
* Add a more succinct logging syntaxPavel Labath2017-01-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix compiler warning.Zachary Turner2016-12-161-1/+0
| | | | llvm-svn: 289994
* Add methods to enable using formatv syntax in LLDB.Zachary Turner2016-12-161-3/+3
| | | | | | | | | | | | | 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
* Remove some more uses of Args::GetArgumentAtIndex.Zachary Turner2016-12-095-151/+137
| | | | llvm-svn: 289188
* Fix some occurrences of passing StringRef to Printf.Zachary Turner2016-12-093-15/+15
| | | | | | | Hopefully these will all disappear in the future once we move to formatv. llvm-svn: 289168
* Modernize the Args access pattern in a few more commands.Zachary Turner2016-12-093-98/+61
| | | | llvm-svn: 289164
* Convert CommandObjectFrame to entry-based Args access.Zachary Turner2016-12-081-37/+22
| | | | | | | | In the process, discovered a bug related to the use of an uninitialized-pointer, and fixed as suggested by Enrico in an lldb-dev mailing list thread. llvm-svn: 289015
* Convert CommandObjectCommands to entry-based Args access.Zachary Turner2016-12-081-168/+154
| | | | llvm-svn: 289012
* Use Timeout<> in EvaluateExpressionOptions classPavel Labath2016-12-062-3/+3
| | | | llvm-svn: 288797
OpenPOWER on IntegriCloud