summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
Commit message (Collapse)AuthorAgeFilesLines
...
* [Reproducers] Fix GDB remote flakiness during replayJonas Devlieghere2019-03-221-24/+23
| | | | | | | | | | | | | | | | | | | | | | This fixes the flakiness of the GDB remote reproducer during replay. It was caused by a combination sending one ACK to many from the replay server and the code that "flushes" any queued GDB remote packets in GDBRemoteCommunicationClient::HandshakeWithServer. The spurious ACK was the result of combining both implicit and explicit handling of ACKs in the replay server. The handshake consists of an ACK followed by an QStartNoAckMode. As long as we haven't seen any QStartNoAckMode, we were sending implicit acknowledgments. So the first ACK got acknowledged twice, once implicitly, and once as part of the replay. The reason we didn't notice this was the code in HandshakeWithServer that "waits for any responses that might have been queued up in the remote GDB server and flush them all". A 10ms timeout is used to move on when no packets are left. If the second ACK didn't make it within those 10ms, all packets were offset by one. llvm-svn: 356825
* [Reproducers] Fix log statementsJonas Devlieghere2019-03-211-3/+3
| | | | | | This isn't python where you can omit the index inside `{}`. llvm-svn: 356725
* [Reproducers] Properly handle QEnvironment packetsJonas Devlieghere2019-03-211-0/+15
| | | | | | | | On Linux, a QEnvironment packet is sent for every environment variable. This breaks replay when the number of environment variables is different then during capture. The solution is to always reply with OK. llvm-svn: 356643
* [Reproducers] Log inconsistencies during replay (NFC)Jonas Devlieghere2019-03-212-5/+41
| | | | | | | | Make debugging of the GDB remote packet aspect of reproducers easier by logging both requests and replies. This enables some sanity checking during replay. llvm-svn: 356638
* [Reproducers] Fix data race found by tsanJonas Devlieghere2019-03-141-0/+2
| | | | | | | | This fixes a data race uncovered by tsan during destruction of the GDBRemoteReplay server. The solution is to lock the thread state mutex when receiving packets. llvm-svn: 356168
* Add XCOFF triple object format type for AIXJason Liu2019-03-121-0/+2
| | | | | | | | | This patch adds an XCOFF triple object format type into LLVM. This XCOFF triple object file type will be used later by object file and assembly generation for the AIX platform. Differential Revision: https://reviews.llvm.org/D58930 llvm-svn: 355989
* [Reproducers] Add a test to ensure we can reuse the reproducer dir.Jonas Devlieghere2019-03-121-1/+1
| | | | | | | | Yesterday I noticed a reproducer test failing after making a local change. Removing the reproducer directory solved the issue. Add a test case that detects this. llvm-svn: 355941
* Bring Doxygen comment syntax in sync with LLVM coding style.Adrian Prantl2019-03-114-27/+27
| | | | | | This changes '@' prefix to '\'. llvm-svn: 355841
* Promote more debug-only assertions to regular assertions.Adrian Prantl2019-03-071-4/+0
| | | | llvm-svn: 355568
* Pass ConstString by value (NFC)Adrian Prantl2019-03-064-4/+4
| | | | | | | | | | | | | | | | | My apologies for the large patch. With the exception of ConstString.h itself it was entirely produced by sed. ConstString has exactly one const char * data member, so passing a ConstString by reference is not any more efficient than copying it by value. In both cases a single pointer is passed. But passing it by value makes it harder to accidentally return the address of a local object. (This fixes rdar://problem/48640859 for the Apple folks) Differential Revision: https://reviews.llvm.org/D59030 llvm-svn: 355553
* Resubmit "Don't include UnixSignals.h from Host."Zachary Turner2019-03-061-1/+1
| | | | | | | | This was reverted because it breaks the GreenDragon bot, but the reason for the breakage is lost, so I'm resubmitting this now so we can find out what the problem is. llvm-svn: 355528
* Refactor user/group name resolving codePavel Labath2019-03-041-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This creates an abstract base class called "UserIDResolver", which can be implemented to provide user/group ID resolution capabilities for various objects. Posix host implement a PosixUserIDResolver, which does that using posix apis (getpwuid and friends). PlatformGDBRemote forwards queries over the gdb-remote link, etc. ProcessInstanceInfo class is refactored to make use of this interface instead of taking a platform pointer as an argument. The base resolver class already implements caching and thread-safety, so implementations don't have to worry about that. The main motivating factor for this was to remove external dependencies from the ProcessInstanceInfo class (so it can be put next to ProcessLaunchInfo and friends), but it has other benefits too: - ability to test the user name caching code - ability to test ProcessInstanceInfo dumping code - consistent interface for user/group resolution between Platform and Host classes. Reviewers: zturner, clayborg, jingham Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D58167 llvm-svn: 355323
* [lldb] [Process/gdb-remote] Use '127.0.0.1' in ConnectLocally()Michal Gorny2019-03-031-1/+1
| | | | | | | | | | | | | | | | Use '127.0.0.1' instead of 'localhost' in ConnectLocally() function as this is the specific address the server is bound to. Using 'localhost' may involve trying IPv6 first which may accidentally be used by another service. While technically it might be interesting to support IPv6 here, it would need to be supported properly, with the connection copying family and address from the listening socket, and possibly without relying on existence of 'localhost' at all. Differential Revision: https://reviews.llvm.org/D58883 llvm-svn: 355285
* Move Host/Symbols.cpp to Symbols/LocateSymbolFile.cppZachary Turner2019-02-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Given that we have a target named Symbols, one wonders why a file named Symbols.cpp is not in this target. To be clear, the functions exposed from this file are really focused on *locating* a symbol file on a given host, which is where the ambiguity comes in. However, it makes more sense conceptually to be in the Symbols target. While some of the specific places to search for symbol files might change depending on the Host, this is not inherently true in the same way that, for example, "accessing the file system" or "starting threads" is fundamentally dependent on the Host. PDBs, for example, recently became a reality on non-Windows platforms, and it's theoretically possible that DSYMs could become a thing on non MacOSX platforms (maybe in a remote debugging scenario). Other types of symbol files, such as DWO, DWP, etc have never been tied to any Host platform anyway. After this patch, there is only one remaining dependency from Host to Target. Differential Revision: https://reviews.llvm.org/D58730 llvm-svn: 355032
* Return better error message from GDBRemoteCommunication::ConnectLocallyPavel Labath2019-02-181-3/+4
| | | | llvm-svn: 354256
* Revert "Don't include UnixSignals.h from Host."Davide Italiano2019-02-151-1/+1
| | | | | | It broke the modules green dragon buildbot. llvm-svn: 354177
* Don't include UnixSignals.h from Host.Zachary Turner2019-02-151-1/+1
| | | | | | | | | | | | | | | | | Host had a function to get the UnixSignals instance corresponding to the current host architecture. This means that Host had to include a file from Target. To break this dependency, just make this a static function directly in UnixSignals. We already have the function UnixSignals::Create(ArchSpec) anyway, so we just need to have UnixSignals::CreateForHost() which determines which value to pass for the ArchSpec. The goal here is to eventually break the Host->Target->Host circular dependency. Differential Revision: https://reviews.llvm.org/D57780 llvm-svn: 354168
* [gdb-remote] Sanity check platform pointerAaron Smith2019-02-141-2/+5
| | | | llvm-svn: 354012
* Replace 'ap' with 'up' suffix in variable names. (NFC)Jonas Devlieghere2019-02-131-7/+7
| | | | | | | | | | | | | | | | | The `ap` suffix is a remnant of lldb's former use of auto pointers, before they got deprecated. Although all their uses were replaced by unique pointers, some variables still carried the suffix. In r353795 I removed another auto_ptr remnant, namely redundant calls to ::get for unique_pointers. Jim justly noted that this is a good opportunity to clean up the variable names as well. I went over all the changes to ensure my find-and-replace didn't have any undesired side-effects. I hope I didn't miss any, but if you end up at this commit doing a git blame on a weirdly named variable, please know that the change was unintentional. llvm-svn: 353912
* Have Stream::PutCStringAsRawHex8 take llvm::StringRefPavel Labath2019-02-126-42/+42
| | | | | | | | | This enables the function to be called with a StringRef without jumping through any hoops. I rename the function to "PutStringAsRawHex8" to honor the extended interface. I also remove ".c_str()" from any calls to this function I could find. llvm-svn: 353841
* Remove redundant ::get() for smart pointer. (NFC)Jonas Devlieghere2019-02-121-1/+1
| | | | | | | | This commit removes redundant calls to smart pointer’s ::get() method. https://clang.llvm.org/extra/clang-tidy/checks/readability-redundant-smartptr-get.html llvm-svn: 353795
* Use std::make_shared in LLDB (NFC)Jonas Devlieghere2019-02-113-14/+19
| | | | | | | | | | | Unlike std::make_unique, which is only available since C++14, std::make_shared is available since C++11. Not only is std::make_shared a lot more readable compared to ::reset(new), it also performs a single heap allocation for the object and control block. Differential revision: https://reviews.llvm.org/D57990 llvm-svn: 353764
* [lldb-server] Improve support on WindowsAaron Smith2019-02-071-33/+28
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit contains the following changes: - Rewrite vfile close/read/write packet handlers with portable routines from lldb. This removes #if(s) and allows the handlers to work on Windows. - Fix a bug in File::Write. This is intended to write data at an offset to a file but actually writes at the current position of the file. - Add a default boolean argument 'should_close_fd' to FileSystem::Open to let the user decide whether to close the fd or not. Reviewers: zturner, llvm-commits, labath Reviewed By: zturner Subscribers: Hui, labath, abidh, lldb-commits Differential Revision: https://reviews.llvm.org/D56231 llvm-svn: 353446
* [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenvAaron Smith2019-02-071-39/+38
| | | | | | | | | | | | Reviewers: zturner, llvm-commits, labath, serge-sans-paille Reviewed By: labath Subscribers: Hui, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56230 llvm-svn: 353440
* Add a warning to GDBRemoteRegisterContext (if packet logging enabled)Jason Molenda2019-02-061-0/+8
| | | | | | | if the size of the g packet response was smaller than expected and is going to be ignored. llvm-svn: 353269
* Move FileAction, ProcessInfo and ProcessLaunchInfo from Target to HostPavel Labath2019-02-043-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: These classes describe the details of the process we are about to launch, and so they are naturally used by the launching code in the Host module. Previously they were present in Target because that is the most important (but by far not the only) user of the launching code. Since the launching code has other customers, must of which do not care about Targets, it makes sense to move these classes to the Host layer, next to the launching code. This move reduces the number of times that Target is included from host to 8 (it used to be 14). Reviewers: zturner, clayborg, jingham, davide, teemperor Subscribers: emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D56602 llvm-svn: 353047
* Fix some warnings in building LLDB.Zachary Turner2019-01-291-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D57413 llvm-svn: 352557
* Refactor HAVE_LIBCOMPRESSION and related code in GDBRemoteCommunicationRaphael Isemann2019-01-252-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The field `m_decompression_scratch_type` is only used when `HAVE_LIBCOMPRESSION` is defined, which caused a warning which I fixed in rLLDB350675 by just marking the variable as always used. This patch fixes this in a better way by only defining the variable (and the related `m_decompression_scratch` variable) when `HAVE_LIBCOMPRESSION` is defined. This also required changing the way we handle `HAVE_LIBCOMPRESSION` works, as this was previously always defined on macOS within the source file but not in the header. Now it's always defined from within our config header when CMake defines it or when we are on macOS. The field initialization was moved to the header to prevent that we have `#ifdef` within our initializer list. Reviewers: #lldb, jasonmolenda, sgraenitz, labath Reviewed By: labath Subscribers: labath, beanz, mgorny, lldb-commits, dblaikie Differential Revision: https://reviews.llvm.org/D57011 llvm-svn: 352175
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1926-104/+78
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [Reproducers] Refactor reproducer infoJonas Devlieghere2019-01-181-13/+14
| | | | | | | | | | | | | | | | | | | | | In the original reproducer design, I expected providers to be more dynamic than they turned out. For example, we don't have any instances where one provider has multiple files. Additionally, I expected there to be less locality between capture and replay, with the provider being defined in one place and the replay code to live in another. Both contributed to the design of the provider info. This patch refactors the reproducer info to be something static. This means less magic strings and better type checking. The new design still allows for the capture and replay code to live in different places as long as they both have access to the new statically defined info class. I didn't completely get rid of the index, because it is useful for (1) sanity checking and (2) knowing what files are used by the reproducer. Differential revision: https://reviews.llvm.org/D56814 llvm-svn: 351501
* [lldb-server] Add unnamed pipe support to PipeWindowsAaron Smith2019-01-102-7/+3
| | | | | | | | | | | | | | | | | Summary: This adds unnamed pipe support in PipeWindows to support communication between a debug server and child process. Modify PipeWindows::CreateNew to support the creation of an unnamed pipe. Rename the previous method that created a named pipe to PipeWindows::CreateNewNamed. Reviewers: zturner, llvm-commits Reviewed By: zturner Subscribers: Hui, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56234 llvm-svn: 350784
* Fix unused private field warning.Raphael Isemann2019-01-081-2/+3
| | | | | | | | | | Summary: The member is private and unused if HAVE_LIBCOMPRESSION is undefined, which triggers Clang's -Wunused-private-field warning. Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D56458 llvm-svn: 350675
* ProcessLaunchInfo: Remove Target referencePavel Labath2019-01-081-2/+4
| | | | | | | | | | | | | | | | | | | | | Summary: The target was being used in FinalizeFileActions to provide default values for stdin/out/err. Also, most of the logic of this function was very specific to how the lldb's Target class wants to launch processes, so I, move it to Target::FinalizeFileActions, inverting the dependency. The only piece of logic that was useful elsewhere (lldb-server) was the part which sets up a pty and relevant file actions. I've kept this part as ProcessLaunchInfo::SetUpPtyRedirection. This makes ProcessLaunchInfo independent of any high-level lldb constructs. Reviewers: zturner, jingham, teemperor Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D56196 llvm-svn: 350617
* [NFC] Replace `compare` with (in)equality operator where applicable.Jonas Devlieghere2018-12-211-6/+6
| | | | | | | | Using compare is verbose, bug prone and potentially inefficient (because of early termination). Replace relevant call sites with the (in)equality operator. llvm-svn: 349972
* Don't forget to free the libcompression scratch buffer in the dtor.Jason Molenda2018-12-181-0/+3
| | | | llvm-svn: 349580
* Force libcompression calls to be enabled when building on DarwinJason Molenda2018-12-183-14/+37
| | | | | | | | | | | | | | | | systems. It has been available in the OS over over three years now. If lldb doesn't link against -lcompression, it should be an error. Allocate a scratch buffer for libcompression to use when decoding packets, instead of it having to allocate & free one on every call. Fix a typeo with the size of the buffer that compression_decode_buffer() is expanding into. <rdar://problem/41601084> llvm-svn: 349563
* Simplify Boolean expressionsJonas Devlieghere2018-12-156-34/+23
| | | | | | | | | | | This patch simplifies boolean expressions acorss LLDB. It was generated using clang-tidy with the following command: run-clang-tidy.py -checks='-*,readability-simplify-boolean-expr' -format -fix $PWD Differential revision: https://reviews.llvm.org/D55584 llvm-svn: 349215
* Move Broadcaster+Listener+Event combo from Core into UtilityPavel Labath2018-12-144-5/+5
| | | | | | | | | | | | | | | | | | Summary: These are general purpose "utility" classes, whose functionality is not debugger-specific in any way. As such, I believe they belong in the Utility module. This doesn't break any particular dependency (yet), but it reduces the number of Core dependencies across the board. Reviewers: zturner, jingham, teemperor, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D55361 llvm-svn: 349157
* Do not use PATH_MAX with SmallStringStella Stamenova2018-12-102-3/+3
| | | | | | | | | | | | | | Summary: Instead use a more reasonable value to start and rely on the fact that SmallString will resize if necessary. Reviewers: labath, asmith Reviewed By: labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D55457 llvm-svn: 348775
* gdb-remote: use elaborated type specifier for `Module`Saleem Abdulrasool2018-12-051-2/+2
| | | | | | | | When building with MSVC, the type `Module` is ambiguous due to both the lldb_private and llvm namespaces being used. Use the elaborated type instead to resolve the ambiguity. llvm-svn: 348332
* [Reproducers] Improve reproducer API and add unit tests.Jonas Devlieghere2018-11-271-7/+11
| | | | | | | | | | | | | | | | | | | When I landed the initial reproducer framework I knew there were some things that needed improvement. Rather than bundling it with a patch that adds more functionality I split it off into this patch. I also think the API is stable enough to add unit testing, which is included in this patch as well. Other improvements include: - Refactor how we initialize the loader and generator. - Improve naming consistency: capture and replay seems the least ambiguous. - Index providers by name and make sure there's only one of each. - Add convenience methods for creating and accessing providers. Differential revision: https://reviews.llvm.org/D54616 llvm-svn: 347716
* Fix some compilation failures introduced in recent patches.Zachary Turner2018-11-141-3/+3
| | | | | | | | | | This fixes two compilation failures: 1) Designated initializers are C++20. We can't use them in LLVM. 2) thread_result_t is not a pointer type on all platforms, so returning nullptr is an error. llvm-svn: 346873
* Fix the "make_unique is ambiguous" compiler error.Haojian Wu2018-11-141-2/+2
| | | | llvm-svn: 346839
* Add GDB remote packet reproducer.Jonas Devlieghere2018-11-139-183/+775
| | | | llvm-svn: 346780
* Remove header grouping comments.Jonas Devlieghere2018-11-1118-66/+0
| | | | | | | | This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
* Remove comments after header includes.Jonas Devlieghere2018-11-111-1/+1
| | | | | | | | | | This patch removes the comments following the header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. Differential revision: https://reviews.llvm.org/D54385 llvm-svn: 346625
* Work with a gdb-remote target that doesn't handle theJason Molenda2018-11-091-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | qWatchpointSupportInfo packet correctly. In GDBRemoteCommunicationClient::GetWatchpointSupportInfo, if the response to qWatchpointSupportInfo does not include the 'num' field, then we did not get an answer we understood, mark this target as not supporting that packet. In Target.cpp, rename the very confusingly named CheckIfWatchpointsExhausted to CheckIfWatchpointsSupported, and check the error status returned by Process::GetWatchpointSupportInfo. If we cannot determine what the number of supported watchpoints are, assume that they will work. We'll handle the failure later when we try to create/enable the watchpoint if the Z2 packet isn't supported. Add a gdb_remote_client test case. <rdar://problem/42621432> llvm-svn: 346561
* [FileSystem] Open File instances through the FileSystem.Jonas Devlieghere2018-11-021-2/+3
| | | | | | | | | | | This patch modifies how we open File instances in LLDB. Rather than passing a path or FileSpec to the constructor, we now go through the virtual file system. This is needed in order to make things work with the VFS in the future. Differential revision: https://reviews.llvm.org/D54020 llvm-svn: 346049
* [File] Remove static method to get permissions.Jonas Devlieghere2018-11-011-4/+4
| | | | | | | This patch removes the static accessor in File to get a file's permissions. Permissions should be checked through the FileSystem class. llvm-svn: 345901
* [FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere2018-11-016-29/+41
| | | | | | | | | This patch removes the logic for resolving paths out of FileSpec and updates call sites to rely on the FileSystem class instead. Differential revision: https://reviews.llvm.org/D53915 llvm-svn: 345890
OpenPOWER on IntegriCloud