summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility
Commit message (Collapse)AuthorAgeFilesLines
...
* DWARF: Add some support for non-native directory separatorsPavel Labath2019-01-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If we opened a file which was produced on system with different path syntax, we would parse the paths from the debug info incorrectly. The reason for that is that we would parse the paths as they were native. For example this meant that on linux we would treat the entire windows path as a single file name with no directory component, and then we would concatenate that with the single directory component from the DW_AT_comp_dir attribute. When parsing posix paths on windows, we would at least get the directory separators right, but we still would treat the posix paths as relative, and concatenate them where we shouldn't. This patch attempts to remedy this by guessing the path syntax used in each compile unit. (Unfortunately, there is no info in DWARF which would give the definitive path style used by the produces, so guessing is all we can do.) Currently, this guessing is based on the DW_AT_comp_dir attribute of the compile unit, but this can be refined later if needed (for example, the DW_AT_name of the compile unit may also contain some useful info). This style is then used when parsing the line table of that compile unit. This patch is sufficient to make the line tables come out right, and enable breakpoint setting by file name work correctly. Setting a breakpoint by full path still has some kinks (specifically, using a windows-style full path will not work on linux because the path will be parsed as a linux path), but this will require larger changes in how breakpoint setting works. Reviewers: clayborg, zturner, JDevlieghere Subscribers: aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D56543 llvm-svn: 351328
* Change std::sort to llvm::sort to detect non-determinism.Jonas Devlieghere2019-01-081-1/+1
| | | | | | | | | | LLVM added wrappers to std::sort (r327219) that randomly shuffle the container before sorting. The goal is to uncover non-determinism due to undefined sorting order of objects having the same key. This can be enabled with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON. llvm-svn: 350679
* [Scalar] Simplify comparison operators and add coverage.Davide Italiano2019-01-041-92/+3
| | | | llvm-svn: 350428
* [RegisterValue] Rewrite operator!= in terms of operator==. NFCI.Davide Italiano2018-12-291-26/+1
| | | | llvm-svn: 350149
* Delete lldb_utility::RangePavel Labath2018-12-272-77/+0
| | | | | | | This class is unused, and there is already a lldb_private::Range (defined in lldb/Core/RangeMap.h), which has similar functionality. llvm-svn: 350088
* [Scalar] Implement operator!= using operator==.Davide Italiano2018-12-211-31/+1
| | | | | | | | | | Summary: Adding some test coverage while I'm around. Reviewers: JDevlieghere, aprantl, zturner, clayborg, jingham Differential Revision: https://reviews.llvm.org/D56017 llvm-svn: 349970
* Simplify Boolean expressionsJonas Devlieghere2018-12-154-12/+6
| | | | | | | | | | | This patch simplifies boolean expressions acorss LLDB. It was generated using clang-tidy with the following command: run-clang-tidy.py -checks='-*,readability-simplify-boolean-expr' -format -fix $PWD Differential revision: https://reviews.llvm.org/D55584 llvm-svn: 349215
* Move Broadcaster+Listener+Event combo from Core into UtilityPavel Labath2018-12-144-0/+1253
| | | | | | | | | | | | | | | | | | Summary: These are general purpose "utility" classes, whose functionality is not debugger-specific in any way. As such, I believe they belong in the Utility module. This doesn't break any particular dependency (yet), but it reduces the number of Core dependencies across the board. Reviewers: zturner, jingham, teemperor, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D55361 llvm-svn: 349157
* [NFC] Small code cleanups in utility.Jonas Devlieghere2018-12-136-11/+9
| | | | | | Fix a few small annoyances in Utility I ran into. llvm-svn: 348996
* Add a unit test for ArchSpec matching to document how it behaves (and test it).Adrian Prantl2018-12-061-2/+2
| | | | llvm-svn: 348440
* [Reproducers] Only creaate the bottom-most dirJonas Devlieghere2018-12-041-1/+1
| | | | | | | | As Pavel noted on the mailing list we should only create the bottom-most directory if it doesn't exist. This should also fix the test case on Windows as we can use lit's temp directory. llvm-svn: 348289
* [Reproducers] Change how reproducers are initialized.Jonas Devlieghere2018-12-031-12/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the way the reproducer is initialized. Rather than making changes at run time we now do everything at initialization time. To make this happen we had to introduce initializer options and their SB variant. This allows us to tell the initializer that we're running in reproducer capture/replay mode. Because of this change we also had to alter our testing strategy. We cannot reinitialize LLDB when using the dotest infrastructure. Instead we use lit and invoke two instances of the driver. Another consequence is that we can no longer enable capture or replay through commands. This was bound to go away form the beginning, but I had something in mind where you could enable/disable specific providers. However this seems like it adds very little value right now so the corresponding commands were removed. Finally this change also means you now have to control this through the driver, for which I replaced --reproducer with --capture and --replay to differentiate between the two modes. Differential revision: https://reviews.llvm.org/D55038 llvm-svn: 348152
* [Reproducers] Improve reproducer API and add unit tests.Jonas Devlieghere2018-11-271-63/+50
| | | | | | | | | | | | | | | | | | | When I landed the initial reproducer framework I knew there were some things that needed improvement. Rather than bundling it with a patch that adds more functionality I split it off into this patch. I also think the API is stable enough to add unit testing, which is included in this patch as well. Other improvements include: - Refactor how we initialize the loader and generator. - Improve naming consistency: capture and replay seems the least ambiguous. - Index providers by name and make sure there's only one of each. - Add convenience methods for creating and accessing providers. Differential revision: https://reviews.llvm.org/D54616 llvm-svn: 347716
* [CMake] Pass full libedit path to linkerTatyana Krasnukha2018-11-271-1/+1
| | | | | | Otherwise, linker fails with "cannot find -ledit" in case of custom libedit installation. llvm-svn: 347693
* Fix the "make_unique is ambiguous" compiler error.Haojian Wu2018-11-141-2/+2
| | | | llvm-svn: 346839
* Add GDB remote packet reproducer.Jonas Devlieghere2018-11-132-0/+198
| | | | llvm-svn: 346780
* Re-land "Extract construction of DataBufferLLVM into FileSystem"Jonas Devlieghere2018-11-121-28/+0
| | | | | | This fixes some UB in isLocal detected by the sanitized bot. llvm-svn: 346707
* Revert "Extract construction of DataBufferLLVM into FileSystem"Davide Italiano2018-11-121-0/+28
| | | | | | It broke the lldb sanitizer bots. llvm-svn: 346694
* Remove header grouping comments.Jonas Devlieghere2018-11-113-11/+0
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Remove comments after header includes.Jonas Devlieghere2018-11-1123-101/+101
| | | | | | | | | | This patch removes the comments following the header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. Differential revision: https://reviews.llvm.org/D54385 llvm-svn: 346625
* Extract construction of DataBufferLLVM into FileSystemJonas Devlieghere2018-11-101-28/+0
| | | | | | | | | | This moves construction of data buffers into the FileSystem class. Like some of the previous refactorings we don't translate the path yet because the functionality hasn't been landed in LLVM yet. Differential revision: https://reviews.llvm.org/D54272 llvm-svn: 346598
* Revert "[FileSystem] Make use of FS in TildeExpressionResolver"Jonas Devlieghere2018-11-091-2/+2
| | | | | | | | The whole point of this change was making it possible to resolve paths without depending on the FileSystem, which is not what I did here. Not sure what I was thinking... llvm-svn: 346466
* [FileSystem] Make use of FS in TildeExpressionResolverJonas Devlieghere2018-11-091-2/+2
| | | | | | | | In order to call real_path from the TildeExpressionResolver we need access to the FileSystem. Since the resolver lives under utility we have to pass in the FS. llvm-svn: 346457
* [FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere2018-11-011-96/+15
| | | | | | | | | This patch removes the logic for resolving paths out of FileSpec and updates call sites to rely on the FileSystem class instead. Differential revision: https://reviews.llvm.org/D53915 llvm-svn: 345890
* [FileSystem] Remove Exists() from FileSpecJonas Devlieghere2018-11-012-10/+0
| | | | | | | | | This patch removes the Exists method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53845 llvm-svn: 345854
* [FileSystem] Remove ResolveExecutableLocation() from FileSpecJonas Devlieghere2018-11-011-36/+0
| | | | | | | | | This patch removes the ResolveExecutableLocation method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53834 llvm-svn: 345853
* [FileSystem] Remove GetPermissions() and Readable() from FileSpecJonas Devlieghere2018-11-011-13/+0
| | | | | | | | | This patch removes the GetPermissions and GetReadable methods from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53831 llvm-svn: 345843
* [FileSystem] Remove GetByteSize() from FileSpecJonas Devlieghere2018-11-011-7/+0
| | | | | | | | | This patch removes the GetByteSize method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53788 llvm-svn: 345812
* [FileSystem] Move EnumerateDirectory from FileSpec to FileSystem.Jonas Devlieghere2018-11-011-33/+0
| | | | | | | | | | | | | | This patch moves the EnumerateDirectory functionality and related enum and typedef from FileSpec to FileSystem. This is part of a set of patches that extracts file system related convenience methods from FileSpec. The long term goal is to remove this method altogether and use the iterators directly, but for introducing the VFS into LLDB this change is sufficient. Differential revision: https://reviews.llvm.org/D53785 llvm-svn: 345800
* Utility: fix cross-compilation from Linux to WindowsSaleem Abdulrasool2018-10-301-1/+3
| | | | | | | | Only attempt to link against Backtrace if it is found. Without this, trying to cross-compile to Windows would try to link against "Backtrace_LIBRARY-NOTFOUND.lib". llvm-svn: 345569
* Remove accidentally committed duplicate codeAdrian Prantl2018-10-251-5/+0
| | | | llvm-svn: 345287
* Fix a bug PlatformDarwin::SDKSupportsModule.Adrian Prantl2018-10-251-0/+5
| | | | | | | | | | | | | | | This fixes a bug PlatformDarwin::SDKSupportsModule introduced by https://reviews.llvm.org/D47889. VersionTuple::tryParse() can deal with an optional third (micro) component, but the parse will fail when there are extra characters after the version number (e.g.: trying to parse the substring "12.0.sdk" out of "iPhoneSimulator12.0.sdk" fails after that patch). Fixed here by stripping the ".sdk" suffix first. (Part of) rdar://problem/45041492 Differential Revision https://reviews.llvm.org/D53677 llvm-svn: 345274
* [lldb] Add support in Status::AsCString to retrieve win32 system error stringsAaron Smith2018-10-191-1/+28
| | | | | | | | | | Reviewers: rnk, zturner, aleksandr.urakov Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D53092 llvm-svn: 344798
* Upstreaming the BridgeOS device support and the Jason Molenda2018-10-111-7/+7
| | | | | | | | | | | | | | | LC_BUILD_VERSION load command handling - this commit is a combination of patches by Adrian Prantl and myself. llvm::Triple::BridgeOS isn't defined yet, so all references to that are currently commented out. Also update Xcode project file to build the NativePDB etc plugins. <rdar://problem/43353615> llvm-svn: 344209
* Add support for descriptions with command completions.Raphael Isemann2018-09-131-5/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a framework for adding descriptions to the command completions we provide. It also adds descriptions for completed top-level commands so that we can test this code. Completions are in general supposed to be displayed alongside the completion itself. The descriptions can be used to provide additional information about the completion to the user. Examples for descriptions are function signatures when completing function calls in the expression command or the binary name when providing completion for a symbol. There is still some boilerplate code from the old completion API left in LLDB (mostly because the respective APIs are reused for non-completion related purposes, so the CompletionRequest doesn't make sense to be used), so that's why I still had to change some function signatures. Also, as the old API only passes around a list of matches, and the descriptions are for these functions just another list, I had to add some code that essentially just ensures that both lists are always the same side (e.g. all the manual calls to `descriptions->AddString(X)` below a `matches->AddString(Y)` call). The initial command descriptions that come with this patch are just reusing the existing short help that is already added in LLDB. An example completion with descriptions looks like this: ``` (lldb) pl Available completions: platform -- Commands to manage and create platforms. plugin -- Commands for managing LLDB plugins. ``` Reviewers: #lldb, jingham Reviewed By: #lldb, jingham Subscribers: jingham, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D51175 llvm-svn: 342181
* Remove manual byte counting from internal Stream methods.Raphael Isemann2018-09-121-35/+41
| | | | | | | | | | | | | | | | | | Summary: This patch removes the manual byte counting in all internal Stream methods. This is now done by the automatic byte counting provided by calling `GetWrittenBytes()` before and after writing the data (which is automatically done for us by the `ByteDelta` utility class). Reviewers: #lldb, JDevlieghere Reviewed By: JDevlieghere Subscribers: JDevlieghere, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D50681 llvm-svn: 342044
* [Scalar] Commit the correct patch, forgot `git add`.Davide Italiano2018-09-071-8/+8
| | | | | | <rdar://problem/44229924> llvm-svn: 341685
* [Scalar] Fix undefined behaviour when converting double to long.Davide Italiano2018-09-071-2/+7
| | | | | | | | | | | This showed up in an Ubsan build of lldb (inside the CFAbsoluteTime data formatter). As we only care about the bit pattern, we just round to the nearest double, and truncate to a size that fits in ulonglong_t. <rdar://problem/44229924> llvm-svn: 341682
* [ARC] Make char unsigned by defaultAlexander Polyakov2018-09-071-0/+1
| | | | | | | | | | | | | | Summary: This patch specifies 'char' default sign on ARC. Reviewers: tatyana-krasnukha, clayborg Reviewed By: tatyana-krasnukha, clayborg Subscribers: clayborg, lldb-commits Differential Revision: https://reviews.llvm.org/D51594 llvm-svn: 341667
* Enable the fp-armv8 disassembler feature when disassembling Cortex-MJason Molenda2018-09-071-1/+4
| | | | | | | | | | code. This will enable disassembly of the optional subset of neon that some Cortex cores support. Add a unit test to check that a few of these instructions disassemble as expected. <rdar://problem/26674303> llvm-svn: 341623
* Terminate debugger if an assert was hitDavid Bolvansky2018-09-041-10/+10
| | | | | | | | | | | | Reviewers: JDevlieghere, teemperor, #lldb Reviewed By: JDevlieghere Subscribers: clayborg, lemo, lldb-commits Differential Revision: https://reviews.llvm.org/D51604 llvm-svn: 341387
* [lldb] Fix lldb build on muslRaphael Isemann2018-08-281-0/+1
| | | | | | | | | | | | | | | | | | | Summary: limits.h is needed for getting PATH_MAX definition, this comes to fore with musl libc where limits.h is not included indirectly via other system headers. Patch by Khem Raj, thanks! Reviewers: compnerd Reviewed By: compnerd Subscribers: llvm-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D31275 llvm-svn: 340876
* Remove commented out constructor from ScalarAlex Langford2018-08-161-43/+0
| | | | | | | This appears to have been commented out since the initial checkin of lldb. llvm-svn: 339965
* Remove outdated TODOs in RegisterValueAlex Langford2018-08-161-3/+0
| | | | | | | | | These TODOs were for setting m_type in RegisterValue::SetValueFromString in the case where reg_info's encoding was eEncodingUint or eEncodingSint. m_type is set by SetUInt{8,16,32,64.128} during the SetUInt call. llvm-svn: 339959
* Remove asseration from ↵Stefan Granitz2018-08-141-5/+0
| | | | | | ConstString::GetConstCStringAndSetMangledCounterPart() to fix more tests first llvm-svn: 339716
* Remove unused FastDemangle sourcesStefan Granitz2018-08-142-2394/+0
| | | | llvm-svn: 339671
* Fix: ConstString::GetConstCStringAndSetMangledCounterPart() should update ↵Stefan Granitz2018-08-141-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | the value if the key exists already Summary: This issue came up because it caused problems in our unit tests. The StringPool did connect counterparts only once and silently ignored the values passed in subsequent calls. The simplest solution for the unit tests would be silent overwrite. In practice, however, it seems useful to assert that we never overwrite a different mangled counterpart. If we ever have mangled counterparts for other languages than C++, this makes it more likely to notice collisions. I added an assertion that allows the following cases: * inserting a new value * overwriting the empty string * overwriting with an identical value I fixed the unit tests, which used "random" strings and thus produced collisions. It would be even better if there was a way to reset or isolate the StringPool, but that's a different story. Reviewers: jingham, friss, labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D50536 llvm-svn: 339669
* Move RegisterValue,Scalar,State from Core to UtilityPavel Labath2018-08-074-0/+3875
| | | | | | | | | | | | | These three classes have no external dependencies, but they are used from various low-level APIs. Moving them down to Utility improves overall code layering (although it still does not break any particular dependency completely). The XCode project will need to be updated after this change. Differential Revision: https://reviews.llvm.org/D49740 llvm-svn: 339127
* Change ConstString::SetCStringWithMangledCounterpart to use StringRefPavel Labath2018-08-061-27/+23
| | | | | | | This should simplify the upcoming demangling patch (D50071). While I was in there, I also added a quick test for the function. llvm-svn: 338995
* Fix a bug in VMRangeLeonard Mosescu2018-08-041-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed a suspicious failure: [ RUN ] VMRange.CollectionContains llvm/src/tools/lldb/unittests/Utility/VMRangeTest.cpp:146: Failure Value of: VMRange::ContainsRange(collection, VMRange(0x100, 0x104)) Actual: false Expected: true Looking at the code, it is a very real bug: class RangeInRangeUnaryPredicate { public: RangeInRangeUnaryPredicate(VMRange range) : _range(range) {} // note that _range binds to a temporary! bool operator()(const VMRange &range) const { return range.Contains(_range); } const VMRange &_range; }; This change fixes the bug. Differential Revision: https://reviews.llvm.org/D50290 llvm-svn: 338949
OpenPOWER on IntegriCloud