aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
AgeCommit message (Collapse)AuthorFilesLines
2025-03-17Reapply "[lldb] Implement basic support for reverse-continue (#125242)" ↵Pavel Labath1-0/+6
(again) (#128156) This reverts commit https://github.com/llvm/llvm-project/commit/87b7f63a117c340a6d9ca47959335fd7ef6c7ad2, reapplying https://github.com/llvm/llvm-project/commit/7e66cf74fb4e6a103f923e34700a7b6f20ac2a9b with a small (and probably temporary) change to generate more debug info to help with diagnosing buildbot issues.
2025-01-31Revert "Reland "[lldb] Implement basic support for reverse-continue" (#125242)"Adrian Prantl1-6/+0
This reverts commit 7e66cf74fb4e6a103f923e34700a7b6f20ac2a9b. Breaking green dragon: https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/19569/testReport/junit/lldb-api/functionalities_reverse-execution/TestReverseContinueWatchpoints_py/
2025-01-31Reland "[lldb] Implement basic support for reverse-continue" (#125242)David Spickett1-0/+6
This reverts commit a774de807e56c1147d4630bfec3110c11d41776e. This is the same changes as last time, plus: * We load the binary into the target object so that on Windows, we can resolve the locations of the functions. * We now assert that each required breakpoint has at least 1 location, to prevent an issue like that in the future. * We are less strict about the unsupported error message, because it prints "error: windows" on Windows instead of "error: gdb-remote".
2025-01-31[lldb] Add support for gdb-style 'x' packet (#124733)Pavel Labath1-2/+9
See also https://discourse.llvm.org/t/rfc-fixing-incompatibilties-of-the-x-packet-w-r-t-gdb/84288 and https://sourceware.org/pipermail/gdb/2025-January/051705.html
2025-01-30Revert "Reland "[lldb] Implement basic support for reverse-continue" ↵David Spickett1-6/+0
(#123906)"" (#125091) Reverts llvm/llvm-project#123945 Has failed on the Windows on Arm buildbot: https://lab.llvm.org/buildbot/#/builders/141/builds/5865 ``` ******************** Unresolved Tests (2): lldb-api :: functionalities/reverse-execution/TestReverseContinueBreakpoints.py lldb-api :: functionalities/reverse-execution/TestReverseContinueWatchpoints.py ******************** Failed Tests (1): lldb-api :: functionalities/reverse-execution/TestReverseContinueNotSupported.py ``` Reverting while I reproduce locally.
2025-01-30Reland "[lldb] Implement basic support for reverse-continue" (#123906)" ↵David Spickett1-0/+6
(#123945) This reverts commit 22561cfb443267905d4190f0e2a738e6b412457f and fixes b7b9ccf44988edf49886743ae5c3cf4184db211f (#112079). The problem is that x86_64 and Arm 32-bit have memory regions above the stack that are readable but not writeable. First Arm: ``` (lldb) memory region --all <...> [0x00000000fffcf000-0x00000000ffff0000) rw- [stack] [0x00000000ffff0000-0x00000000ffff1000) r-x [vectors] [0x00000000ffff1000-0xffffffffffffffff) --- ``` Then x86_64: ``` $ cat /proc/self/maps <...> 7ffdcd148000-7ffdcd16a000 rw-p 00000000 00:00 0 [stack] 7ffdcd193000-7ffdcd196000 r--p 00000000 00:00 0 [vvar] 7ffdcd196000-7ffdcd197000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall] ``` Compare this to AArch64 where the test did pass: ``` $ cat /proc/self/maps <...> ffffb87dc000-ffffb87dd000 r--p 00000000 00:00 0 [vvar] ffffb87dd000-ffffb87de000 r-xp 00000000 00:00 0 [vdso] ffffb87de000-ffffb87e0000 r--p 0002a000 00:3c 76927217 /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 ffffb87e0000-ffffb87e2000 rw-p 0002c000 00:3c 76927217 /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 fffff4216000-fffff4237000 rw-p 00000000 00:00 0 [stack] ``` To solve this, look up the memory region of the stack pointer (using https://lldb.llvm.org/resources/lldbgdbremote.html#qmemoryregioninfo-addr) and constrain the read to within that region. Since we know the stack is all readable and writeable. I have also added skipIfRemote to the tests, since getting them working in that context is too complex to be worth it. Memory write failures now display the range they tried to write, and register write errors will show the name of the register where possible. The patch also includes a workaround for a an issue where the test code could mistake an `x` response that happens to begin with an `O` for an output packet (stdout). This workaround will not be necessary one we start using the [new implementation](https://discourse.llvm.org/t/rfc-fixing-incompatibilties-of-the-x-packet-w-r-t-gdb/84288) of the `x` packet. --------- Co-authored-by: Pavel Labath <pavel@labath.sk>
2025-01-22Revert "[lldb] Implement basic support for reverse-continue" (#123906)Pavel Labath1-6/+0
Reverts llvm/llvm-project#112079 due to failures on the arm bot.
2025-01-22[lldb] Implement basic support for reverse-continue (#112079)Robert O'Callahan1-0/+6
This commit adds support for a `SBProcess::ContinueInDirection()` API. A user-accessible command for this will follow in a later commit. This feature depends on a gdbserver implementation (e.g. `rr`) providing support for the `bc` and `bs` packets. `lldb-server` does not support those packets, and there is no plan to change that. For testing purposes, this commit adds a Python implementation of *very limited* record-and-reverse-execute functionality, implemented as a proxy between lldb and lldb-server in `lldbreverse.py`. This should not (and in practice cannot) be used for anything except testing. The tests here are quite minimal but we test that simple breakpoints and watchpoints work as expected during reverse execution, and that conditional breakpoints and watchpoints work when the condition calls a function that must be executed in the forward direction.
2024-10-10Revert "[lldb] Implement basic support for reverse-continue (#99736)"Jason Molenda1-6/+0
Reverting this again; I added a commit which added @skipIfDarwin markers to the TestReverseContinueBreakpoints.py and TestReverseContinueNotSupported.py API tests, which use lldb-server in gdbserver mode which does not work on Darwin. But the aarch64 ubuntu bot reported a failure on TestReverseContinueBreakpoints.py, https://lab.llvm.org/buildbot/#/builders/59/builds/6397 File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py", line 63, in test_reverse_continue_skip_breakpoint self.reverse_continue_skip_breakpoint_internal(async_mode=False) File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py", line 81, in reverse_continue_skip_breakpoint_internal self.expect( File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2372, in expect self.runCmd( File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1002, in runCmd self.assertTrue(self.res.Succeeded(), msg + output) AssertionError: False is not true : Process should be stopped due to history boundary Error output: error: Process must be launched. This reverts commit 4f297566b3150097de26c6a23a987d2bd5fc19c5.
2024-10-10[lldb] Implement basic support for reverse-continue (#99736)Robert O'Callahan1-0/+6
This commit only adds support for the `SBProcess::ReverseContinue()` API. A user-accessible command for this will follow in a later commit. This feature depends on a gdbserver implementation (e.g. `rr`) providing support for the `bc` and `bs` packets. `lldb-server` does not support those packets, and there is no plan to change that. So, for testing purposes, `lldbreverse.py` wraps `lldb-server` with a Python implementation of *very limited* record-and-replay functionality for use by *tests only*. The majority of this PR is test infrastructure (about 700 of the 950 lines added).
2024-10-10Revert "[lldb] Implement basic support for reverse-continue (#99736)"Augusto Noronha1-6/+0
This reverts commit d5e1de6da96c1ab3b8cae68447e8ed3696a7006e.
2024-10-10[lldb] Implement basic support for reverse-continue (#99736)Robert O'Callahan1-0/+6
This commit only adds support for the `SBProcess::ReverseContinue()` API. A user-accessible command for this will follow in a later commit. This feature depends on a gdbserver implementation (e.g. `rr`) providing support for the `bc` and `bs` packets. `lldb-server` does not support those packets, and there is no plan to change that. So, for testing purposes, `lldbreverse.py` wraps `lldb-server` with a Python implementation of *very limited* record-and-replay functionality for use by *tests only*. The majority of this PR is test infrastructure (about 700 of the 950 lines added).
2024-05-09[lldb] Unify CalculateMD5 return types (#91029)Anthony Ha1-1/+1
This is a retake of https://github.com/llvm/llvm-project/pull/90921 which got reverted because I forgot to modify the CalculateMD5 unit test I had added in https://github.com/llvm/llvm-project/pull/88812 The prior failing build is here: https://lab.llvm.org/buildbot/#/builders/68/builds/73622 To make sure this error doesn't happen, I ran `ninja ProcessGdbRemoteTests` and then executed the resulting test binary and observed the `CalculateMD5` test passed. # Overview In my previous PR: https://github.com/llvm/llvm-project/pull/88812, @JDevlieghere suggested to match return types of the various calculate md5 functions. This PR achieves that by changing the various calculate md5 functions to return `llvm::ErrorOr<llvm::MD5::MD5Result>`.   The suggestion was to go for `std::optional<>` but I opted for `llvm::ErrorOr<>` because local calculate md5 was already possibly returning `ErrorOr`. To make sure I didn't break the md5 calculation functionality, I ran some tests for the gdb remote client, and things seem to work. # Testing 1. Remote file doesn't exist ![image](https://github.com/llvm/llvm-project/assets/1326275/b26859e2-18c3-4685-be8f-c6b6a5a4bc77) 1. Remote file differs ![image](https://github.com/llvm/llvm-project/assets/1326275/cbdb3c58-555a-401b-9444-c5ff4c04c491) 1. Remote file matches ![image](https://github.com/llvm/llvm-project/assets/1326275/07561572-22d1-4e0a-988f-bc91b5c2ffce) ## Test gaps Unfortunately, I had to modify `lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp` and I can't test the changes there. Hopefully, the existing test suite / code review from whomever is reading this will catch any issues.
2024-05-03Revert "[lldb] Unify CalculateMD5 return types" (#90998)Jonas Devlieghere1-1/+1
Reverts llvm/llvm-project#90921
2024-05-03[lldb] Unify CalculateMD5 return types (#90921)Anthony Ha1-1/+1
# Overview In my previous PR: https://github.com/llvm/llvm-project/pull/88812, @JDevlieghere suggested to match return types of the various calculate md5 functions. This PR achieves that by changing the various calculate md5 functions to return `llvm::ErrorOr<llvm::MD5::MD5Result>`.   The suggestion was to go for `std::optional<>` but I opted for `llvm::ErrorOr<>` because local calculate md5 was already possibly returning `ErrorOr`. To make sure I didn't break the md5 calculation functionality, I ran some tests for the gdb remote client, and things seem to work. # Testing 1. Remote file doesn't exist ![image](https://github.com/llvm/llvm-project/assets/1326275/b26859e2-18c3-4685-be8f-c6b6a5a4bc77) 1. Remote file differs ![image](https://github.com/llvm/llvm-project/assets/1326275/cbdb3c58-555a-401b-9444-c5ff4c04c491) 1. Remote file matches ![image](https://github.com/llvm/llvm-project/assets/1326275/07561572-22d1-4e0a-988f-bc91b5c2ffce) ## Test gaps Unfortunately, I had to modify `lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp` and I can't test the changes there. Hopefully, the existing test suite / code review from whomever is reading this will catch any issues. Co-authored-by: Anthony Ha <antha@microsoft.com>
2024-04-18[lldb] Skip remote PutFile when MD5 hashes equal (#88812)Anthony Ha1-1/+1
This PR adds a check within `PutFile` to exit early when both local and destination files have matching MD5 hashes. If they differ, or there is trouble getting the hashes, the regular code path to put the file is run. As I needed this to talk to an `lldb-server` which runs the gdb-remote protocol, I enabled `CalculateMD5` within `Platform/gdb-server` and also found and fixed a parsing bug within it as well. Before this PR, the client is incorrectly parsing the response packet containing the checksum; after this PR, hopefully this is fixed. There is a test for the parsing behavior included in this PR. --------- Co-authored-by: Anthony Ha <antha@microsoft.com>
2024-02-05[lldb] Add QSupported key to report watchpoint types supported (#80376)Jason Molenda1-0/+4
debugserver on arm64 devices can manage both Byte Address Select watchpoints (1-8 bytes) and MASK watchpoints (8 bytes-2 gigabytes). This adds a SupportedWatchpointTypes key to the QSupported response from debugserver with a list of these, so lldb can take full advantage of them when creating larger regions with a single hardware watchpoint. Also add documentation for this, and two other lldb extensions, to the lldb-gdb-remote.txt documentation. Re-enable TestLargeWatchpoint.py on Darwin systems when testing with the in-tree built debugserver. I can remove the "in-tree built debugserver" in the future when this new key is handled by an Xcode debugserver.
2023-08-16hi/low addr space bits can be sent in stop-rely packetJason Molenda1-1/+1
Add support for the `low_mem_addressing_bits` and `high_mem_addressing_bits` keys in the stop reply packet, in addition to the existing `addressing_bits`. Same behavior as in the qHostInfo packet. Clean up AddressableBits so we don't need to check if any values have been set in the object before using it to potentially update the Process address masks. Differential Revision: https://reviews.llvm.org/D158041
2023-08-15Update qHostInfo/LC_NOTE so multiple address bits can be specifiedJason Molenda1-2/+4
On AArch64 systems, we may have different page table setups for low memory and high memory, and therefore a different number of bits used for addressing depending on which half of memory the address is in. This patch extends the qHostInfo and LC_NOTE "addrable bits" so that it can specify the number of addressing bits in high memory and in low memory separately. It builds on the patch I added in https://reviews.llvm.org/D151292 where Process tracks the separate address masks, and there is a user setting to set them manually. Differential Revision: https://reviews.llvm.org/D157667 rdar://113225907
2023-06-21[lldb][NFCI] Remove ConstString from ↵Alex Langford1-1/+1
GDBRemoteCommunicationClient::ConfigureRemoteStructuredData ConstString's benefits are not being utilized here, StringRef is sufficient. Differential Revision: https://reviews.llvm.org/D153177
2023-05-03[lldb] Remove distribution_id from ArchSpecAlex Langford1-0/+1
The qHostInfo packet in the gdb-remote communication protocol specifies that distribution_id can be set, so lldb handles that. But we store that in the ArchSpec representing the "Host" platform (whatever platform the debug server is running on). This field is otherwise unused in ArchSpec, so it would be a lot easier if we stored that information at the gdb-remote communication layer. Sidenote: The distribution_id field is currently unused but I did not want to remove it in case some folks found it useful (e.g. in downstream forks). Differential Revision: https://reviews.llvm.org/D149697
2023-02-14[LLDB] add arch-specific watchpoint behavior defaults to lldbJason Molenda1-6/+2
lldb was originally designed to get the watchpoint exception behavior from the gdb remote serial protocol stub -- exceptions are either received before the instruction executes, or after the instruction has executed. This behavior was reported via two lldb extensions to gdb RSP, so generic remote stubs like gdbserver or a JTAG stub, would not tell lldb which behavior was correct, and it would default to "exceptions are received after the instruction has executed". Two architectures hard coded their correct "exceptions before instruction" behavior, to work around this issue. Most architectures have a fixed behavior of watchpoint exceptions, and we can center that information in lldb. We can allow a remote stub to override the default behavior via our packet extensions if it's needed on a specific target. This patch also separates the fetching of the number of watchpoints from whether exceptions are before/after the insn. Currently if lldb couldn't fetch the number of watchpoints (not really needed), it also wouldn't get when exceptions are received, and watchpoint handling would fail. lldb doesn't actually use the number of watchpoints for anything beyond printing it to the user. Differential Revision: https://reviews.llvm.org/D143215 rdar://101426626
2023-01-07[lldb] Remove remaining uses of llvm::Optional (NFC)Kazu Hirata1-1/+0
This patch removes the unused "using" declarations, updates comments, and removes #include "llvm/ADT/Optional.h". This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-07[lldb] Use std::optional instead of llvm::Optional (NFC)Kazu Hirata1-8/+8
This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to clean up the "using" declarations, #include "llvm/ADT/Optional.h", etc. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-07[lldb] Add #include <optional> (NFC)Kazu Hirata1-0/+1
This patch adds #include <optional> to those files containing llvm::Optional<...> or Optional<...>. I'll post a separate patch to actually replace llvm::Optional with std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-13Launch state discoverable in Darwin, use for SafeToCallFunctionsJason Molenda1-0/+3
The dynamic linker on Darwin, dyld, can provide status of the process state for a few significant points early on, most importantly, when libSystem has been initialized and it is safe to call functions behind the scenes. Pipe this information up from debugserver to DynamicLoaderMacOS, for the DynamicLoader::IsFullyInitialized() method, then have Thread::SafeToCallFunctions use this information. Finally, for the two utility functions in the AppleObjCRuntimeV2 LanguageRuntime plugin that I was fixing, call this method before running our utility functions to collect the list of objc classes registered in the runtime. User expressions will still be allowed to run any time - we assume the user knows what they are doing - but these two additional utility functions that they are unaware of will be limited by this state. Differential Revision: https://reviews.llvm.org/D139054 rdar://102436092 can probably make function calls.
2022-10-06[lldb/gdb-server] Better reporting of launch errorsPavel Labath1-14/+4
Use our "rich error" facility to propagate error reported by the stub to the user. lldb-server reports rich launch errors as of D133352. To make this easier to implement, and reduce code duplication, I have moved the vRun/A/qLaunchSuccess handling into a single GDBRemoteCommunicationClient function. Differential Revision: https://reviews.llvm.org/D134754
2022-09-19[lldb] Remove LLDB reproducersJonas Devlieghere1-0/+1
This patch removes the remaining reproducer code. The SBReproducer class remains for ABI stability but is just an empty shell. This completes the removal process outlined on the mailing list [1]. [1] https://lists.llvm.org/pipermail/lldb-dev/2021-September/017045.html
2022-08-20[lldb] [gdb-remote] Include PID in vCont packets if multiprocessMichał Górny1-0/+2
Try to always send vCont packets and include the PID in them if running multiprocess. This is necessary to ensure that with the upcoming full multiprocess support always resumes the correct process without having to resort to the legacy Hc packets. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D131758
2022-08-19Revert "[lldb] [gdb-remote] Include PID in vCont packets if multiprocess"Michael Buch1-2/+0
This reverts commit ccb9d4d4addc2fb2aa94cf776d43d8be35365272. https://reviews.llvm.org/D131758 Differential Revision: https://reviews.llvm.org/D132250
2022-08-19[lldb] [gdb-remote] Include PID in vCont packets if multiprocessMichał Górny1-0/+2
Try to always send vCont packets and include the PID in them if running multiprocess. This is necessary to ensure that with the upcoming full multiprocess support always resumes the correct process without having to resort to the legacy Hc packets. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D131758
2022-08-02Allow firmware binaries to be specified only by load addressJason Molenda1-0/+3
Add support to Mach-O corefiles and to live gdb remote serial protocol connections for the corefile/remote stub to provide a list of load addresses of binaries that should be found & loaded by lldb, and nothing else. lldb will try to parse the binary out of memory, and if it can find a UUID, try to find a binary & its debug information based on the UUID, falling back to using the memory image if it must. A bit of code unification from three parts of lldb that were loading individual binaries already, so there is a shared method in DynamicLoader to handle all of the variations they were doing. Re-landing this with a uuid_is_null() implementation added to Utility/UuidCompatibility.h for non-Darwin systems. Differential Revision: https://reviews.llvm.org/D130813 rdar://94249937 rdar://94249384
2022-08-02Revert "Allow firmware binaries to be specified only by load address"Jason Molenda1-3/+0
This reverts commit d8879fba8825b9799166ba0ea552d4027bfb8ad1. Debian bot failure; I included <uuid/uuid.h> to get uuid_is_null() but don't get it there. Will memcmp or whatever & recommit.
2022-08-02Allow firmware binaries to be specified only by load addressJason Molenda1-0/+3
Add support to Mach-O corefiles and to live gdb remote serial protocol connections for the corefile/remote stub to provide a list of load addresses of binaries that should be found & loaded by lldb, and nothing else. lldb will try to parse the binary out of memory, and if it can find a UUID, try to find a binary & its debug information based on the UUID, falling back to using the memory image if it must. A bit of code unification from three parts of lldb that were loading individual binaries already, so there is a shared method in DynamicLoader to handle all of the variations they were doing. Differential Revision: https://reviews.llvm.org/D130813 rdar://94249937 rdar://94249384
2022-07-25[lldb] [gdb-remote] Refactor killing process and move it to clientMichał Górny1-0/+2
Refactor the code responsible for sending the "k" packet and move it into GDBRemoteCommunicationClient::KillProcess() method. This is part of refactoring to enable multiprocess support in the client, and to support using the vKill packet instead. As part of the refactoring, the following functional changes apply: - Some redundant logging has been removed, as any failures are returned via exit_string anyway. - SetLastStopPacket() is no longer called. It is used only to populate the thread list, and since the process has just exited and we're terminating the process instance, there's really no reason to set it. - On successful kill, exit_string is set to "killed", to clearly indicate that the process has terminated on our request rather than on its own. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D130340
2022-07-14[lldb] [gdb-remote] Remove stray GetSupportsThreadSuffix() method (NFC)Michał Górny1-2/+0
Remove stray GDBRemoteCommunicationClient::GetSupportsThreadSuffix() method that is not implemented nor used anywhere.
2022-01-28[lldb] [gdb-remote] Support getting siginfo via APIMichał Górny1-0/+3
Add Thread::GetSiginfo() and SBThread::GetSiginfo() methods to retrieve the siginfo value from server. Differential Revision: https://reviews.llvm.org/D118055
2022-01-28Revert "[lldb] [gdb-remote] Support getting siginfo via API"Michał Górny1-3/+0
This reverts commit 1a8f60f5f5b8638a3e8e7fb31ba7ae9e17a7ff2d. The API requires further work.
2022-01-27[lldb] [gdb-remote] Support getting siginfo via APIMichał Górny1-0/+3
Add Thread::GetSiginfo() and SBThread::GetSiginfo() methods to retrieve the siginfo value from server. Differential Revision: https://reviews.llvm.org/D118055
2021-12-23Load binary by UUID from qProcessInfo packet fieldsJason Molenda1-0/+6
Support three new keys in the qProcessInfo response from the remote gdb stub to handle the case of attaching to a core running some type of standalone/firmware code and the stub knows the UUID and load address-or-slide for the binary. There will be no proper DynamicLoader plugin in this scenario, but we can try to locate and load the binary into lldb at the correct offset. Differential Revision: https://reviews.llvm.org/D116211 rdar://75191077
2021-11-10[lldb] Support gdbserver signalsMichał Górny1-0/+3
GDB and LLDB use different signal models. GDB uses a predefined set of signal codes, and maps platform's signos to them. On the other hand, LLDB has historically simply passed native signos. In order to improve compatibility between LLDB and gdbserver, the GDB signal model should be used. However, GDB does not provide a mapping for all existing signals on Linux and unsupported signals are passed as 'unknown'. Limiting LLDB to this behavior could be considered a regression. To get the best of both worlds, use the LLDB signal model when talking to lldb-server, and the GDB signal model otherwise. For this purpose, new versions of lldb-server indicate "native-signals+" via qSupported. At the same time, we also detect older versions of lldb-server via QThreadSuffixSupported for backwards compatibility. If neither test succeeds, we assume gdbserver or another implementation using GDB model. Differential Revision: https://reviews.llvm.org/D108078
2021-10-27Modernize Platform::GetOSKernelDescriptionPavel Labath1-1/+1
2021-10-25[lldb] Modernize Platform::GetOSBuildStringPavel Labath1-1/+1
2021-10-08[lldb/gdb-remote] Refactor ReadExtFeaturePavel Labath1-3/+2
replace stl and lldb apis with standard llvm ones.
2021-10-07[lldb/gdb-remote] Delete SendPacketsAndConcatenateResponsesPavel Labath1-21/+0
ReadExtFeature provides equivalent functionality. Also fix a but in ReadExtFeature, which prevented it from being used for auxv data (it contains nul characters).
2021-09-28[lldb] Remove non-stop mode codePavel Labath1-2/+0
We added some support for this mode back in 2015, but the feature was never productionized. It is completely untested, and there are known major structural lldb issues that need to be resolved before this feature can really be supported. It also complicates making further changes to stop reply packet handling, which is what I am about to do. Differential Revision: https://reviews.llvm.org/D110553
2021-09-10[lldb] [gdb-remote] Implement the vRun packetMichał Górny1-1/+2
Implement the simpler vRun packet and prefer it over the A packet. Unlike the latter, it tranmits command-line arguments without redundant indices and lengths. This also improves GDB compatibility since modern versions of gdbserver do not implement the A packet at all. Make qLaunchSuccess not obligatory when using vRun. It is not implemented by gdbserver, and since vRun returns the stop reason, we can assume it to be successful. Differential Revision: https://reviews.llvm.org/D107931
2021-09-10[lldb] [gdb-remote] Add fallbacks for vFile:mode and vFile:existsMichał Górny1-1/+2
Add a GDB-compatible fallback to vFile:fstat for vFile:mode, and to vFile:open for vFile:exists. Note that this is only partial fallback, as it fails if the file cannot be opened. Differential Revision: https://reviews.llvm.org/D107811
2021-09-10[lldb] [gdb-remote] Implement fallback to vFile:stat for GetFileSize()Michał Górny1-1/+7
Implement a fallback to getting the file size via vFile:stat packet when the remote server does not implement vFile:size. This makes it possible to query file sizes from remote gdbserver. Note that unlike vFile:size, the fallback will not work if the server is unable to open the file. While at it, add a few tests for the 'platform get-size' command. Differential Revision: https://reviews.llvm.org/D107780
2021-09-08[lldb] Remove unused GDBRemoteCommunicationClient::SendAttach functionDavid Spickett1-15/+0
Reviewed By: labath Differential Revision: https://reviews.llvm.org/D109427