aboutsummaryrefslogtreecommitdiff
path: root/lldb
Commit message (Collapse)AuthorAgeFilesLines
* [lldb] Fix one leak in reproducerFangrui Song2021-04-191-4/+3
| | | | | | | | | | | Use a variable of static storage duration to reference an intentionally leaked variable. A static data area is in the GC-set of various leak checkers. This fixes 3 `check-lldb-shell` tests in a `-DLLVM_USE_SANITIZER={Leaks,Address}` build, e.g. `test/Shell/Reproducer/TestHomeDir.test` Differential Revision: https://reviews.llvm.org/D100806
* [lldb] Fix demangler leaks in the DWARF AST parserFangrui Song2021-04-191-2/+6
| | | | | | This fixes 6 check-lldb-shell failures in a `-DLLVM_USE_SANITIZER=Leaks` build. Differential Revision: https://reviews.llvm.org/D100800
* [lldb] Stop unsetting LLDB_DEBUGSERVER_PATH from TestLaunchProcessPosixSpawnJonas Devlieghere2021-04-191-17/+2
| | | | | We no longer need this after Pavel's change to automatically find debug servers to test. (3ca7b2d)
* [lldb] Update breakpoint_function_callback.test for different error messageJonas Devlieghere2021-04-191-1/+1
| | | | Adjust for the Lua error message printed by Lua 5.4.3.
* [lldb] Print the fixed address if symbolication fails in DumpDataExtractorJonas Devlieghere2021-04-191-0/+17
| | | | | When formatting memory with as eFormatAddressIn and symbolication fails, fix the code address and print the symbol it points to, if any.
* [lldb] Support "absolute memory address" images in crashlog.pyJonas Devlieghere2021-04-191-3/+3
| | | | | | | | | | | | | | | The binary image list contains the following entry when a frame is not found in any know binary image: { "size" : 0, "source" : "A", "base" : 0, "uuid" : "00000000-0000-0000-0000-000000000000" } Note that this object is missing the name and path keys. This patch makes the JSON parser resilient against their absence.
* [lldb] Remove a superfluous trailing semicolon, fixing warnings. NFC.Martin Storsjö2021-04-181-1/+1
|
* Target::ReadMemory read from read-only binary file Section, not memoryJason Molenda2021-04-1628-133/+122
| | | | | | | | | | | | | | | | | | Commiting this patch for Augusto Noronha who is getting set up still. This patch changes Target::ReadMemory so the default behavior when a read is in a Section that is read-only is to fetch the data from the local binary image, instead of reading it from memory. Update all callers to use their old preferences (the old prefer_file_cache bool) using the new API; we should revisit these calls and see if they really intend to read live memory, or if reading from a read-only Section would be equivalent and important for performance-sensitive cases. rdar://30634422 Differential revision: https://reviews.llvm.org/D100338
* [lldb] Set addressable bits from qHostInfoJonas Devlieghere2021-04-163-9/+25
| | | | | | | | Read the number of addressable bits from the qHostInfo packet and use it to set the code and data address mask in the process. The data (addressing_bits) is already present in the packet. Differential revision: https://reviews.llvm.org/D100520
* [lldb] Implement ABI::Fix{Code,Data}Address for AArch64Jonas Devlieghere2021-04-168-7/+72
| | | | | | | | | Implement FixCodeAddress and FixDataAddress for ABIMacOSX_arm64 and ABISysV_arm64 and add missing calls to RegisterContextUnwind. We need this to unwind on Apple Silicon where libraries like libSystem are arm64e even when the program being debugged is arm64. Differential revision: https://reviews.llvm.org/D100521
* [lldb] Add code and data address mask to ProcessJonas Devlieghere2021-04-163-0/+53
| | | | | | | | | Add a code and data address mask to Process with respective getters and setters and a setting that allows the user to specify the mast as a number of addressable bits. The masks will be used by FixCodeAddress and FixDataAddress respectively in the ABI classes. Differential revision: https://reviews.llvm.org/D100515
* [LLDB] Re-land: Use path relative to binary for finding .dwo files.Caroline Tice2021-04-162-0/+180
| | | | | | | | | | | | | | | DWARF allows .dwo file paths to be relative rather than absolute. When they are relative, DWARF uses DW_AT_comp_dir to find the .dwo file. DW_AT_comp_dir can also be relative, making the entire search patch for the .dwo file relative. In this case, LLDB currently searches relative to its current working directory, i.e. the directory from which the debugger was launched. This is not right, as the compiler, which generated the relative paths, can have no idea where the debugger will be launched. The correct thing is to search relative to the location of the executable binary. That is what this patch does. Differential Revision: https://reviews.llvm.org/D97786
* Don't refer to allocation map entry after deallocating itJason Molenda2021-04-151-3/+3
| | | | | | | | | | debugserver's MachTask::DeallocateMemory when removing an allocate entry from our map (in resposne to an '_m' packet), copy the size from the entry before removing it from the map and then using the iterator to fix an ASAN error on the bots when running TestGdbRemoteMemoryAllocation.py rdar://76595998
* Revert "[LLDB] Use path relative to binary for finding .dwo files."Caroline Tice2021-04-152-424/+0
| | | | | | This reverts commit b241f3cb292d0ba1ad5a33b3bbd4a8a3a9c909dc. Test case is breaking windows builder.
* [lldb] Raise a CrashLogParseException when failing to parse JSON crashlogJonas Devlieghere2021-04-151-6/+14
| | | | | Throw an exception with an actually helpful message when we fail to parse a JSON crashlog.
* [LLDB] Use path relative to binary for finding .dwo files.Caroline Tice2021-04-152-0/+424
| | | | | | | | | | | | | | | DWARF allows .dwo file paths to be relative rather than absolute. When they are relative, DWARF uses DW_AT_comp_dir to find the .dwo file. DW_AT_comp_dir can also be relative, making the entire search patch for the .dwo file relative. In this case, LLDB currently searches relative to its current working directory, i.e. the directory from which the debugger was launched. This is not right, as the compiler, which generated the relative paths, can have no idea where the debugger will be launched. The correct thing is to search relative to the location of the executable binary. That is what this patch does. Differential Revision: https://reviews.llvm.org/D97786
* [lldb] Fix incorrect test data in FileSpecTest.IsRelativeRaphael Isemann2021-04-151-1/+1
| | | | Found by clang-tidy's bugprone-suspicious-missing-comma.
* NFC put the armv6m entry with the other Cortex-M entriesJason Molenda2021-04-151-18/+24
| | | | | | The armv6m entry in cores_match() got separated from its friends armv7m and armv7em. Reuniting them to make it easier to keep them updated in all at the same time.
* Mark armv6m compat with armv7em; match armv7em being compat with armv6mJason Molenda2021-04-151-1/+3
| | | | | | | armv7em and armv6m in ArchSpec cores_match() will return true. There was a small bug where the reverse order would not return true. rdar://76387176
* [lldb] Simplify output for skipped categories in dotest.pyJonas Devlieghere2021-04-141-10/+14
| | | | | | | | | | | | | Print a single line listing all the categories that are being skipped, rather than relying on the check.*Support() functions specifying why a particular category will be skipped. If we know why a category got skipped, still print that in verbose mode. The motivation for this change is that sometimes engineers misidentify the output of these messages as the cause for a test failure (e.g. not being able to build libc++ or libstdc++). Differential revision: https://reviews.llvm.org/D100508
* [LLLDB] Adding additional check LibCppStdFunctionCallableInfo based on crash ↵Shafik Yaghmour2021-04-141-0/+3
| | | | | | | | reports We have seen several crashes in LibCppStdFunctionCallableInfo(...) but we don't have a reproducer. The last crash pointed to last call to line_entry_helper(...) and symbol was a nullptr. So adding a check for this case.
* [lldb] Add addressing_bits to KNOWN_HOST_INFO_KEYS and sort the listJonas Devlieghere2021-04-141-4/+5
| | | | This fixes TestGdbRemoteHostInfo on Apple Silicon.
* [lldb-vscode] Reduce chattiness of progress eventsWalter Erquinigo2021-04-146-50/+167
| | | | | | | | Progress events internally have a completed count and a total count, which can mean that for a job with 20000 total counts, then there will be 20000 events fired. Sending all these events to the IDE can break it. For example, debugging a huge binary resulted in around 50 million messages, which rendered the IDE useless, as it was spending all of its resources simply parsing messages and updating the UI. A way to fix this is to send unique percentage updates, which are at most 100 per job, which is not much. I was able to debug that big target and confirm that only unique percentage notifications are sent. I can't write a test for this because the current test is flaky. I'll figure out later how to make the test reliable, but fixing this will unblock us from deploy a new version of lldb-vscode. Differential Revision: https://reviews.llvm.org/D100443
* [lldb] Only override target arch if it is compatibleFred Riss2021-04-141-1/+3
| | | | | | | | | | | | | It looks like the goal of this code is to provide a more precise architecture definition for the target when attaching to a process. When attaching to a foreign debugserver, you might get into a situation where the active (host) platform will give you bogus information on the target process. This change allows the platform to override the target arch only with a compatible architecture. This fixes TestTargetXMLArch.py on Apple Silicon. Another alternative would be to just fail in this scenario and update the test(s).
* [lldb/test] Remove the "expect_captures" feature of lldb-server testsPavel Labath2021-04-142-44/+15
| | | | | | This functionality is used exactly once, and it is trivial to implement it differently (capture into two distinct variables, and compare for equality afterwards).
* [lldb] Move QThreadSuffixSupported and QListThreadsInStopReply into llgsPavel Labath2021-04-144-31/+29
| | | | | | These were in the shared llgs+platform code, but they only make sense for llgs (as they deal with how the server reports information about debugged processes).
* [lldb][AArch64] Simplify MTE memory region testDavid Spickett2021-04-143-34/+37
| | | | | | | | | By checking for cpu and toolchain features ahead of time we don't need the custom return codes. Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D97684
* [lldb] Silence GCC warnings about control reaching the end of non-void ↵Martin Storsjö2021-04-141-1/+3
| | | | | | | | | functions. NFC. Also remove a superfluous semicolon after the braces for a switch statement (that wasn't warned about). Differential Revision: https://reviews.llvm.org/D100447
* [lldb] Disable TestClangModulesUpdate.py because it's flakyJonas Devlieghere2021-04-131-0/+1
| | | | | | The test is failing intermittently on GreenDragon. rdar://76540904
* [lldb] Build debugserver 2-way fat on ASJonas Devlieghere2021-04-131-0/+24
| | | | | | When compiling for arm, build debugserver 2 way fat with an arm64 and arm64e slice. You can only debug arm64e processes using an arm64e debugserver.
* [lldb] Pretend host architecture is arm64 on ASJonas Devlieghere2021-04-131-0/+6
| | | | | The arm64e architecture is a preview. On Apple Silicon, pretend the host architecture is arm64.
* [debugserver] Use class member initialization for RNBContextJonas Devlieghere2021-04-131-16/+13
| | | | Address Shafik Yaghmour's post commit code review feedback.
* [lldb] [gdb-remote server] Abstract away getting current processMichał Górny2021-04-132-176/+178
| | | | | | | | | Introduce new m_current_process and m_continue_process variables that keep the pointers to currently selected process. At this moment, this is equivalent to m_debugged_process_up but it lays foundations for the future multiprocess support. Differential Revision: https://reviews.llvm.org/D100256
* [debugserver] Fix unintialized member variableJonas Devlieghere2021-04-131-2/+3
| | | | | Caught by ubsan (__ubsan_handle_load_invalid_value_abort) when running the unit tests.
* [lldb/test] s/add_no_ack_remote_stream/do_handshakePavel Labath2021-04-139-65/+47
| | | | | | | | | These two functions are doing the same thing, only one of them is sending the packets immediately and the other "queues" them to be sent later. The first one is better as in case of errors, the backtrace will point straight to the place that caused them. Modify the first method to avoid duplication, and ten standardize on it.
* [lldb][AArch64] Only run MTE memory region test if we have MTEDavid Spickett2021-04-131-0/+2
| | | | | | | | | | | | | This test is flakey because it tries to read the proc/smaps file of the first lldb-server process it finds. This process can finish before we finish doing that. http://lab.llvm.org:8011/#/builders/96/builds/6634/steps/6/logs/stdio For now limit this to MTE targets which basically means QEMU via lldb-dotest, which doesn't have this issue. I'll fix the race condition shortly.
* [lldb] Remove self-skipping code from lldb-server testsPavel Labath2021-04-131-4/+0
| | | | | We already do category based skipping in checkDebugServerSupport in dotest.py.
* [lldb] Remote @debugserver_test from TestAppleSimulatorOSTypePavel Labath2021-04-131-3/+0
| | | | | | The annotation is now (since the introduction of @apple_simulator_test) redundant, and the test could theoretically run on lldb-server too (if it supported darwin hosts).
* [lldb] Require x86 for various NativePDB, Breakpad and Minidump testsDavid Spickett2021-04-139-3/+17
| | | | | | | | | | These tests fail if you build without the x86 llvm backend. Either because they use an x86 triple or try to backtrace which requires some x86 knowledge to see all frames. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D100194
* Reland "[lldb] [Process] Watch for fork/vfork notifications" for LinuxMichał Górny2021-04-135-44/+175
| | | | | | Big thanks to Pavel Labath for figuring out my mistake. Differential Revision: https://reviews.llvm.org/D98822
* Reland "[lldb] [Process] Watch for fork/vfork notifications" for NetBSDMichał Górny2021-04-134-5/+87
| | | | Differential Revision: https://reviews.llvm.org/D98822
* Reland "[lldb] [Process] Watch for fork/vfork notifications" for FreeBSDMichał Górny2021-04-138-3/+154
| | | | | | | | | | | | The original commit was reverted because of the problems it introduced on Linux. However, FreeBSD should not be affected, so restore that part and we will address Linux separately. While at it, remove the dbreg hack as the underlying issue has been fixed in the FreeBSD kernel and the problem is unlikely to happen in real life use anyway. Differential Revision: https://reviews.llvm.org/D98822
* [lldb] [gdb-remote server] Refactor handling qSupportedMichał Górny2021-04-134-20/+40
| | | | | | | | | | | | | | Refactor handling qSupported to use a virtual HandleFeatures() method. The client-provided features are split into an array and passed to the method. The method returns an array of server features that are concatenated into the qSupported response to the server. The base implementation of HandleFeatures() in GDBRemoteCommunicationServerCommon now includes only flags common to both platform server and llgs, while llgs-specific flags are inserted in GDBRemoteCommunicationServerLLGS. Differential Revision: https://reviews.llvm.org/D100140
* [lldb] [gdb-remote client] Refactor handling qSupportedMichał Górny2021-04-132-93/+51
| | | | | | | | | | | | Refactor the qSupported handler to split the reply into an array, and identify features within the array rather than searching the string for partial matches. While at it, use StringRef.split() to process the compression list instead of reinventing the wheel. Switch the arguments to MaybeEnableCompression() to use an ArrayRef of StringRefs to simplify parameter passing from GetRemoteQSupported(). Differential Revision: https://reviews.llvm.org/D100146
* Revert "[lldb] [Process] Watch for fork/vfork notifications" and associated ↵Pavel Labath2021-04-1322-458/+52
| | | | | | | | | | | | | | | | | | followups This commit has caused the following tests to be flaky: TestThreadSpecificBpPlusCondition.py TestExitDuringExpression.py The exact cause is not known yet, but since both tests deal with threads, my guess is it has something to do with the tracking of creation of new threads (which the commit touches upon). This reverts the following commits: d01bff8cbdc98fb8751f7bf10af19b47ae5c445d, ba62ebc48e8c424ce3a78ba01acda679d536dd47, e761b6b4c58d4f7ae1073d925d7cb321d68ee93a, a345419ee03095c8cdfbe1c2728467c4da8fa0a4.
* [lldb] Require x86 for unwind no-return testDavid Spickett2021-04-131-0/+1
| | | | | | | | | The core file used is built for i386 so we need the x86 backend to be able to load it. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D100195
* [lldb][Arm/AArch64] Add basic disassemble tests for Arm/AArch64David Spickett2021-04-131-0/+12
| | | | | | | | | Previously the test would fail if you built on Arm/AArch64 but did not have the x86 llvm backend enabled. Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D100192
* [lldb] Require x86 backend for a bunch of DWARF testsDavid Spickett2021-04-1393-72/+16
| | | | | | | | | | | | | | By moving them into a folder with a local lit config requiring x86. All these tests use x86 target triples. There are two tests that require target-x86_64 because they run program files (instead of just needing the backend). Those are moved to the x86 folder also but their REQUIRES are unchanged. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D100193
* [lldb] Replace NativeProcess delegate list with a single delegatePavel Labath2021-04-135-87/+11
| | | | | | | | In all this time, we've never used more than one delegate. The logic to support multiple delegates is therefore untested, and becomes particularly unwieldy once we need to support multiple processes. Just remove it.
* [lldb] Fix replaying TestMemoryRead.py from reproducerJonas Devlieghere2021-04-121-0/+2
| | | | Remap the external file to the one embedded in the reproducer.