summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility
Commit message (Collapse)AuthorAgeFilesLines
* [lldb/Utility] Use assert instead of llvm_unreachable for LLDBAssertJonas Devlieghere2020-01-141-3/+3
| | | | | | llvm_unreachable is marked noreturn so the compiler can assume the code for printing the error message in release builds isn't hit which defeats the purpose.
* [lldb/Utility] Add std::move to make placate clang 3.8Jonas Devlieghere2020-01-131-2/+2
| | | | | This fixes an error thrown by clang 3.8 that no viable conversion from returned value to the function return type.
* [lldb][NFC] Use static_cast instead of reinterpret_cast where possibleRaphael Isemann2020-01-074-14/+13
| | | | | | | | | | | | | | Summary: There are a few places in LLDB where we do a `reinterpret_cast` for conversions that we could also do with `static_cast`. This patch moves all this code to `static_cast`. Reviewers: shafik, JDevlieghere, labath Reviewed By: labath Subscribers: arphaman, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D72161
* [lldb/Utility] YAML validation should be orthogonal to packet semantics.Jonas Devlieghere2020-01-031-3/+0
| | | | | | It's not up to YAML to validate the semantics of the GDB remote packet struct. This is especially wrong here as there's nothing that says that the amount of bytes transmitted matches the packet payload size.
* [lldb][NFC] Make clang-format happy by removing trailing space in ArchSpec.cppRaphael Isemann2019-12-171-1/+1
|
* [lldb][NFC] Remove unused includes in Utility's source filesRaphael Isemann2019-12-136-15/+0
|
* Revert "Temporarily revert [lldb] e81268d - [lldb/Reproducers] Support ↵Eric Christopher2019-12-102-53/+65
| | | | | | | | | multiple GDB remotes" On multiple retry this issue won't duplicate - will revisit with author if duplication works again. This reverts commit c9e0b354e2749ce7ab553974692cb35c8651a869.
* Temporarily revert [lldb] e81268d - [lldb/Reproducers] Support multiple GDB ↵Eric Christopher2019-12-102-65/+53
| | | | | | | | | remotes This was causing a crash in opt+assert builds on linux and a follow-up message was posted. This reverts commit e81268d03e73aef4f9c7bd8ece8ad02f5b017dcf
* [lldb/Reproducers] Support multiple GDB remotesJonas Devlieghere2019-12-102-53/+65
| | | | | | | | | | | | | | | | When running the test suite with always capture on, a handful of tests are failing because they have multiple targets and therefore multiple GDB remote connections. The current reproducer infrastructure is capable of dealing with that. This patch reworks the GDB remote provider to support multiple GDB remote connections, similar to how the reproducers support shadowing multiple command interpreter inputs. The provider now keeps a list of packet recorders which deal with a single GDB remote connection. During replay we rely on the order of creation to match the number of packets to the GDB remote connection. Differential revision: https://reviews.llvm.org/D71105
* [lldb][NFC] Move [SU]Int64ValueIsValidForByteSize to RegisterValueRaphael Isemann2019-12-061-3/+31
| | | | | | These functions are an implementation detail of RegisterValue, so it doesn't make a lot of sense to implement them in a totally unrelated class.
* [lldb][NFC] Remove ability to pass a custom printf format to ↵Raphael Isemann2019-12-061-10/+9
| | | | | | DataExtractor::PutToLog This is luckily not used anywhere.
* [lldb] Migrate VMRange::Dump to raw_ostreamRaphael Isemann2019-12-061-3/+4
|
* [lldb][NFC] Migrate FileSpec::Dump to raw_ostreamRaphael Isemann2019-12-062-10/+8
|
* [LLDB] Replacing use of ul suffix in GetMaxU64Bitfield since it not ↵shafik2019-12-051-11/+21
| | | | | | | | guarenteed to be 64 bit GetMaxU64Bitfield(...) uses the ul suffix but we require a 64 bit unsigned integer and ul could be 32 bit. So this replacing it with a explicit cast and refactors the code around it to use an early exit. Differential Revision: https://reviews.llvm.org/D70992
* [lldb][NFC] Move Address and AddressRange functions out of Stream and let ↵Raphael Isemann2019-12-052-14/+14
| | | | | | | | | | | | | | | | | | | | | | them take raw_ostream Summary: Yet another step on the long road towards getting rid of lldb's Stream class. We probably should just make this some kind of member of Address/AddressRange, but it seems quite often we just push in random integers in there and this is just about getting rid of Stream and not improving arbitrary APIs. I had to rename another `DumpAddress` function in FormatEntity that is dumping the content of an address to make Clang happy. Reviewers: labath Reviewed By: labath Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71052
* Avoid triple corruption while merging core infoMuhammad Omair Javaid2019-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes a bug where when target triple created from elf information is arm-*-linux-eabihf and platform triple is armv8l-*-linux-gnueabihf. Merging both triple results in armv8l--unknown-unknown. This happens because we order a triple update while calling CoreUpdated and CoreUpdated creates a new triple with no vendor or environment information. Making sure we do not update triple and just update to more specific core fixes the issue. Reviewers: labath, jasonmolenda, clayborg Reviewed By: jasonmolenda Subscribers: jankratochvil, kristof.beyls, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70155
* [lldb/Reproducers] Override capture with LLDB_CAPTURE_REPRODUCER env varJonas Devlieghere2019-12-041-0/+10
| | | | | | | | | | | | | | | | | | | | Make it possible to override reproducer capture with the LLDB_CAPTURE_REPRODUCER environment variable. The goal of this change is twofold. (1) I want to be able to enable capturing reproducers during regular test runs, both locally and on the bots. To do so I need a way to force capture. I cannot do this through the Python API, because reproducer capture must be enabled *before* the debugger initialized, which happens automatically when doing `import lldb`. (2) I want to provide an escape hatch for when reproducers are enabled by default. Downstream we have reproducer capture enabled by default in the driver. This patch solves both problems by overriding the reproducer mode based on the environment variable. Acceptable values are 0/1 and ON/OFF.
* [lldb] Remove some (almost) unused Stream::operator<<'sPavel Labath2019-12-041-24/+0
| | | | llvm::raw_ostream provides equivalent functionality.
* [lldb] Remove FileSpec(FileSpec*) constructorPavel Labath2019-12-041-9/+0
| | | | | This constructor was the cause of some pretty weird behavior. Remove it, and update all code to properly dereference the argument instead.
* [lldb] s/FileSpec::Equal/FileSpec::MatchPavel Labath2019-12-041-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The FileSpec class is often used as a sort of a pattern -- one specifies a bare file name to search, and we check if in matches the full file name of an existing module (for example). These comparisons used FileSpec::Equal, which had some support for it (via the full=false argument), but it was not a good fit for this job. For one, it did a symmetric comparison, which makes sense for a function called "equal", but not for typical searches (when searching for "/foo/bar.so", we don't want to find a module whose name is just "bar.so"). This resulted in patterns like: if (FileSpec::Equal(pattern, file, pattern.GetDirectory())) which would request a "full" match only if the pattern really contained a directory. This worked, but the intended behavior was very unobvious. On top of that, a lot of the code wanted to handle the case of an "empty" pattern, and treat it as matching everything. This resulted in conditions like: if (pattern && !FileSpec::Equal(pattern, file, pattern.GetDirectory()) which are nearly impossible to decipher. This patch introduces a FileSpec::Match function, which does exactly what most of FileSpec::Equal callers want, an asymmetric match between a "pattern" FileSpec and a an actual FileSpec. Empty paterns match everything, filename-only patterns match only the filename component. I've tried to update all callers of FileSpec::Equal to use a simpler interface. Those that hardcoded full=true have been changed to use operator==. Those passing full=pattern.GetDirectory() have been changed to use FileSpec::Match. There was also a handful of places which hardcoded full=false. I've changed these to use FileSpec::Match too. This is a slight change in semantics, but it does not look like that was ever intended, and it was more likely a result of a misunderstanding of the "proper" way to use FileSpec::Equal. [In an ideal world a "FileSpec" and a "FileSpec pattern" would be two different types, but given how widespread FileSpec is, it is unlikely we'll get there in one go. This at least provides a good starting point by centralizing all matching behavior.] Reviewers: teemperor, JDevlieghere, jdoerfert Subscribers: emaste, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70851
* [lldb][NFC] Migrate to raw_ostream in ArchSpec::DumpTripleRaphael Isemann2019-12-042-8/+8
| | | | | | | | | | | | Reviewers: labath, davide Reviewed By: davide Subscribers: clayborg, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70979
* [lldb][NFC] Use raw_ostream instead of Stream in Baton::GetDescriptionRaphael Isemann2019-12-021-2/+3
| | | | | Removing raw_ostream here is getting us closer to removing LLDB's Stream class.
* [lldb][NFC] Make Stream's IndentLevel an unsigned integers.Raphael Isemann2019-12-021-4/+6
| | | | | We expect it to be always positive values and LLVM/Clang's IndentLevel values are already unsigned integers, so we should do the same.
* [LLDB] On Windows, force error message formatting to EnglishAlexandre Ganea2019-11-281-1/+10
| | | | | | This fixes the Utility/StatusTest.ErrorWin32 unit test on non-English locales. Differential Revision: https://reviews.llvm.org/D70442
* [lldb] refactor FileSpec::EqualPavel Labath2019-11-281-13/+3
| | | | | The logic of this function was quite hard to follow. Replace it with a much simpler, equivalent, implementation.
* [LLDB] Always interpret arm instructions as thumb on windowsMartin Storsjö2019-11-281-0/+3
| | | | | | | | Windows on ARM always uses thumb mode, and doesn't have most of the mechanisms that are used in e.g. ELF for distinguishing between arm and thumb. Differential Revision: https://reviews.llvm.org/D70796
* [lldb] remove unsigned Stream::operator<< overloadsPavel Labath2019-11-261-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I recently re-discovered that the unsinged stream operators of the lldb_private::Stream class have a surprising behavior in that they print the number in hex. This is all the more confusing because the "signed" versions of those operators behave normally. Now that, thanks to Raphael, each Stream class has a llvm::raw_ostream wrapper, I think we should delete most of our formatting capabilities and just delegate to that. This patch tests the water by just deleting the operators with the most surprising behavior. Most of the code using these operators was printing user_id_t values. It wasn't fully consistent about prefixing them with "0x", but I've tried to consistenly print it without that prefix, to make it more obviously different from pointer values. Reviewers: teemperor, JDevlieghere, jdoerfert Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70241
* [Utility] Remove a dead header [PPC64LE_ehframe_Registers.h]Davide Italiano2019-11-141-193/+0
|
* [LLDB] Cleanup the DataEncoder utility. (NFC)Jonas Devlieghere2019-11-131-47/+3
| | | | | This commit removes unused methods from the DataEncoder class and cleans up the API by making all the internal methods private.
* [Reproducer] Discard reproducer directory if not generated.Jonas Devlieghere2019-11-121-3/+5
| | | | | If lldb was run in capture mode, but no reproducer was generated, make sure we clean up the reproducer directory.
* [LLDB] Add core definition for armv8l and armv7lMuhammad Omair Javaid2019-11-131-0/+6
| | | | | | | | | | | | | This patch adds core definitions in lldb ArchSpecs for armv8l and armv7l cores. This was needed because on Linux running on 32-bit Arm v8 we are returned armv8l in case we are running 32-bit sysroot on 64bit kernel. In case of 32-bit kernel and 32-bit sysroot running on arm v8 hardware we are returned armv7l. This is quite common when we run 32 bit arm using docker container. Signed-off-by: Muhammad Omair Javaid <omair.javaid@linaro.org> Differential Revision: https://reviews.llvm.org/D69904
* lldb: Fix some -Wdeprecated-copy warningsPavel Labath2019-11-115-46/+0
| | | | | | | | gcc-9 started warning when a class defined a copy constructor without a copy assignment operator (or vice-versa). This fixes those warnings by deleting the other special member too (after verifying it doesn't do anything non-trivial).
* [ARC] Basic support in gdb-remote process pluginTatyana Krasnukha2019-10-171-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D55718 llvm-svn: 375122
* Revert "make ConstString allocate memory in non-tiny chunks"Raphael Isemann2019-10-171-7/+2
| | | | | | | | | | | | As discussed in https://reviews.llvm.org/D68549, the actual issue here seems to be that the BumpPtrAllocator is growing far too slow because of the 256 different StringPools used as the backend for ConstString. At the same time the original patch made ConstString allocate memory in 256MiB slabs for the same reason, meaning that the RSS usage of LLDB increased by a few hundred MiB for all users without bringing any noticeable speedup for most of them. llvm-svn: 375062
* [Reproducer] Capture the debugger's working directoryJonas Devlieghere2019-10-171-1/+15
| | | | | | | | This patch extends the reproducer to capture the debugger's current working directory. This information will be used later to set the current working directory of the VFS. llvm-svn: 375059
* Add arm64_32 support to lldb, an ILP32 codegen Jason Molenda2019-10-161-0/+15
| | | | | | | | | | that runs on arm64 ISA targets, specifically Apple watches. Differential Revision: https://reviews.llvm.org/D68858 llvm-svn: 375032
* [android/process list] support showing process argumentsWalter Erquinigo2019-10-161-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The qfProcessInfo and qsProcessInfo packets currently don't set the processes' arguments, however the platform process list -v command tries to print it. In this diff I'm adding the arguments as part of the packet, and now the command shows the arguments just like on mac. On Mac: 507 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx /usr/libexec/secd 503 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx /usr/libexec/secinitd 501 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx /usr/libexec/languageassetd --firstLogin 497 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx /usr/libexec/trustd --agent 496 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx /usr/libexec/lsd 494 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx /System/Library/Frameworks/CoreTelephony.framework/Support/CommCenter -L 491 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx /usr/sbin/distnoted agent 489 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx /usr/libexec/UserEventAgent (Aqua) 484 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx /usr/sbin/cfprefsd agent 483 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx /System/Library/Frameworks/LocalAuthentication.framework/Support/coreauthd On android: 1561 1016 root 0 0 aarch64-unknown-linux-android /system/bin/ip6tables-restore--noflush -w -v 1805 982 1000 1000 1000 android:drmService 1811 982 10189 10189 10189 com.qualcomm.embms:remote 1999 1 1000 1000 1000 aarch64-unknown-linux-android /system/bin/tlc_serverCCM 2332 982 10038 10038 10038 com.android.systemui 2378 983 1053 1053 1053 webview_zygote 2448 982 5013 5013 5013 com.sec.location.nsflp2 2465 982 10027 10027 10027 com.google.android.gms.persistent Differential Revision: https://reviews.llvm.org/D68293 llvm-svn: 375029
* make ConstString allocate memory in non-tiny chunksLubos Lunak2019-10-111-2/+7
| | | | | | | | | | | BumpPtrAllocator allocates in 4KiB chunks, which with any larger project is going to result in a large number of allocations. Increasing allocation size this way can save 10%-20% of symbol load time for a huge C++ project with correctly built debuginfo. Differential Revision: https://reviews.llvm.org/D68549 llvm-svn: 374583
* ProcessInstanceInfoMatch: Don't match processes with no name if a name match ↵Pavel Labath2019-10-111-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | was requested, take 2 Summary: The previous attempt at making nameless process not match when searching for a given name failed because the macos implementation was depending on this detail in its partial matching strategy. Doing partial matching to avoid expensive lookups is a perfectly valid thing to do, the way it was implemented seems somewhat unexpected. This patch implements it differently by providing special methods in the ProcessInstanceInfoMatch which match only a subset of fields, and changes mac host code to use those instead. Then, it re-applies r373925 to get make the ProcessInstanceInfoMatch with a name *not* match a nameless process. Reviewers: JDevlieghere, teemperor, jingham Subscribers: wallace, lldb-commits Differential Revision: https://reviews.llvm.org/D68631 llvm-svn: 374529
* [lldb] Fix out of bounds read in DataExtractor::GetCStr and add unit test ↵Raphael Isemann2019-10-101-19/+18
| | | | | | | | | | | | | | | | | | | | | | | | that function. Summary: The `if (*cstr_end == '\0')` in the previous code checked if the previous loop terminated because it found a null terminator or because it reached the end of the data. However, in the case that we hit the end of the data before finding a null terminator, `cstr_end` points behind the last byte in our data and `*cstr_end` reads the memory behind the array (which may be uninitialised) This patch just rewrites that function use `std::find` and adds the relevant unit tests. Reviewers: labath Reviewed By: labath Subscribers: abidh, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68773 llvm-svn: 374311
* Revert "ProcessInstanceInfoMatch: Don't match processes with no name if a ↵Jonas Devlieghere2019-10-081-1/+1
| | | | | | | | name match was requested" This breaks TestProcessAttach and TestHelloWorld on Darwin. llvm-svn: 374008
* ProcessInstanceInfoMatch: Don't match processes with no name if a name match ↵Pavel Labath2019-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | was requested Since D68289, a couple of tests on linux started being extremely flaky. All of them were doing name-based attaching and were failing because they couldn't find an unambiguous process to attach to. The patch above changed the process finding logic, so that failure to find a process name does not constitute an error. This meant that a lot more transient processes showed up in the process list during the test suite run. Previously, these processes would not appear as they would be gone by the time we went to read their executable name, arguments, etc. Now, this alone should not cause an issue were it not for the fact that we were considering a process with no name as if it matched by default (even if we were explicitly searching for a process with a specified name). This meant that any of the "transient" processes with no name would make the name match ambiguous. That clearly seems like a bug to me so I fix that. llvm-svn: 373925
* [process list] make the TRIPLE column widerWalter Erquinigo2019-10-031-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Now that `process list` works better on the android platform, the arch aarch64-unknown-linux-android appears quite often. The existing printed width of the TRIPLE column is not long enough, which doesn't look okay. E.g. ``` 1561 1016 aarch64-unknown-linux-android ip6tables-restore 1999 1 aarch64-unknown-linux-android tlc_server 2332 982 com.android.systemui 2378 983 webview_zygote ``` Now, after adding 6 spaces, it looks better ``` PID PARENT USER TRIPLE NAME ====== ====== ========== ============================== ============================ ... 1561 1016 aarch64-unknown-linux-android ip6tables-restore 1999 1 aarch64-unknown-linux-android tlc_server 2332 982 com.android.systemui 2378 983 webview_zygote 2448 982 com.sec.location.nsflp2 ``` Reviewers: clayborg, labath, xiaobai, aadsm Reviewed By: labath Subscribers: srhines, kristof.beyls, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68291 llvm-svn: 373670
* [JSON] Remove Utility/JSON.{h|cpp}Jonas Devlieghere2019-10-022-551/+0
| | | | | | | | | | | | | This patch is the final step in my quest to get rid of the JSON parser in LLDB. Vedant's coverage report [1] shows that it was mostly untested. Furthermore, the LLVM implementation has a much nicer API and using it means one less thing to maintain for LLDB. [1] http://lab.llvm.org:8080/coverage/coverage-reports/index.html Differential revision: https://reviews.llvm.org/D68305 llvm-svn: 373501
* [JSON] Use LLVM's library for decoding JSON in StructuredDataJonas Devlieghere2019-10-011-100/+48
| | | | | | | | | This patch replaces the hand-rolled JSON decoding in StructuredData with LLVM's JSON library. Differential revision: https://reviews.llvm.org/D68282 llvm-svn: 373360
* [JSON] Use LLVM's library for encoding JSON in StructuredDataJonas Devlieghere2019-10-011-75/+25
| | | | | | | | | This patch replaces the hand-rolled JSON emission in StructuredData with LLVM's JSON library. Differential revision: https://reviews.llvm.org/D68248 llvm-svn: 373359
* [Reproducer] Always use absolute paths for capture & replay.Jonas Devlieghere2019-09-271-2/+11
| | | | | | | | | | | The VFS requires files to be have absolute paths. The file collector makes paths relative to the reproducer root. If the root is a relative path, this would trigger an assert in the VFS. This patch ensures that we always make the given path absolute. Thank you Ted Woodward for pointing this out! llvm-svn: 373102
* [lldb][NFC] Use AppendEmptyArgument in CompletionRequest constructorRaphael Isemann2019-09-261-7/+3
| | | | | | | | We now have a utility function for this purpose. (Also fixing the typo in the related comment while I'm at it.) llvm-svn: 372946
* [LLDB] Add tests for PECOFF arm architecture identificationMartin Storsjo2019-09-241-1/+3
| | | | | | | | | | | | | | | Add a test case for the change from SVN r372657, and for the preexisting ARM identification. Add a missing ArchDefinitionEntry for PECOFF/arm64, and tweak the ArmNt case to set the architecture to armv7 (ArmNt never ran on anything lower than that). (This avoids a case where ArchSpec::MergeFrom would override the arch from arm to armv7 and ArchSpec::CoreUpdated would reset the OS to unknown at the same time.) Differential Revision: https://reviews.llvm.org/D67951 llvm-svn: 372741
* [lldb] Fix log output and UtilityTests/LogChannelTest.ListRaphael Isemann2019-09-241-0/+1
| | | | | | | I refactored this code in 372691 and it seems I didn't fully replicate the original log output, so that test was failing. llvm-svn: 372696
OpenPOWER on IntegriCloud