summaryrefslogtreecommitdiff
path: root/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
AgeCommit message (Collapse)Author
2019-09-13[Reproducer] Move GDB Remote Packet into Utility. (NFC)Jonas Devlieghere
To support dumping the reproducer's GDB remote packets, we need the (de)serialization logic to live in Utility rather than the GDB remote plugin. This patch renames StreamGDBRemote to GDBRemote and moves the relevant packet code there. Its uses in the GDBRemoteCommunicationHistory and the GDBRemoteCommunicationReplayServer are updated as well. Differential revision: https://reviews.llvm.org/D67523 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@371907 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-21[NFC] Return llvm::StringRef from StringExtractor::GetStringRef.Jonas Devlieghere
This patch removes the two variant of StringExtractor::GetStringRef that return (non-)const references to std::string. The non-const one was being abused to reinitialize the StringExtractor and its uses are replaced by calls to the copy asignment operator. The const variant was refactored to return an actual llvm::StringRef. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@369493 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-20[lldb] D66174 `RegularExpression` cleanupJan Kratochvil
I find as a good cleanup to drop the Compile method. As I do not find TIMTOWTDI as an advantage and there is already constructor parameter to compile the regex. Differential Revision: https://reviews.llvm.org/D66392 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@369352 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-13Enable lldb-server on WindowsAaron Smith
Summary: This commit contains three small changes to enable lldb-server on Windows. - Add lldb-server for Windows to the build - Disable pty redirection on Windows for the initial lldb-server bring up - Add a support to get the parent pid for a process on Windows - Ifdef some signals which aren't supported on Windows Thanks to Hui Huang for the help with this patch! Reviewers: labath Reviewed By: labath Subscribers: JDevlieghere, compnerd, Hui, amccarth, xiaobai, srhines, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D61686 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@368774 91177308-0d34-0410-b5e6-96231b3b80d8
2019-08-08[lldb] Fix HAVE_LIBCOMPRESSIONHaibo Huang
Summary: This test doesn't make sense. Change to be consistent with what we did in GDBRemoteCommunication.cpp. Reviewers: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65965 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@368352 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-24[Logging] Replace Log::Printf with LLDB_LOG macro (NFC)Jonas Devlieghere
This patch replaces explicit calls to log::Printf with the new LLDB_LOGF macro. The macro is similar to LLDB_LOG but supports printf-style format strings, instead of formatv-style format strings. So instead of writing: if (log) log->Printf("%s\n", str); You'd write: LLDB_LOG(log, "%s\n", str); This change was done mechanically with the command below. I replaced the spurious if-checks with vim, since I know how to do multi-line replacements with it. find . -type f -name '*.cpp' -exec \ sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" + Differential revision: https://reviews.llvm.org/D65128 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@366936 91177308-0d34-0410-b5e6-96231b3b80d8
2019-07-05Change LaunchThread interface to return an expected.Jonas Devlieghere
Change the interface to return an expected, instead of taking a Status pointer. Differential revision: https://reviews.llvm.org/D64163 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@365226 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-23[gdb-remote] Fix more issues with thread_result_tJonas Devlieghere
More fixes needed to un-break the Windows bot. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@361539 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-23[lldb] NFC modernize codebase with modernize-use-nullptrKonrad Kleine
Summary: NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]] This commit is the result of modernizing the LLDB codebase by using `nullptr` instread of `0` or `NULL`. See https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html for more information. This is the command I ran and I to fix and format the code base: ``` run-clang-tidy.py \ -header-filter='.*' \ -checks='-*,modernize-use-nullptr' \ -fix ~/dev/llvm-project/lldb/.* \ -format \ -style LLVM \ -p ~/llvm-builds/debug-ninja-gcc ``` NOTE: There were also changes to `llvm/utils/unittest` but I did not include them because I felt that maybe this library shall be updated in isolation somehow. NOTE: I know this is a rather large commit but it is a nobrainer in most parts. Reviewers: martong, espindola, shafik, #lldb, JDevlieghere Reviewed By: JDevlieghere Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits Tags: #lldb, #llvm Differential Revision: https://reviews.llvm.org/D61847 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@361484 91177308-0d34-0410-b5e6-96231b3b80d8
2019-05-02gdb-remote: reduce some inclusion of Target/Process.hSaleem Abdulrasool
Reduce the inclusion of Target/Process.h to help isolate why Process is being preserved during the build of `lldb-server`. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@359811 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-10[NFC] Remove ASCII lines from commentsJonas Devlieghere
A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@358135 91177308-0d34-0410-b5e6-96231b3b80d8
2019-03-03[lldb] [Process/gdb-remote] Use '127.0.0.1' in ConnectLocally()Michal Gorny
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@355285 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-18Return better error message from GDBRemoteCommunication::ConnectLocallyPavel Labath
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@354256 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-14[gdb-remote] Sanity check platform pointerAaron Smith
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@354012 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-07[gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenvAaron Smith
Reviewers: zturner, llvm-commits, labath, serge-sans-paille Reviewed By: labath Subscribers: Hui, labath, lldb-commits Differential Revision: https://reviews.llvm.org/D56230 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@353440 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-29Fix some warnings in building LLDB.Zachary Turner
Differential Revision: https://reviews.llvm.org/D57413 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@352557 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-25Refactor HAVE_LIBCOMPRESSION and related code in GDBRemoteCommunicationRaphael Isemann
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@352175 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
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. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-10[lldb-server] Add unnamed pipe support to PipeWindowsAaron Smith
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@350784 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-08Fix unused private field warning.Raphael Isemann
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@350675 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18Don't forget to free the libcompression scratch buffer in the dtor.Jason Molenda
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@349580 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-18Force libcompression calls to be enabled when building on DarwinJason Molenda
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> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@349563 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-15Simplify Boolean expressionsJonas Devlieghere
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@349215 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-10Do not use PATH_MAX with SmallStringStella Stamenova
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@348775 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-13Add GDB remote packet reproducer.Jonas Devlieghere
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@346780 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-11Remove header grouping comments.Jonas Devlieghere
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. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@346626 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-01[FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@345890 91177308-0d34-0410-b5e6-96231b3b80d8
2018-11-01[FileSystem] Remove Exists() from FileSpecJonas Devlieghere
This patch removes the Exists method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53845 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@345854 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-19Replace HostInfo::GetLLDBPath with specific functionsPavel Labath
Summary: Instead of a function taking an enum value determining which path to return, we now have a suite of functions, each returning a single path kind. This makes it easy to move the python-path function into a specific plugin in a follow-up commit. All the users of GetLLDBPath were converted to call specific functions instead. Most of them were hard-coding the enum value anyway, so this conversion was simple. The only exception was SBHostOS, which I've changed to use a switch on the incoming enum value. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D48272 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@335052 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13[FileSpec] Make style argument mandatory for SetFile. NFCJonas Devlieghere
SetFile has an optional style argument which defaulted to the native style. This patch makes that argument mandatory so clients of the FileSpec class are forced to think about the correct syntax. At the same time this introduces a (protected) convenience method to update the file from within the FileSpec class that keeps the current style. These two changes together prevent a potential pitfall where the style might be forgotten, leading to the path being updated and the style unintentionally being changed to the host style. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@334663 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-09Modernize and clean-up the Predicate classPavel Labath
Summary: The comments on this class were out of date with the implementation, and the implementation itself was inconsistent with our usage of the Timeout class (I started converting everything to use this class back in D27136, but I missed this one). I avoid duplicating the waiting logic by introducing a templated WaitFor function, and make other functions delegate to that. This function can be also used as a replacement for the unused WaitForBitToBeSet functions I removed, if it turns out to be necessary. As this changes the meaning of a "zero" timeout, I tracked down all the callers of these functions and updated them accordingly. Propagating the changes to all the callers of RunShellCommand was a bit too much for this patch, so I stopped there and will continue that in a follow-up patch. I also add some basic unittests for the functions I modified. Reviewers: jingham, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D46580 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@331880 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-30Reflow paragraphs in comments.Adrian Prantl
This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@331197 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-28gdb-remote: Fix checksum verification for messages with escape charsPavel Labath
Summary: We've had a mismatch in the checksum computation between the sender and receiver. The sender computed the payload checksum using the wire encoding of the packet, while the receiver did this after expanding un-escaping and expanding run-length-encoded sequences. This resulted in communication breakdown if packets using these feature were sent in the ack mode. Normally, this did not cause any issues since the only packet we send in the ack-mode is the QStartNoAckMode packet, but I ran into this when debugging the lldb-server tests which (for better or worse) don't use this mode. According to the gdb-remote documentation "The two-digit checksum is computed as the modulo 256 sum of all characters between the leading ‘$’ and the trailing ‘#’", it seems that our sender is doing the right thing here. Therefore, I fix the receiver the match the sender behavior and add a test. With this bug fixed, we can see that lldb-server is sending a stop-reply after receiving the "k" in the same way as debugserver does (but we weren't detecting this because at that point the connection was dead already). I fix that expectation as well. Reviewers: clayborg, jasonmolenda Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D44922 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@328693 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-10Handle O reply packets during qRcmdPavel Labath
Summary: Gdb servers like openocd may send many $O reply packets for the client to output during a qRcmd command sequence. Currently, lldb interprets the first O packet as an unexpected response. Besides generating no output, this causes lldb to get out of sync with future commands because it continues reading O packets from the first command as response to subsequent commands. This patch handles any O packets during an qRcmd, treating the first non-O packet as the true response. Preliminary discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013078.html Reviewers: clayborg Reviewed By: clayborg Subscribers: labath, lldb-commits Differential Revision: https://reviews.llvm.org/D41745 Patch by Owen Shaw <llvm@owenpshaw.net> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@322190 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-10Add Utility/Environment class for handling... environmentsPavel Labath
Summary: There was some confusion in the code about how to represent process environment. Most of the code (ab)used the Args class for this purpose, but some of it used a more basic StringList class instead. In either case, the fact that the underlying abstraction did not provide primitive operations for the typical environment operations meant that even a simple operation like checking for an environment variable value was several lines of code. This patch adds a separate Environment class, which is essentialy a llvm::StringMap<std::string> in disguise. To standard StringMap functionality, it adds a couple of new functions, which are specific to the environment use case: - (most important) envp conversion for passing into execve() and likes. Instead of trying to maintain a constantly up-to-date envp view, it provides a function which creates a envp view on demand, with the expectation that this will be called as the very last thing before handing the value to the system function. - insert(StringRef KeyEqValue) - splits KeyEqValue into (key, value) pair and inserts it into the environment map. - compose(value_type KeyValue) - takes a map entry and converts in back into "KEY=VALUE" representation. With this interface most of the environment-manipulating code becomes one-liners. The only tricky part was maintaining compatibility in SBLaunchInfo, which expects that the environment entries are accessible by index and that the returned const char* is backed by the launch info object (random access into maps is hard and the map stores the entry in a deconstructed form, so we cannot just return a .c_str() value). To solve this, I have the SBLaunchInfo convert the environment into the "envp" form, and use it to answer the environment queries. Extra code is added to make sure the envp version is always in sync. (This also improves the layering situation as Args was in the Interpreter module whereas Environment is in Utility.) Reviewers: zturner, davide, jingham, clayborg Subscribers: emaste, lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D41359 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@322174 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06Remove no-op function pointer null checks, NFCVedant Kumar
Null-checking functions which aren't marked weak_import is a no-op (the compiler rewrites the check to 'true'), regardless of whether a library providing its definition is weak-linked. If the deployment target is greater than the minimum requirement, the availability markup on APIs does not lower to weak_import. Remove no-op null checks to clean up the code and silence warnings. Differential Revision: https://reviews.llvm.org/D40812 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@319936 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09llgs-tests: Replace the "log+return false" pattern with llvm::ErrorPavel Labath
Summary: These tests used to log the error message and return plain bool mainly because at the time they we written, we did not have a nice way to assert on llvm::Error values. That is no longer true, so replace this pattern with a more idiomatic approach. As a part of this patch, I also move the formatting of GDBRemoteCommunication::PacketResult values out of the test code, as that can be useful elsewhere. Reviewers: zturner, eugene Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D39790 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@317795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-18Commiting Christopher Brook's patch forJason Molenda
"Prevent negative chars from being sign-extended into isprint and isspace which take and int and crash if the int is negative" https://reviews.llvm.org/D36620 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@311207 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-12Rename Error -> Status.Zachary Turner
This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@302872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17Don't ever reduce the timeout of a packet, only increase it.Greg Clayton
Differential Revision: https://reviews.llvm.org/D32087 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@300455 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22Move FileSpec from Host -> Utility.Zachary Turner
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@298536 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-04Delete LLDB's code for getting / setting thread name.Zachary Turner
This is now functionality in LLVM, and all callers have already been updated to use the LLVM functions. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@296946 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-03Move Log from Core -> Utility.Zachary Turner
All references to Host and Core have been removed, so this class can now safely be lowered into Utility. Differential Revision: https://reviews.llvm.org/D30559 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@296909 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-23Ensure lldb-server waits for child debug servers to start up when passing ↵Howard Hellyer
them a port number to listen on. Summary: When lldb-server is started with the -P <port> or -m/-M <min/max port> options to specify which ports are available for remote connections the child debug server is told what port it should listen on. In those cases lldb-server needs to wait for the child to report it’s port number as otherwise it can tell the lldb client that the child is up and listening before it is actually listening on that port. lldb-server already waits in the cases where a port wasn’t specified by waiting until the child reports the port it is using. It was skipping this synchronisation step when passed a port numbers as it knew what the port would be however it does need to ensure the child process has had time to open that port and waiting until the child reports the port number makes sure this has happened. This patch just removes the one case where a child was spawned and lldb-server did not wait for it to report it’s port number before telling the client lldb process the child is ready to connect to. This issue was discussed on lldb-dev in a thread here: http://lists.llvm.org/pipermail/lldb-dev/2017-February/012002.html Reviewers: clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D30255 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@295947 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10Add a format_provider for the Timeout classPavel Labath
and use it in the appropriate log statements. Formatting of chrono types in log messages was very clunky. This should make it much nicer to use and give better output. For details of the formatting options see the chrono formatter in llvm. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@294738 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-06Remove the verbose category in the gdb-remote channelPavel Labath
replace by LLDB_LOGV git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@294224 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02Move classes from Core -> Utility.Zachary Turner
This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@293941 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24Prefer lzfse if it is an available compression method (this wasJason Molenda
defaulting to zlib previously). <rdar://problem/30159130> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@292884 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-25Introduce chrono to the Communication classPavel Labath
This replaces the raw integer timeout parameters in the class with their chrono-based equivalents. To achieve this, I have moved the Timeout class to a more generic place and added a quick unit test for it. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@287920 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-24Introduce chrono to more gdb-remote functionsPavel Labath
Summary: This replaces the usage of raw integers with duration classes in the gdb-remote packet management functions. The values are still converted back to integers once they go into the generic Communication class -- that I am leaving to a separate change. The changes are mostly straight-forward (*), the only tricky part was representation of infinite timeouts. Currently, we use UINT32_MAX to denote infinite timeout. This is not well suited for duration classes, as they tend to do arithmetic on the values, and the identity of the MAX value can easily get lost (e.g. microseconds(seconds(UINT32_MAX)).count() != UINT32_MAX). We cannot use zero to represent infinity (as Listener classes do) because we already use it to do non-blocking polling reads. For this reason, I chose to have an explicit value for infinity. The way I achieved that is via llvm::Optional, and I think it reads quite natural. Passing llvm::None as "timeout" means "no timeout", while passing zero means "poll". The only tricky part is this breaks implicit conversions (seconds are implicitly convertible to microseconds, but Optional<seconds> cannot be easily converted into Optional<microseconds>). For this reason I added a special class Timeout, inheriting from Optional, and enabling the necessary conversions one would normally expect. (*) The other tricky part was GDBRemoteCommunication::PopPacketFromQueue, which was needlessly complicated. I've simplified it, but that one is only used in non-stop mode, and so is untested. Reviewers: clayborg, zturner, jingham Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D26971 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@287864 91177308-0d34-0410-b5e6-96231b3b80d8