summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[DataEncoder] Replace buggy versions of write functions."Davide Italiano2017-12-111-8/+36
| | | | | | | The commit exposes a bunch of failures in the LLDB testsuite that I need to analyze more carefully. Reverting for now. llvm-svn: 320341
* [DataEncoder] Replace buggy versions of write functions.Davide Italiano2017-12-101-36/+8
| | | | | | | | | | They cause an ubsan error when ran through the testsuite (store to misaligned address is UB). This commit kills two birds with one stone, as we also remove some code while fixing it. <rdar://problem/35941757> llvm-svn: 320335
* Simplify UUID constructorsStephane Sezer2017-11-281-3/+2
| | | | | | | | | | | | Summary: This remove a small amount of duplicated code. Reviewers: clayborg, zturner, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D40536 llvm-svn: 319191
* Remove some duplicated code in UUID.cppStephane Sezer2017-11-281-8/+1
| | | | | | | | | | | | | | Summary: Formatting needs to be done only once. Ran check-lldb and nothing changes. Reviewers: clayborg, davide Reviewed By: clayborg, davide Subscribers: zturner, davide, lldb-commits Differential Revision: https://reviews.llvm.org/D40519 llvm-svn: 319132
* Mark UUID::GetByteSize() constStephane Sezer2017-11-271-1/+1
| | | | | | | | | | | | | | | | Summary: This method doesn't modify anything in the object it's called on so we can mark it const to make it usable in a const context. Reviewers: clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D40517 llvm-svn: 319095
* Fix LLDB build.Eugene Zemtsov2017-11-171-0/+1
| | | | | | It was broken by r318489. llvm-svn: 318504
* Move ArchSpec to the Utility modulePavel Labath2017-11-132-0/+1486
| | | | | | | | | | | | | The rationale here is that ArchSpec is used throughout the codebase, including in places which should not depend on the rest of the code in the Core module. This commit touches many files, but most of it is just renaming of #include lines. In a couple of cases, I removed the #include ArchSpec line altogether, as the file was not using it. In one or two places, this necessitated adding other #includes like lldb-private-defines.h. llvm-svn: 318048
* Log: delimit thread name in log messagePavel Labath2017-11-081-2/+1
| | | | | | | | | | The thread name was not followed by a space, which meant it was glued to the log message. I also align the name as we do that with other log fields. I align it to 16 chars instead of llvm::max_thread_name(), as that can be 64 on darwin, which is rather long. If anybody feels differently about that, we can change it. llvm-svn: 317679
* Add float/vector registers for ppc64lePavel Labath2017-11-032-0/+262
| | | | | | | | | | | | | | | Summary: Add read and write functions for VSX, VMX and float registers and fix watchpoint size Reviewers: clayborg Reviewed By: clayborg Subscribers: eugene, labath, clayborg, nemanjai, kbarton, JDevlieghere, anajuliapc, gut, lbianc, lldb-commits Differential Revision: https://reviews.llvm.org/D39487 Patch by: Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br> llvm-svn: 317329
* Fix some warnings found by ToT clangPavel Labath2017-11-021-1/+1
| | | | | | | | These fall into two categories: - unused variables - (uint8_t *)NULL + X -- changed to reinterpret_cast(X) llvm-svn: 317270
* Remove uint32_t assignment operator from StatusPavel Labath2017-11-011-10/+0
| | | | | | | | | | | | | | | | Summary: It is not presently used, and it's quite dangerous to use -- it assumes the integer is an osx kern_return_t, but very few of the integers we have lying around are mach kernel error codes. The error can still be used to a mach error using a slightly longer (but more explicit) syntax. Reviewers: jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D35305 llvm-svn: 317093
* Fix LLVM_LINK_LLVM_DYLIB build (pr35053)Pavel Labath2017-10-311-1/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: r316368 broke this build when it introduced a reference to a pthread function to the Utility module. This caused cmake to generate an incorrect link line (wrong order of libs) because it did not see the dependency from Utility to the system libraries. Instead these libraries were being manually added to each final target. This changes moves the dependency management from the individual targets to the lldbUtility module, which is consistent with how llvm does it. The final targets will pick up these libraries as they will be a part of the link interface of the module. Technically, some of these dependencies could go into the host module, as that's where most of the os-specific code is, but I did not try to investigate which ones. Reviewers: zturner, sylvestre.ledru Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D39246 llvm-svn: 316997
* Logging: Disable logging after fork()Pavel Labath2017-10-232-1/+17
| | | | | | | | | | | | | | | | | | | | | | | Summary: We had a bug where if we had forked (in the ProcessLauncherPosixFork) while another thread was writing a log message, we would deadlock. This happened because the fork child inherited the locked log rwmutex, which would never get unlocked. This meant the child got stuck trying to disable all log channels. The bug existed for a while but only started being apparent after D37930, which started using ThreadLauncher (which uses logging) instead of std::thread (which does not) for launching TaskPool threads. The fix is to use pthread_atfork to disable logging in the forked child. Reviewers: zturner, eugene, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D38938 llvm-svn: 316368
* Revert "Logging: Make sure logging machinery is in a consistent state after ↵Pavel Labath2017-10-202-19/+1
| | | | | | | | | | | | | | forking" The pthread_atfork trick breaks on android, because pthread_rwlock_unlock detects that it is not the same thread which locked the lock. This means that the subsequent lock attempt will still deadlock (only this time it happens deterministically instead of at random). Reverting to find a better solution. This reverts commit r316173. llvm-svn: 316231
* Logging: Make sure logging machinery is in a consistent state after forkingPavel Labath2017-10-192-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | Summary: We had a bug where if we had forked (in the ProcessLauncherPosixFork) while another thread was writing a log message, we would deadlock. This happened because the fork child inherited the locked log rwmutex, which would never get unlocked. This meant the child got stuck trying to disable all log channels. The bug existed for a while but only started being apparent after D37930, which started using ThreadLauncher (which uses logging) instead of std::thread (which does not) for launching TaskPool threads. The fix is to use pthread_atfork to make sure noone is writing a log message while we are forking. Reviewers: zturner, eugene, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D38938 llvm-svn: 316173
* Fix dumping of characters with non-standard sizesPetr Pavlu2017-10-111-72/+39
| | | | | | | | | | | | | | | | * Prevent dumping of characters in DumpDataExtractor() with item_byte_size bigger than 8 bytes. This case is not supported by the code and results in a crash because the code calls DataExtractor::GetMaxU64Bitfield() -> GetMaxU64() that asserts for byte size > 8 bytes. * Teach DataExtractor::GetMaxU64(), GetMaxU32(), GetMaxS64() and GetMaxU64_unchecked() how to handle byte sizes that are not a multiple of 2. This allows DumpDataExtractor() to dump characters and booleans with item_byte_size in the interval of [1, 8] bytes. Values that are not a multiple of 2 would previously result in a crash because they were not handled by GetMaxU64(). llvm-svn: 315444
* Support: Have directory_iterator::status() return ↵Peter Collingbourne2017-10-101-6/+6
| | | | | | | | | | | | | | | | | | FindFirstFileEx/FindNextFile results on Windows. This allows clients to avoid an unnecessary fs::status() call on each directory entry. Because the information returned by FindFirstFileEx is a subset of the information returned by a regular status() call, I needed to extract a base class from file_status that contains only that information. On my machine, this reduces the time required to enumerate a ThinLTO cache directory containing 520k files from almost 4 minutes to less than 2 seconds. Differential Revision: https://reviews.llvm.org/D38716 llvm-svn: 315378
* Enable breakpoints and read/write GPRs for ppc64leEugene Zemtsov2017-10-052-0/+126
| | | | | | | | | | | | Add support for ppc64le to create breakpoints and read/write general purpose registers. Other features for ppc64le and functions to read/write other registers are being implemented. Patch by Alexandre Yukio Yamashita (alexandreyy) Differential Revision: https://reviews.llvm.org/D38323 llvm-svn: 315008
* Use ThreadLauncher to launch TaskPool threadsFrancis Ricci2017-09-192-99/+0
| | | | | | | | | | | | | | | | | | Summary: This allows for the stack size to be configured, which isn't possible with std::thread. Prevents overflowing the stack when performing complex operations in the task pool on darwin, where the default pthread stack size is only 512kb. This also moves TaskPool from Utility to Host. Reviewers: labath, tberghammer, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D37930 llvm-svn: 313637
* Revert "Use ThreadLauncher to launch TaskPool threads"Francis Ricci2017-09-181-12/+1
| | | | | | This reverts commit r313537 because it fails to link on linux buildbots llvm-svn: 313539
* Use ThreadLauncher to launch TaskPool threadsFrancis Ricci2017-09-181-1/+12
| | | | | | | | | | | | | | | | Summary: This allows for the stack size to be configured, which isn't possible with std::thread. Prevents overflowing the stack when performing complex operations in the task pool on darwin, where the default pthread stack size is only 512kb. Reviewers: labath, tberghammer, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D37930 llvm-svn: 313537
* [UUID] Reimplement comparison operators more canonically. NFCI.Davide Italiano2017-09-031-8/+4
| | | | llvm-svn: 312457
* [lldb] Correctly escape newlines and backslashes in the JSON serializerKuba Mracek2017-08-221-2/+3
| | | | | | | | JSON serializer fails to escape newlines and backslashes. Let's fix that. Differential Revision: https://reviews.llvm.org/D34322 llvm-svn: 311483
* Don't crash when hostname is empty. StringRef will assert and kill your program.Greg Clayton2017-07-241-1/+1
| | | | llvm-svn: 308896
* Added a missing "break;" after seeing a clang warning about potential fall ↵Greg Clayton2017-07-211-0/+1
| | | | | | through annotation. llvm-svn: 308776
* Fixing Android builderRavitheja Addepally2017-07-121-5/+5
| | | | llvm-svn: 307773
* Adding Support for Error Strings in Remote PacketsRavitheja Addepally2017-07-122-4/+37
| | | | | | | | | | | | | | | | | | Summary: This patch adds support for sending strings along with error codes in the reply packets. The implementation is based on the feedback recieved in the lldb-dev mailing list. The patch also adds an extra packet for the client to query if the server has the capability to provide strings along with error replys. Reviewers: labath, jingham, sas, lldb-commits, clayborg Reviewed By: labath, clayborg Differential Revision: https://reviews.llvm.org/D34945 llvm-svn: 307768
* Move Timer and TraceOptions from Core to UtilityPavel Labath2017-06-292-0/+133
| | | | | | | | | | | | | | Summary: The classes have no dependencies, and they are used both by lldb and lldb-server, so it makes sense for them to live in the lowest layers. Reviewers: zturner, jingham Subscribers: emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D34746 llvm-svn: 306682
* Move StructuredData from Core to UtilityPavel Labath2017-06-273-1/+288
| | | | | | | | | | | | | | | | Summary: It had a dependency on StringConvert and file reading code, which is not in Utility. I've replaced that code by equivalent llvm operations. I've added a unit test to demonstrate that parsing a file still works. Reviewers: zturner, jingham Subscribers: kubamracek, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D34625 llvm-svn: 306394
* Move Connection and IOObject interfaces to Utility modulePavel Labath2017-06-273-0/+31
| | | | | | | | | | | | | | | | | | | Summary: These interfaces have no dependencies, so it makes sense for them to be in the lowest level modules, to make sure that other parts of the codebase can use them without introducing loops. The only exception here is the Connection::CreateDefaultConnection method, which I've moved to Host, as it instantiates concrete implementations, and that's where the implementations live. Reviewers: jingham, zturner Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D34400 llvm-svn: 306391
* Add llvm::Error assignment operator to Status classPavel Labath2017-06-151-5/+10
| | | | | | This enables writing "status = std::move(some_llvm_error)". llvm-svn: 305462
* [VMRange] Remove unused FindRangeIndexThatContainsValue().Davide Italiano2017-06-091-11/+0
| | | | llvm-svn: 305111
* [VMRange] Implement comparison operators using `==` and `<`.Davide Italiano2017-06-091-17/+4
| | | | llvm-svn: 305109
* [VMRange] Use llvm::find_if. Thanks to Zachary for the suggestion.Davide Italiano2017-06-091-4/+2
| | | | llvm-svn: 305099
* [VMRange] Simplify a couple of member functions. NFCI.Davide Italiano2017-06-081-10/+2
| | | | llvm-svn: 305035
* Switch TaskMapOverInt to llvm::function_refPavel Labath2017-06-071-1/+1
| | | | | | | | | | The function does not persist the callback, so using a lighter-weight asbtraction seems appropriate. Also tweak the signatures of the lambdas to match what the TaskMap interface expects. llvm-svn: 304924
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-071-0/+1
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* replace uses of strerror with llvm::sys::StrErrorPavel Labath2017-06-061-10/+8
| | | | | | | | strerror is not thread-safe. llvm's StrError tries hard to retrieve the string in a thread-safe way and falls back to strerror only if it does not have another way. llvm-svn: 304795
* Implementation of remote packets for Trace data.Ravitheja Addepally2017-05-263-0/+25
| | | | | | | | | | | | | | | | | | Summary: The changes consist of new packets for trace manipulation and trace collection. The new packets are also documented. The packets are capable of providing custom trace specific parameters to start tracing and also retrieve such configuration from the server. Reviewers: clayborg, lldb-commits, tberghammer, labath, zturner Reviewed By: clayborg, labath Subscribers: krytarowski, lldb-commits Differential Revision: https://reviews.llvm.org/D32585 llvm-svn: 303972
* Add Status -- llvm::Error gluePavel Labath2017-05-181-0/+31
| | | | | | | | | | | | | | | | | | | Summary: This adds functions to convert between llvm::Error and Status classes. Posix errors in Status are represented as llvm::ECError, and the rest as llvm::StringError. For the conversion from Error to Status, ECError is again represented as a posix error in Status, while other errors are stored as generic errors and only the string value is preserved. Reviewers: zturner, jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D33241 llvm-svn: 303348
* Update StructuredData::String to return StringRefs.Zachary Turner2017-05-121-6/+10
| | | | | | | | It was returning const std::string& which was leading to unnecessary copies all over the place, and preventing people from doing things like Dict->GetValueForKeyAsString("foo", ref); llvm-svn: 302875
* Rename Error -> Status.Zachary Turner2017-05-124-46/+47
| | | | | | | | | | | | | | | 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
* Add TaskMap for iterating a function over a set of integersPavel Labath2017-05-051-0/+23
| | | | | | | | | | | | | | | | Summary: Many parallel tasks just want to iterate over all the possible numbers from 0 to N-1. Rather than enqueue N work items, instead just "map" the function across the requested integer space. Reviewers: clayborg, labath, tberghammer, zturner Reviewed By: clayborg, zturner Subscribers: zturner, lldb-commits Differential Revision: https://reviews.llvm.org/D32757 Patch by Scott Smith <scott.smith@purestorage.com>. llvm-svn: 302223
* Remove lock from ConstString::GetLengthPavel Labath2017-04-281-18/+11
| | | | | | | | | | | | | | | Summary: ConstStrings are immutable, so there is no need to grab even a reader lock in order to read the length field. Reviewers: #lldb, labath Reviewed By: labath Subscribers: zturner, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D32306 Patch by Scott Smith <scott.smith@purestorage.com> llvm-svn: 301642
* [Utility/StringLexer] Remove dead code.Davide Italiano2017-04-191-4/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D32148 llvm-svn: 300729
* iwyu fixes on lldbUtility.Zachary Turner2017-04-0630-118/+174
| | | | | | | | | | | | | This patch makes adjustments to header file includes in lldbUtility based on recommendations by the iwyu tool (include-what-you-use). The goal here is to make sure that all files include the exact set of headers which are needed for that file only, to eliminate cases of dead includes (e.g. someone deleted some code but forgot to delete the header includes that that code necessitated), and to eliminate the case where header includes are picked up transitively. llvm-svn: 299676
* The LIBLLDB_LOG_TEMPORARY channel got lost at some point whereJason Molenda2017-04-031-0/+1
| | | | | | Logging.cpp was being changed in the past. Re-add it. llvm-svn: 299394
* In FileSpec::Equal, short-cut GetNormalizedPath.Jim Ingham2017-03-271-1/+26
| | | | | | | | | | | | GetNormalizedPath seems to be slow, so it's worth shortcutting it if possible. This change does so when the filenames and not equal and we can tell GetNormalizedPath would not make them equal. Also added a test for "." final component since that was missing. llvm-svn: 298876
* Move FileSpec from Host -> Utility.Zachary Turner2017-03-222-0/+932
| | | | llvm-svn: 298536
* Resubmit "Delete the remainder of platform specific code in FileSpec."Zachary Turner2017-03-221-0/+19
| | | | | | | | | | | | | | This was causing a test failure in one of LLDB's tests which specifically dealt with a limitation in LLVM's implementation of home_directory() that LLDB's own implementation had worked around. This limitation has been addressed in r298513 on the LLVM side, so the failing test (which is now unnecessary as the limitation no longer exists) was removed in r298519, allowing this patch to be re-submitted without modification. llvm-svn: 298526
OpenPOWER on IntegriCloud