summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility
Commit message (Collapse)AuthorAgeFilesLines
...
* Use correct format specifier to silence -Wformat warning.Richard Trieu2019-05-291-1/+2
| | | | llvm-svn: 362035
* Add more information to the log timer dumpAntonio Afonso2019-05-291-12/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The `log timer dump` is showing the time of the function itself minus any function that is called from this one that also happens to be timed. However, this is really not obvious and it also makes it hard to understand the time spent in total and also which children are actually taking the time. To get a better reading of the timer dump I added the total, children (which I named child) and also the hit count. I used these timers to figure out a performance issue and only after adding this things were more clear to me. It looks like this: ``` (lldb) log timer dump 35.447713617 sec (total: 35.449s; child: 0.001s; count: 1374) for void SymbolFileDWARF::Index() 29.717921481 sec (total: 29.718s; child: 0.000s; count: 8230500) for const lldb_private::ConstString &lldb_private::Mangled::GetDemangledName(lldb::LanguageType) const 21.049508865 sec (total: 24.683s; child: 3.633s; count: 1399) for void lldb_private::Symtab::InitNameIndexes() ... ``` Reviewers: clayborg, teemperor, labath, espindola, xiaobai Reviewed By: labath, xiaobai Subscribers: emaste, mgorny, arichardson, eraman, MaskRay, jdoerfert, labath, davide, teemperor, aprantl, erik.pilkington, jfb, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D61235 llvm-svn: 361987
* [Utility] Small improvements to the Broadcaster class (NFC)Jonas Devlieghere2019-05-241-47/+38
| | | | | | | | | I touched the Broadcaster class earlier today (r361544) and noticed a few things that could be improved. This patch includes variety of small fixes: use early returns, use LLDB_LOG macro, use doxygen comments and finally format the class. llvm-svn: 361597
* Fix integer literals which are cast to boolJonas Devlieghere2019-05-243-6/+6
| | | | | | | | | This change replaces built-in types that are implicitly converted to booleans. Differential revision: https://reviews.llvm.org/D62284 llvm-svn: 361580
* [lldb] Make sure RegularExpression constructors always initialize member ↵Jorge Gorbe Moya2019-05-231-4/+3
| | | | | | | | | | | | variables The copy constructor of RegularExpression doesn't initialize m_comp_err. This causes an use-of-initialized-value error when a RegularExpression is copied: the copy constructor calls Compile, which calls Free to free the existing regex if needed, which in turn reads m_comp_err to check if there's any regex to be freed. This change calls the default constructor from the other constructors to make sure members are always initialized with sensible values. This also avoids duplicating init logic, like the RegularExpression(llvm:StringRef) constructor does, which is error prone. Differential Revision: https://reviews.llvm.org/D62334 llvm-svn: 361546
* [Utility] Avoid a few unnecessary copies (NFC)Jonas Devlieghere2019-05-232-9/+10
| | | | | | | Avoid unnecessary copies by either passing by const-reference or moving the argument. llvm-svn: 361544
* [Reproducer] Pass FileSpec by const-ref. (NFC)Jonas Devlieghere2019-05-231-1/+1
| | | | | | | Fix two functions where we were passing FileSpecs by value, while we could pass by const reference. llvm-svn: 361459
* [Utility] Modernize C-style catsJonas Devlieghere2019-05-2311-204/+229
| | | | | | | | Replaces the remaining C-style casts with explicit casts in Utility. The motivation is that they are (1) easier to spot and (2) don't have multiple meanings. llvm-svn: 361458
* Add AST loggingGabor Marton2019-05-221-0/+1
| | | | | | | | | | | | | | | | Summary: Log the AST of the TU associated with LLDB's `expr` command, once a declaration is completed Reviewers: shafik Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D62061 llvm-svn: 361362
* Delete unnecessary copy ctorsFangrui Song2019-05-222-8/+0
| | | | llvm-svn: 361358
* Simplify ArchSpec::IsMIPS()Fangrui Song2019-05-161-8/+2
| | | | llvm-svn: 360865
* Delete unnecessary copy ctors/copy assignment operatorsFangrui Song2019-05-154-20/+0
| | | | | | It's the simplest and gives the cleanest semantics. llvm-svn: 360762
* Fix file names in file headers. NFCFangrui Song2019-05-132-2/+2
| | | | llvm-svn: 360554
* Fix bug in ArchSpec::MergeFromGreg Clayton2019-05-081-1/+1
| | | | | | | | | | Previous ArchSpec tests didn't catch this bug since we never tested just the OS being out of date. Fixed the bug and covered this with a test that would catch this. This was found when trying to load a core file where the core file was an ELF file with just the e_machine for architeture and where the ELF header had no OS set in the OSABI field of the e_ident. It wasn't merging the architecture with the target architecture correctly. Differential Revision: https://reviews.llvm.org/D61659 llvm-svn: 360292
* DWARFExpression: Fix implementation of DW_OP_pickPavel Labath2019-04-291-0/+7
| | | | | | | | | | | | | | | | | | | | | | Summary: The DWARF spec states that the DWARF stack arguments are numbered from the top. Our implementation of DW_OP_pick was counting them from the bottom. This bug probably wasn't noticed because nobody (except my upcoming postfix-to-DWARF converter) uses DW_OP_pick, but I've cross-checked with gdb to confirm that counting from the top is the expected behavior. This patch fixes the implementation to match the spec and gdb behavior and adds a test. Reviewers: jasonmolenda, clayborg Subscribers: mgorny, aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D61182 llvm-svn: 359436
* [Reproducers] Limit logging to calls that cross the API boundary.Jonas Devlieghere2019-04-231-13/+6
| | | | | | | | | | | | | | | | | | | | We recently moved API logging into the instrumentation macros. This made that logging is now consistent and abstracted behind a macro for every API functions, independent of the reproducers. It also means we have a lot more output. While this is a good thing, it also meant a lot more noise in the log, from things that aren't always equally interesting, such as the copy constructor for example. To improve usability, we should increase the signal-to-noise ratio. I propose to achieve this by only logging API functions that cross the API boundary. This is a divergence of what we had before, where a select number of functions were logged, irregardless of the API boundary, a concept that was introduced for the reproducers. However, I believe this is in line with the purpose of the API log. Differential revision: https://reviews.llvm.org/D60984 llvm-svn: 359016
* [Reproducers] Fix lifetime issueJonas Devlieghere2019-04-221-2/+0
| | | | | | | | | | Deallocating the data recorder in during the ::Keep() operation causes problems down the line when exiting the debugger. The command interpreter still holds a pointer to the now deallocated object and has no way to know it no longer exists. This is exactly what the m_record flag was meant for, although it wasn't hooked up properly either. llvm-svn: 358916
* Prevent unnecessary conversion from StringRef to C-string [NFC]Raphael Isemann2019-04-141-1/+1
| | | | | | | | | There is an alternative method to GetConstCStringWithLength that takes a StringRef. GetConstCStringWithLength also calls this method in the end, so directly calling the StringRef saves us from a unnecessary conversion to a C-string. llvm-svn: 358357
* [NFC] Remove ASCII lines from commentsJonas Devlieghere2019-04-1016-298/+0
| | | | | | | | | | | | | | | | | | | | | | | A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
* [Reproducers] Capture return values of functions returning by ptr/refJonas Devlieghere2019-04-031-0/+9
| | | | | | | | | | | | | | | For some reason I had convinced myself that functions returning by pointer or reference do not require recording their result. However, after further considering I don't see how that could work, at least not with the current implementation. Interestingly enough, the reproducer instrumentation already (mostly) accounts for this, though the lldb-instr tool did not. This patch adds the missing macros and updates the lldb-instr tool. Differential revision: https://reviews.llvm.org/D60178 llvm-svn: 357639
* [CMake] Move link dependencies where they are used.Jonas Devlieghere2019-03-291-35/+4
| | | | | | | | | The utility library shouldn't depend on curses, libedit or python. Move curses to core, libedit to host and python to the python plugin. Differential revision: https://reviews.llvm.org/D59970 llvm-svn: 357287
* [Cmake] Unify python variablesJonas Devlieghere2019-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | FindPythonInterp and FindPythonLibs do two things, they set some variables (PYTHON_LIBRARIES, PYTHON_INCLUDE_DIRS) and update the cached variables (PYTHON_LIBRARY, PYTHON_INCLUDE_DIR) which are also used to specify a custom python installation. I believe the canonical way to do this is to use the PYTHON_LIBRARIES and PYTHON_INCLUDE_DIRS variables instead of the cached ones. However, since the cached variables are accessible from the cache and GUI, this is a lot less confusing when you're trying to debug why a variable did or didn't get the value you expected. Furthermore, as far as I can tell, the implementation uses the cached variables to set their LIBRARIES/DIRS counterparts. This is also the reason this works today even though we mix-and-match. Differential revision: https://reviews.llvm.org/D59968 llvm-svn: 357282
* Don't abort() in lldb_assert and document why.Adrian Prantl2019-03-291-1/+0
| | | | | | | | rdar://problem/49356014 Differential Revision: https://reviews.llvm.org/D59911 llvm-svn: 357268
* [Platform] Remove Kalimba PlatformJonas Devlieghere2019-03-271-40/+8
| | | | | | | | | This patch removes the Kalimba platform. For more information please refer to the corresponding thread on the mailing list. http://lists.llvm.org/pipermail/lldb-dev/2019-March/014921.html llvm-svn: 357086
* [Args] Handle backticks to prevent crash.Jonas Devlieghere2019-03-251-3/+4
| | | | | | | | | | Currently LLDB crashes when autocompleting a command that ends with a backtick because the quote character wasn't handled. This fixes that and adds a unit test for this function. Differential revision: https://reviews.llvm.org/D59779 llvm-svn: 356927
* [Reproducers] Stop recording instead of deallocatingJonas Devlieghere2019-03-121-1/+3
| | | | | | | | | | | | | The command interpreter holds a pointer to a DataRecorder. After generating the reproducer, we deallocated all the DataRecorders, causing the command interpreter to hold a non-null reference to an invalid object. This patch changes the behavior of the command provider to stop the DataRecorders when a reproducer is generated, rather than deallocating them. llvm-svn: 355940
* Bring Doxygen comment syntax in sync with LLVM coding style.Adrian Prantl2019-03-112-7/+7
| | | | | | This changes '@' prefix to '\'. llvm-svn: 355841
* Promote more debug-only assertions to regular assertions.Adrian Prantl2019-03-071-16/+0
| | | | llvm-svn: 355569
* Pass ConstString by value (NFC)Adrian Prantl2019-03-065-13/+13
| | | | | | | | | | | | | | | | | My apologies for the large patch. With the exception of ConstString.h itself it was entirely produced by sed. ConstString has exactly one const char * data member, so passing a ConstString by reference is not any more efficient than copying it by value. In both cases a single pointer is passed. But passing it by value makes it harder to accidentally return the address of a local object. (This fixes rdar://problem/48640859 for the Apple folks) Differential Revision: https://reviews.llvm.org/D59030 llvm-svn: 355553
* Move ProcessInfo from Host to Utility.Zachary Turner2019-03-042-0/+311
| | | | | | | | | | | | | | | | | | | | | There are set of classes in Target that describe the parameters of a process - e.g. it's PID, name, user id, and similar. However, since it is a bare description of a process and contains no actual functionality, there's nothing specifically that makes this appropriate for being in Target -- it could just as well be describing a process on the host, or some hypothetical virtual process that doesn't even exist. To cement this, I'm moving these classes to Utility. It's possible that we can find a better place for it in the future, but as it is neither Host specific nor Target specific, Utility seems like the most appropriate place for the time being. After this there is only 2 remaining references to Target from Host, which I'll address in a followup. Differential Revision: https://reviews.llvm.org/D58842 llvm-svn: 355342
* Refactor user/group name resolving codePavel Labath2019-03-042-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This creates an abstract base class called "UserIDResolver", which can be implemented to provide user/group ID resolution capabilities for various objects. Posix host implement a PosixUserIDResolver, which does that using posix apis (getpwuid and friends). PlatformGDBRemote forwards queries over the gdb-remote link, etc. ProcessInstanceInfo class is refactored to make use of this interface instead of taking a platform pointer as an argument. The base resolver class already implements caching and thread-safety, so implementations don't have to worry about that. The main motivating factor for this was to remove external dependencies from the ProcessInstanceInfo class (so it can be put next to ProcessLaunchInfo and friends), but it has other benefits too: - ability to test the user name caching code - ability to test ProcessInstanceInfo dumping code - consistent interface for user/group resolution between Platform and Host classes. Reviewers: zturner, clayborg, jingham Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D58167 llvm-svn: 355323
* Fix gcc build for r355249Pavel Labath2019-03-021-1/+1
| | | | | | | automatic move should not fire when returning type T in a function with result type Expected<T>. Some compilers seem to allow that nonetheless. llvm-svn: 355270
* [Reproducers] Capture and replay interpreter commands.Jonas Devlieghere2019-03-021-0/+46
| | | | | | | | | | | | | | | | | This patch adds the necessary logic to capture and replay commands entered into the command interpreter. A DataRecorder shadows the input and writes its data to a know file. During replay this file is used as the command interpreter's input. It's possible to the command interpreter more than once, with a different input source. We support this scenario by using multiple buffers. The synchronization for this takes place at the SB layer, where we create a new recorder every time the debugger input is changed. During replay we use the corresponding buffer as input. Differential revision: https://reviews.llvm.org/D58564 llvm-svn: 355249
* [Reproducers] Add more logging to reproducer instrumentationJonas Devlieghere2019-02-271-4/+29
| | | | | | | | | | | Debugging issues with instrumentation capture and replay can be particularly tricky, especially because part of the process takes places even before the debugger is initialized. This patch adds more logging capabilities to these classes, hidden behind a macro define. Differential revision: https://reviews.llvm.org/D58566 llvm-svn: 355002
* [Utility] Fix ArchSpec.MergeFrom to correctly merge environmentsAlex Langford2019-02-271-3/+2
| | | | | | | | | | | | | | | | Summary: This behavior was originally added in rL252264 (git commit 76a7f365da) in order to be extra careful with handling platforms like watchos and tvos. However, as far as triples go, those two (and others) are treated as OSes and not environments, so that should not really apply here. Additionally, this behavior is incorrect and can lead to incorrect ArchSpecs. Because android is specified as an environment and not an OS, not propogating the environment can lead to modules and targets being misidentified. Differential Revision: https://reviews.llvm.org/D58664 llvm-svn: 354938
* [Utility] Remove Triple{Environment,OS,Vendor}IsUnspecifiedUnknown from ArchSpecAlex Langford2019-02-261-5/+4
| | | | | | | | | | | | | | Summary: These functions should always return the opposite of the `Triple{Environment,OS,Vendor}WasSpecified` functions. Unspecified unknown is the same as unspecified, which is why one set of functions should give us what we want. It's possible to have specified unknown, which is why we can't just rely on checking the enum values of vendor/os/environment. We must also ensure that the names of these are empty and not "unknown". Differential Revision: https://reviews.llvm.org/D58653 llvm-svn: 354933
* [Reproducers] Initialize reproducers before initializing the debugger.Jonas Devlieghere2019-02-211-0/+2
| | | | | | | | | | | | | | | | As per the discussion on the mailing list: http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20190218/048007.html This commit implements option (3): > Go back to initializing the reproducer before the rest of the debugger. > The method wouldn't be instrumented and guarantee no other SB methods are > called or SB objects are constructed. The initialization then becomes part > of the replay. Differential revision: https://reviews.llvm.org/D58410 llvm-svn: 354631
* Have Stream::PutCStringAsRawHex8 take llvm::StringRefPavel Labath2019-02-121-5/+3
| | | | | | | | | This enables the function to be called with a StringRef without jumping through any hoops. I rename the function to "PutStringAsRawHex8" to honor the extended interface. I also remove ".c_str()" from any calls to this function I could find. llvm-svn: 353841
* Breakpad: auto-detect path style of file entriesPavel Labath2019-02-111-0/+11
| | | | | | | | | | | | | | | | | | | | | | | Summary: This adds support for auto-detection of path style to SymbolFileBreakpad (similar to how r351328 did the same for DWARF). We guess each file entry separately, as we have no idea which file came from which compile units (and different compile units can have different path styles). The breakpad generates should have already converted the paths to absolute ones, so this guess should be reasonable accurate, but as always with these kinds of things, it is hard to give guarantees about anything. In an attempt to bring some unity to the path guessing logic, I move the guessing logic from inside SymbolFileDWARF into the FileSpec class and have both symbol files use it to implent their desired behavior. Reviewers: clayborg, lemo, JDevlieghere Subscribers: aprantl, markmentovai, lldb-commits Differential Revision: https://reviews.llvm.org/D57895 llvm-svn: 353702
* Fix some warnings introduced in r353324 (ReproducerInstrumentation patch)Pavel Labath2019-02-071-1/+1
| | | | | | | | | | | | GetIndexForObjectImpl generated a bunch of "conversion casts away constness warnings". Change the function to use "const void *" (and static_cast, while I'm at it), to avoid this. Driver.cpp: unused variable "replay" (this was actually caused by a subsequent partial revert of this patch). I just finish the revert by removing the variable completely. llvm-svn: 353405
* [Reproducers] SBReproducer framework: Capture & ReplayJonas Devlieghere2019-02-061-1/+52
| | | | | | | | | | | | | This is part two of the reproducer instrumentation framework. It contains the code to capture and replay function calls. The main user of this framework will be the SB API layer. For all the details refer to the RFC on the mailing list: http://lists.llvm.org/pipermail/lldb-dev/2019-January/014530.html Differential revision: https://reviews.llvm.org/D56322 llvm-svn: 353324
* Fix strlen() of unbound array undefined behaviorJan Kratochvil2019-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | LLDB testsuite fails when built by GCC8 on: LLDB :: SymbolFile/DWARF/find-basic-namespace.cpp This is because this code in LLDB codebase has undefined behavior: #include <algorithm> #include <string.h> // lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:1731 static struct section_64 { char sectname[16]; char segname[16]; } sect64 = { {'_','_','a','p','p','l','e','_','n','a','m','e','s','p','a','c'}, "__DWARF" }; int main() { return std::min<size_t>(strlen(sect64.sectname), sizeof(sect64.sectname)); } It has been discussed as a (false) bugreport to GCC: wrong-code: LLDB testcase fails: SymbolFile/DWARF/find-basic-namespace.cpp https://bugzilla.redhat.com/show_bug.cgi?id=1672436 Differential Revision: https://reviews.llvm.org/D57781 llvm-svn: 353280
* [Reproducers] Instrumentation Framework: SerializationJonas Devlieghere2019-02-052-0/+45
| | | | | | | | | | | | This is the is serialization/deserialization part of the reproducer instrumentation framework. For all the details refer to the RFC on the mailing list: http://lists.llvm.org/pipermail/lldb-dev/2019-January/014530.html Differential revision: https://reviews.llvm.org/D57714 llvm-svn: 353195
* [Scalar] Remove partially wrong and unused functions.Davide Italiano2019-01-301-50/+0
| | | | | | | I originally thought about fixing them, but hey, nobody is using them anyway. llvm-svn: 352643
* [Scalar] Hoist a duplicated (and sometimes wrong) comment.Davide Italiano2019-01-301-9/+3
| | | | | | Pointed out by Zachary and Adrian. llvm-svn: 352641
* [Scalar] Implement support for 512-bit values.Davide Italiano2019-01-302-1/+212
| | | | | | | | (useful, e.g. when reading 512-bits registers, a-la AVX-512). <rdar://problem/46886288> llvm-svn: 352639
* [Reproducers] Add file providerJonas Devlieghere2019-01-293-0/+152
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the file provider which is responsible for capturing files used by LLDB. When capturing a reproducer, we use a file collector that is very similar to the one used in clang. For every file that we touch, we add an entry with a mapping from its virtual to its real path. When we decide to generate a reproducer we copy over the files and their permission into to reproducer folder. When replaying a reproducer, we load the VFS mapping and instantiate a RedirectingFileSystem. The latter will transparently use the files available in the reproducer. I've tested this on two macOS machines with an artificial example. Still, it is very likely that I missed some places where we (still) use native file system calls. I'm hoping to flesh those out while testing with more advanced examples. However, I will fix those things in separate patches. Differential revision: https://reviews.llvm.org/D54617 llvm-svn: 352538
* Add UUID::SetFromOptionalStringRef, use it in DynamicLoaderDarwinJim Ingham2019-01-241-0/+12
| | | | | | | | | | | We use UUID::fromOptionalData to read UUID's from the Mach-O files, so UUID's of all 0's are invalid UUID's. We also get uuid's from debugserver, which need to match the file UUID's. So we need an API that treats "000000000" as invalid as well. Added that and use it. Differential Revision: https://reviews.llvm.org/D57195 llvm-svn: 352122
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1953-212/+159
| | | | | | | | | | | | | | | | | 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
* [Reproducers] Refactor reproducer infoJonas Devlieghere2019-01-181-14/+12
| | | | | | | | | | | | | | | | | | | | | In the original reproducer design, I expected providers to be more dynamic than they turned out. For example, we don't have any instances where one provider has multiple files. Additionally, I expected there to be less locality between capture and replay, with the provider being defined in one place and the replay code to live in another. Both contributed to the design of the provider info. This patch refactors the reproducer info to be something static. This means less magic strings and better type checking. The new design still allows for the capture and replay code to live in different places as long as they both have access to the new statically defined info class. I didn't completely get rid of the index, because it is useful for (1) sanity checking and (2) knowing what files are used by the reproducer. Differential revision: https://reviews.llvm.org/D56814 llvm-svn: 351501
OpenPOWER on IntegriCloud