Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4 |
|
#
0642cd76 |
| 27-Aug-2024 |
Adrian Prantl <aprantl@apple.com> |
[lldb] Turn lldb_private::Status into a value type. (#106163)
This patch removes all of the Set.* methods from Status.
This cleanup is part of a series of patches that make it harder use the
ant
[lldb] Turn lldb_private::Status into a value type. (#106163)
This patch removes all of the Set.* methods from Status.
This cleanup is part of a series of patches that make it harder use the
anti-pattern of keeping a long-lives Status object around and updating
it while dropping any errors it contains on the floor.
This patch is largely NFC, the more interesting next steps this enables
is to:
1. remove Status.Clear()
2. assert that Status::operator=() never overwrites an error
3. remove Status::operator=()
Note that step (2) will bring 90% of the benefits for users, and step
(3) will dramatically clean up the error handling code in various
places. In the end my goal is to convert all APIs that are of the form
` ResultTy DoFoo(Status& error)
`
to
` llvm::Expected<ResultTy> DoFoo()
`
How to read this patch?
The interesting changes are in Status.h and Status.cpp, all other
changes are mostly
` perl -pi -e 's/\.SetErrorString/ = Status::FromErrorString/g' $(git
grep -l SetErrorString lldb/source)
`
plus the occasional manual cleanup.
show more ...
|
Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7 |
|
#
2fe83274 |
| 07-Jan-2023 |
Kazu Hirata <kazu@google.com> |
[lldb] Use std::optional instead of llvm::Optional (NFC)
This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to clean up the "using" declarations, #include "llvm/
[lldb] Use std::optional instead of llvm::Optional (NFC)
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
show more ...
|
#
f190ce62 |
| 07-Jan-2023 |
Kazu Hirata <kazu@google.com> |
[lldb] Add #include <optional> (NFC)
This patch adds #include <optional> to those files containing llvm::Optional<...> or Optional<...>.
I'll post a separate patch to actually replace llvm::Optiona
[lldb] Add #include <optional> (NFC)
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
show more ...
|
#
343523d0 |
| 05-Dec-2022 |
Kazu Hirata <kazu@google.com> |
[lldb] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of ma
[lldb] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to 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
show more ...
|
Revision tags: llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init |
|
#
1903f358 |
| 29-Jun-2022 |
Michał Górny <mgorny@moritz.systems> |
[lldb] [llgs] Send process output asynchronously in non-stop mode
Introduce a new %Stdio notification category and use it to send process output asynchronously when running in non-stop mode. This i
[lldb] [llgs] Send process output asynchronously in non-stop mode
Introduce a new %Stdio notification category and use it to send process output asynchronously when running in non-stop mode. This is an LLDB extension since GDB does not use the 'O' packet for process output, just for replies to 'qRcmd' packets.
Using the async notification mechanism implies that only the first output packet is sent immediately to the client. The client needs to request subsequent notifications (if any) using the new vStdio packet (that works pretty much like vStopped for the Stop notification queue).
The packet handler in lldb-server tests is updated to handle the async stdio packets in addition to the regular O packets. However, due to the implications noted above, it can only handle the first output packet sent by the server. Subsequent packets need to be explicitly requested via vStdio.
Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D128849
show more ...
|
Revision tags: llvmorg-14.0.6 |
|
#
a3422793 |
| 15-Jun-2022 |
Michał Górny <mgorny@moritz.systems> |
[lldb] [llgs] Support resuming one process with PID!=current via vCont
Extend vCont function to support resuming a process with an arbitrary PID, that could be different than the one selected via Hc
[lldb] [llgs] Support resuming one process with PID!=current via vCont
Extend vCont function to support resuming a process with an arbitrary PID, that could be different than the one selected via Hc (or no process at all may be selected). Resuming more than one process simultaneously is not supported yet.
Remove the ReadTid() method that was only used by Handle_vCont(), and furthermore it was wrongly using m_current_process rather than m_continue_process.
Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D127862
show more ...
|
#
c18784ba |
| 12-Jun-2022 |
Michał Górny <mgorny@moritz.systems> |
[lldb] [llgs] Implement the vKill packet
Implement the support for the vKill packet. This is the modern packet used by the GDB Remote Serial Protocol to kill one of the debugged processes. Unlike
[lldb] [llgs] Implement the vKill packet
Implement the support for the vKill packet. This is the modern packet used by the GDB Remote Serial Protocol to kill one of the debugged processes. Unlike the `k` packet, it has well-defined semantics.
The `vKill` packet takes the PID of the process to kill, and always replies with an `OK` reply (rather than the exit status, as LLGS does for `k` packets at the moment). Additionally, unlike the `k` packet it does not cause the connection to be terminated once the last process is killed — the client needs to close it explicitly.
Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D127667
show more ...
|
Revision tags: llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2 |
|
#
bc04d240 |
| 12-Apr-2022 |
Michał Górny <mgorny@moritz.systems> |
[lldb] [llgs] Implement non-stop style stop notification packets
Implement the support for %Stop asynchronous notification packet format in LLGS. This does not implement full support for non-stop m
[lldb] [llgs] Implement non-stop style stop notification packets
Implement the support for %Stop asynchronous notification packet format in LLGS. This does not implement full support for non-stop mode for threaded programs -- process plugins continue stopping all threads on every event. However, it will be used to implement asynchronous events in multiprocess debugging.
The non-stop protocol is enabled using QNonStop packet. When it is enabled, the server uses notification protocol instead of regular stop replies. Since all threads are always stopped, notifications are always generated for all active threads and copied into stop notification queue.
If the queue was empty, the initial asynchronous %Stop notification is sent to the client immediately. The client needs to (eventually) acknowledge the notification by sending the vStopped packet, in which case it is popped from the queue and the stop reason for the next thread is reported. This continues until notification queue is empty again, in which case an OK reply is sent.
Asychronous notifications are also used for vAttach results and program exits. The `?` packet uses a hybrid approach -- it returns the first stop reason synchronously, and exposes the stop reasons for remaining threads via vStopped queue.
The change includes a test case for a program generating a segfault on 3 threads. The server is expected to generate a stop notification for the segfaulting thread, along with the notifications for the other running threads (with "no stop reason"). This verifies that the stop reasons are correctly reported for all threads, and that notification queue works.
Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D125575
show more ...
|
#
bff4673b |
| 11-May-2022 |
Jim Ingham <jingham@apple.com> |
Add a darwin platform setting to specify which exceptions debugserver should not receive as exceptions (some will get converted to BSD signals instead). This is really the only stable way to ensure
Add a darwin platform setting to specify which exceptions debugserver should not receive as exceptions (some will get converted to BSD signals instead). This is really the only stable way to ensure that a Mach exception gets converted to it's equivalent BSD signal. For programs that rely on BSD signal handlers, this has to happen or you can't even get the program to invoke the signal handler when under the debugger.
This builds on a previous solution to this problem which required you start debugserver with the -U flag. This was not very discoverable and required lldb be the one to launch debugserver, which is not always the case.
Differential Revision: https://reviews.llvm.org/D125434
show more ...
|
Revision tags: llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2 |
|
#
6ba3f723 |
| 11-Aug-2021 |
Michał Górny <mgorny@moritz.systems> |
[lldb] [gdb-remote] Implement the vRun packet
Implement the simpler vRun packet and prefer it over the A packet. Unlike the latter, it tranmits command-line arguments without redundant indices and l
[lldb] [gdb-remote] Implement the vRun packet
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
show more ...
|
#
a1097d31 |
| 10-Aug-2021 |
Michał Górny <mgorny@moritz.systems> |
Reland "[lldb] [gdb-server] Implement the vFile:fstat packet"
Now with an #ifdef for WIN32.
Differential Revision: https://reviews.llvm.org/D107840
|
#
70558d39 |
| 10-Sep-2021 |
Michał Górny <mgorny@moritz.systems> |
Revert "[lldb] [gdb-server] Implement the vFile:fstat packet"
This reverts commit 9e886fbb18b525c080c04f4a12bd481c9aa849c0. It breaks on Windows.
|
#
9e886fbb |
| 10-Aug-2021 |
Michał Górny <mgorny@moritz.systems> |
[lldb] [gdb-server] Implement the vFile:fstat packet
Differential Revision: https://reviews.llvm.org/D107840
|
Revision tags: llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1 |
|
#
37cbd817 |
| 26-Apr-2021 |
Michał Górny <mgorny@moritz.systems> |
[lldb] [llgs server] Support creating core dumps on NetBSD
Add a new SaveCore() process method that can be used to request a core dump. This is currently implemented on NetBSD via the PT_DUMPCORE p
[lldb] [llgs server] Support creating core dumps on NetBSD
Add a new SaveCore() process method that can be used to request a core dump. This is currently implemented on NetBSD via the PT_DUMPCORE ptrace(2) request, and enabled via 'savecore' extension.
Protocol-wise, a new qSaveCore packet is introduced. It accepts zero or more semicolon-separated key:value options, invokes the core dump and returns a key:value response. Currently the only option supported is "path-hint", and the return value contains the "path" actually used. The support for the feature is exposed via qSaveCore qSupported feature.
Differential Revision: https://reviews.llvm.org/D101285
show more ...
|
Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4 |
|
#
7d27230d |
| 31-Mar-2021 |
David Spickett <david.spickett@linaro.org> |
[lldb][AArch64] Add memory tag writing to lldb-server
This is implemented using the QMemTags packet, as specified by GDB in: https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.h
[lldb][AArch64] Add memory tag writing to lldb-server
This is implemented using the QMemTags packet, as specified by GDB in: https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html#General-Query-Packets
(recall that qMemTags was previously added to read tags)
On receipt of a valid packet lldb-server will: * align the given address and length to granules (most of the time lldb will have already done this but the specification doesn't guarantee it) * Repeat the supplied tags as many times as needed to cover the range. (if tags > range we just use as many as needed) * Call ptrace POKEMTETAGS to write the tags.
The ptrace step will loop just like the tag read does, until all tags are written or we get an error. Meaning that if ptrace succeeds it could be a partial write. So we call it again and if we then get an error, return an error to lldb.
We are not going to attempt to restore tags after a partial write followed by an error. This matches the behaviour of the existing memory writes.
The lldb-server tests have been extended to include read and write in the same test file. With some updated function names since "qMemTags" vs "QMemTags" isn't very clear when they're next to each other.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D105180
show more ...
|
Revision tags: llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2 |
|
#
da2e614f |
| 19-Feb-2021 |
David Spickett <david.spickett@linaro.org> |
[lldb][AArch64] Add memory tag reading to lldb-server
This adds memory tag reading using the new "qMemTags" packet and ptrace on AArch64 Linux.
This new packet is following the one used by GDB. (ht
[lldb][AArch64] Add memory tag reading to lldb-server
This adds memory tag reading using the new "qMemTags" packet and ptrace on AArch64 Linux.
This new packet is following the one used by GDB. (https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html)
On AArch64 Linux we use ptrace's PEEKMTETAGS to read tags and we assume that lldb has already checked that the memory region actually has tagging enabled.
We do not assume that lldb has expanded the requested range to granules and expand it again to be sure. (although lldb will be sending aligned ranges because it happens to need them client side anyway) Also we don't assume untagged addresses. So for AArch64 we'll remove the top byte before using them. (the top byte includes MTE and other non address data)
To do the ptrace read NativeProcessLinux will ask the native register context for a memory tag manager based on the type in the packet. This also gives you the ptrace numbers you need. (it's called a register context but it also has non register data, so it saves adding another per platform sub class)
The only supported platform for this is AArch64 Linux and the only supported tag type is MTE allocation tags. Anything else will error.
Ptrace can return a partial result but for lldb-server we will be treating that as an error. To succeed we need to get all the tags we expect.
(Note that the protocol leaves room for logical tags to be read via qMemTags but this is not going to be implemented for lldb at this time.)
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D95601
show more ...
|
#
76e47d48 |
| 26-May-2021 |
Raphael Isemann <teemperor@gmail.com> |
[lldb][NFC] Use C++ versions of the deprecated C standard library headers
The C headers are deprecated so as requested in D102845, this is replacing them all with their (not deprecated) C++ equivale
[lldb][NFC] Use C++ versions of the deprecated C standard library headers
The C headers are deprecated so as requested in D102845, this is replacing them all with their (not deprecated) C++ equivalent.
Reviewed By: shafik
Differential Revision: https://reviews.llvm.org/D103084
show more ...
|
#
bbae0c1f |
| 13-Apr-2021 |
Michał Górny <mgorny@moritz.systems> |
[lldb] [llgs] Support owning and detaching extra processes
Add a NativeDelegate API to pass new processes (forks) to LLGS, and support detaching them via the 'D' packet. A 'D' packet without a spec
[lldb] [llgs] Support owning and detaching extra processes
Add a NativeDelegate API to pass new processes (forks) to LLGS, and support detaching them via the 'D' packet. A 'D' packet without a specific PID detaches all processes, otherwise it detaches either the specified subprocess or the main process, depending on the passed PID.
Differential Revision: https://reviews.llvm.org/D100191
show more ...
|
Revision tags: llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1 |
|
#
0b697561 |
| 09-Nov-2020 |
Walter Erquinigo <a20012251@gmail.com> |
[trace][intel-pt] Implement trace start and trace stop
This implements the interactive trace start and stop methods.
This diff ended up being much larger than I anticipated because, by doing it, I
[trace][intel-pt] Implement trace start and trace stop
This implements the interactive trace start and stop methods.
This diff ended up being much larger than I anticipated because, by doing it, I found that I had implemented in the beginning many things in a non optimal way. In any case, the code is much better now.
There's a lot of boilerplate code due to the gdb-remote protocol, but the main changes are:
- New tracing packets: jLLDBTraceStop, jLLDBTraceStart, jLLDBTraceGetBinaryData. The gdb-remote packet definitions are quite comprehensive. - Implementation of the "process trace start|stop" and "thread trace start|stop" commands. - Implementaiton of an API in Trace.h to interact with live traces. - Created an IntelPTDecoder for live threads, that use the debugger's stop id as checkpoint for its internal cache. - Added a functionality to stop the process in case "process tracing" is enabled and a new thread can't traced. - Added tests
I have some ideas to unify the code paths for post mortem and live threads, but I'll do that in another diff.
Differential Revision: https://reviews.llvm.org/D91679
show more ...
|
#
6c1a8039 |
| 30-Mar-2021 |
Michał Górny <mgorny@moritz.systems> |
[lldb] [server] Support for multiprocess extension
Add a minimal support for the multiprocess extension in lldb-server. The server indicates support for it via qSupported, and accepts thread-ids con
[lldb] [server] Support for multiprocess extension
Add a minimal support for the multiprocess extension in lldb-server. The server indicates support for it via qSupported, and accepts thread-ids containing a PID. However, it still does not support debugging more than one inferior, so any other PID value results in an error.
Differential Revision: https://reviews.llvm.org/D98482
show more ...
|
#
21555fff |
| 29-Oct-2020 |
Walter Erquinigo <a20012251@gmail.com> |
[intel-pt][trace] Implement a "get supported trace type" packet
Depends on D89283.
The goal of this packet (jTraceGetSupportedType) is to be able to query the gdb-server for the tracing technology
[intel-pt][trace] Implement a "get supported trace type" packet
Depends on D89283.
The goal of this packet (jTraceGetSupportedType) is to be able to query the gdb-server for the tracing technology that can work for the current debuggeer, which can make the user experience simpler but allowing the user to simply type
thread trace start
to start tracing the current thread without even telling the debugger to use "intel-pt", for example. Similarly, `thread trace start [args...]` would accept args beloging to the working trace type.
Also, if the user typed
help thread trace start
We could directly show the help information of the trace type that is supported for the target, or mention instead that no tracing is supported, if that's the case.
I added some simple tests, besides, when I ran this on my machine with intel-pt support, I got
$ process plugin packet send "jTraceSupportedType" packet: jTraceSupportedType response: {"description":"Intel Processor Trace","pluginName":"intel-pt"}
On a machine without intel-pt support, I got
$ process plugin packet send "jTraceSupportedType" packet: jTraceSupportedType response: E00;
Reviewed By: clayborg, labath
Differential Revision: https://reviews.llvm.org/D90490
show more ...
|
Revision tags: llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3 |
|
#
3cd8d7b1 |
| 24-Aug-2020 |
Gongyu Deng <gy_deng@icloud.com> |
[lldb] Remote disk file/directory completion for platform commands
1. Extended the gdb-remote communication related classes with disk file/directory completion functions; 2. Added two common comp
[lldb] Remote disk file/directory completion for platform commands
1. Extended the gdb-remote communication related classes with disk file/directory completion functions; 2. Added two common completion functions RemoteDiskFiles and RemoteDiskDirectories based on the functions above; 3. Added completion for these commands: A. platform get-file <remote-file> <local-file>; B. platform put-file <local-file> <remote-file>; C. platform get-size <remote-file>; D. platform settings -w <remote-dir>; E. platform open file <remote-file>. 4. Added related tests for client and server; 5. Updated docs/lldb-platform-packets.txt.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D85284
show more ...
|
Revision tags: llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1 |
|
#
80814287 |
| 24-Jan-2020 |
Raphael Isemann <teemperor@gmail.com> |
[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary: A *.cpp file header in LLDB (and in LLDB) should like this: ``` //===-- TestUtilities.cpp ----------------------------------------
[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary: A *.cpp file header in LLDB (and in LLDB) should like this: ``` //===-- TestUtilities.cpp -------------------------------------------------===// ``` However in LLDB most of our source files have arbitrary changes to this format and these changes are spreading through LLDB as folks usually just use the existing source files as templates for their new files (most notably the unnecessary editor language indicator `-*- C++ -*-` is spreading and in every review someone is pointing out that this is wrong, resulting in people pointing out that this is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators, all the different missing/additional '-' characters, files that center the file name, missing trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
show more ...
|
Revision tags: llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1, llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2, llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2 |
|
#
57e2da4f |
| 10-Jun-2019 |
Antonio Afonso <antonio.afonso@gmail.com> |
Create a generic handler for Xfer packets
Summary: This is the first of a few patches I have to improve the performance of dynamic module loading on Android.
In this first diff I'll describe the co
Create a generic handler for Xfer packets
Summary: This is the first of a few patches I have to improve the performance of dynamic module loading on Android.
In this first diff I'll describe the context of my main motivation and will then link to it in the other diffs to avoid repeating myself.
## Motivation I have a few scenarios where opening a specific feature on an Android app takes around 40s when lldb is attached to it. The reason for that is because 40 modules are dynamicly loaded at that point in time and each one of them is taking ~1s.
## The problem To learn about new modules we have a breakpoint on a linker function that is called twice whenever a module is loaded. One time just before it's loaded (so lldb can check which modules are loaded) and another right after it's loaded (so lldb can check again which ones are loaded and calculate the diference). It's figuring out which modules are loaded that is taking quite some time. This is currently done by traversing the linked list of loaded shared libraries that the linker maintains in memory. Each item in the linked list requires its own `x` packet sent to the gdb server (this is android so the network also plays a part). In my scenario there are 400+ loaded libraries and even though we read 0x800 worth of bytes at a time we still make ~180 requests that end up taking 150-200ms. We also do this twice, once before the module is loaded (state = eAdd) and another right after (state = eConsistent) which easly adds up to ~400ms per module.
## A solution
**Implement `xfer:libraries-svr4` in lldb-server:** I noticed in the code that loads the new modules that it had support for the `xfer:libraries-svr4` packet (added ~4 years ago to support the ds2 debug server) but we didn't support it in lldb-server. This single packet returns an xml list of all the loaded modules by the process. The advantage is that there's no more need to make 180 requests to read the linked list. Additionally this new requests takes around 10ms.
**More efficient usage of the `xfer:libraries-svr4` packet in lldb:** When `xfer:libraries-svr4` is available the Process class has a `LoadModules` function that requests this packet and then loads or unloads modules based on the current list of loaded modules by the process. This is the function that is used by the DYLDRendezvous class to get the list of loaded modules before and after the module is loaded. However, this is really not needed since the LoadModules function already loaded or unloaded the modules accordingly. I changed this strategy to call LoadModules only once (after the process has loaded the module).
**Bugs** I found a few issues in lldb while implementing this and have submitted independent patches for them.
I tried to devide this into multiple logical patches to make it easier to review and discuss.
## Tests
I wanted to put these set of diffs up before having all the tests up and running to start having them reviewed from a techical point of view. I'm also having some trouble making the tests running on linux so I need more time to make that happen.
# This diff
The `xfer` packages follow the same protocol, they are requested with `xfer:<object>:<read|write>:<annex>:<offset,length>` and a return that starts with `l` or `m` depending if the offset and length covers the entire data or not. Before implementing the `xfer:libraries-svr4` I refactored the `xfer:auxv` to generically handle xfer packets so we can easly add new ones.
The overall structure of the function ends up being: * Parse the packet into its components: object, offset etc. * Depending on the object do its own logic to generate the data. * Return the data based on its size, the requested offset and length.
Reviewers: clayborg, xiaobai, labath
Reviewed By: labath
Subscribers: mgorny, krytarowski, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D62499
llvm-svn: 362982
show more ...
|
#
f04b3635 |
| 30-May-2019 |
Pavel Labath <pavel@labath.sk> |
[lldb-server] Support 'g' packets
Differential Revision: https://reviews.llvm.org/D62221 Patch by Guilherme Andrade <guiandrade@google.com>.
llvm-svn: 362063
|