summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
Commit message (Collapse)AuthorAgeFilesLines
...
* [FileSystem] Remove Exists() from FileSpecJonas Devlieghere2018-11-013-5/+7
| | | | | | | | | This patch removes the Exists method from FileSpec and updates its uses with calls to the FileSystem. Differential revision: https://reviews.llvm.org/D53845 llvm-svn: 345854
* [FileSystem] Extend file system and have it use the VFS.Jonas Devlieghere2018-10-311-1/+1
| | | | | | | | | | | | | | | | This patch extends the FileSystem class with a bunch of functions that are currently implemented as methods of the FileSpec class. These methods will be removed in future commits and replaced by calls to the file system. The new functions are operated in terms of the virtual file system which was recently moved from clang into LLVM so it could be reused in lldb. Because the VFS is stateful, we turned the FileSystem class into a singleton. Differential revision: https://reviews.llvm.org/D53532 llvm-svn: 345783
* Support nwere versions of the Segger J-Link jtag board software.Jason Molenda2018-10-231-3/+12
| | | | | | | | | | | | | | | | | | | | | | Add support in ProcessGDBRemote::GetGDBServerRegisterInfo for recognizing a generic "arm" architecture that will be used if nothing better is available so that we don't ignore the register definitions if we didn't already have an architecture set. Also in ProcessGDBRemote::DoConnectRemote don't set the target arch unless we have a valid architecture to set it to. Platform::ConnectProcess will try to get the current target's architecture, or the default architecture, when creating the target for the connection to be attempted. If lldb was started with a target binary, we want to create this target with that architecture in case the remote gdb stub doesn't supply a qHostInfo arch. Add logging to Target::MergeArchitecture. <rdar://problem/34916465> llvm-svn: 345106
* Replace pointer to C-array of PropertyDefinition with llvm::ArrayRefTatyana Krasnukha2018-09-271-2/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D52572 llvm-svn: 343181
* Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer ↵Tatyana Krasnukha2018-09-261-4/+4
| | | | | | | | llvm::ArrayRef Differential Revision: https://reviews.llvm.org/D49017 llvm-svn: 343130
* [NFC] Turn "load dependent files" boolean into an enumJonas Devlieghere2018-09-201-1/+1
| | | | | | | | | | | | | | This is an NFC commit to refactor the "load dependent files" parameter from a boolean to an enum value. We want to be able to specify a default, in which case we decide whether or not to load the dependent files based on whether the target is an executable or not (i.e. a dylib). This is a dependency for D51934. Differential revision: https://reviews.llvm.org/D51859 llvm-svn: 342633
* Move SafeMachO from Utility to HostPavel Labath2018-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: One of the conclusions of the discussion on D49740 was that SafeMachO is better off in the Host module (as that's the only place which should include mach/machine.h, which is what this header is working around). Also, Utility, which is the only module which cannot include Host, should not be doing anything with object file formats. This patch implements that move, and also removes any unneded includes of that file. I've verified that MacOS still compiles after this. Reviewers: jingham, zturner, teemperor Subscribers: fedor.sergeev, lldb-commits Differential Revision: https://reviews.llvm.org/D50383 llvm-svn: 342050
* Increase qHostInfo packet timeoutPavel Labath2018-08-311-0/+3
| | | | | | | | | Host info computation can involve DNS traffic (to compute the remote host name). On very unreliable networks (such as free WiFi on trains), this can take several seconds to complete or timeout. Increase the qHostInfo timeout to account for this. llvm-svn: 341164
* Move Predicate.h from Host to UtilityRaphael Isemann2018-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This class was initially in Host because its implementation used to be very OS-specific. However, with C++11, it has become a very simple std::condition_variable wrapper, with no host-specific code. It is also a general purpose utility class, so it makes sense for it to live in a place where it can be used by everyone. This has no effect on the layering right now, but it enables me to later move the Listener+Broadcaster+Event combo to a lower layer, which is important, as these are used in a lot of places (notably for launching a process in Host code). Reviewers: jingham, zturner, teemperor Reviewed By: zturner Subscribers: xiaobai, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D50384 llvm-svn: 341089
* Move RegisterValue,Scalar,State from Core to UtilityPavel Labath2018-08-075-7/+7
| | | | | | | | | | | | | These three classes have no external dependencies, but they are used from various low-level APIs. Moving them down to Utility improves overall code layering (although it still does not break any particular dependency completely). The XCode project will need to be updated after this change. Differential Revision: https://reviews.llvm.org/D49740 llvm-svn: 339127
* [ProcessGDBRemote] handle result from ConnectToDebugserverJonas Devlieghere2018-07-251-1/+1
| | | | | | | We ignored the result from ConnectToDebugserver, causing certain errors (like a failed handshake) not to surface. llvm-svn: 337932
* Remove incorrect thread-pc-values clearingJason Molenda2018-07-121-1/+0
| | | | | | | | | | from ProcessGDBRemote::UpdateThreadIDsFromStopReplyThreadsValue. Patch by Venkata Ramanaiah. Differential Revision: https://reviews.llvm.org/D48868 llvm-svn: 336956
* Get rid of the C-string parameter in DoExecuteRaphael Isemann2018-07-121-3/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch gets rid of the C-string parameter in the RawCommandObject::DoExecute function, making the code simpler and less memory unsafe. There seems to be a assumption in some command objects that this parameter could be a nullptr, but from what I can see the rest of the API doesn't actually allow this (and other command objects and related code pieces dereference this parameter without any checks). Especially CommandObjectRegexCommand has error handling code for a nullptr that is now gone. Reviewers: davide, jingham, teemperor Reviewed By: teemperor Subscribers: jingham, lldb-commits Differential Revision: https://reviews.llvm.org/D49207 llvm-svn: 336955
* [windows] LLDB shows the wrong values when register read is executed at a ↵Stella Stamenova2018-07-101-5/+5
| | | | | | | | | | | | | | | | | | | frame other than zero Summary: This is a clean version of the change suggested here: https://bugs.llvm.org/show_bug.cgi?id=37495 The main change is to follow the same pattern as non-windows targets and use an unwinder object to retrieve the register context. I also changed a couple of the comments to actually log, so that issues with unsupported scenarios can be tracked down more easily. Lastly, ClearStackFrames is implemented in the base class, so individual thread implementations don't have to override it. Reviewers: asmith, zturner, aleksandr.urakov Reviewed By: aleksandr.urakov Subscribers: emaste, stella.stamenova, tatyana-krasnukha, llvm-commits Differential Revision: https://reviews.llvm.org/D49111 llvm-svn: 336732
* Remove UUID::SetFromCStringPavel Labath2018-06-211-1/+1
| | | | | | Replace uses with SetFromStringRef. NFC. llvm-svn: 335246
* Replace HostInfo::GetLLDBPath with specific functionsPavel Labath2018-06-192-3/+3
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 335052
* Use llvm::VersionTuple instead of manual version marshallingPavel Labath2018-06-185-49/+18
| | | | | | | | | | | | | | | | | | Summary: This has multiple advantages: - we need only one function argument/instance variable instead of three - no need to default initialize variables - no custom parsing code - VersionTuple has comparison operators, which makes version comparisons much simpler Reviewers: zturner, friss, clayborg, jingham Subscribers: emaste, lldb-commits Differential Revision: https://reviews.llvm.org/D47889 llvm-svn: 334950
* [FileSpec] Make style argument mandatory for SetFile. NFCJonas Devlieghere2018-06-134-7/+14
| | | | | | | | | | | | | | | | 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. llvm-svn: 334663
* Typo fixes.Bruce Mitchener2018-05-291-1/+1
| | | | | | | | | | Reviewers: javed.absar Subscribers: ki.stfu, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D47421 llvm-svn: 333399
* Convert all RunShellCommand functions to use the Timeout classPavel Labath2018-05-103-9/+10
| | | | | | | this completes the Timeout migration started in r331880 with the Predicate class. llvm-svn: 331970
* Modernize and clean-up the Predicate classPavel Labath2018-05-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 331880
* Reflow paragraphs in comments.Adrian Prantl2018-04-309-672/+538
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 331197
* Report more precise error message when attach failsPavel Labath2018-04-181-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: If the remote stub sends a specific error message instead of just a E?? code, we can use this to display a more informative error message instead of just the generic "unable to attach" message. I write a test for this using the SB API. On the console this will show up like: (lldb) process attach ... error: attach failed: <STUB-MESSAGE> if the stub supports error messages, or: error: attach failed: Error ?? if it doesn't. Reviewers: jingham, JDevlieghere Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D45573 llvm-svn: 330247
* Move Args.cpp from Interpreter to UtilityPavel Labath2018-04-174-4/+4
| | | | | | | | | | | | | | | | | | | | | Summary: The Args class is used in plenty of places besides the command interpreter (e.g., anything requiring an argc+argv combo, such as when launching a process), so it needs to be in a lower layer. Now that the class has no external dependencies, it can be moved down to the Utility module. This removes the last (direct) dependency from the Host module to Interpreter, so I remove the Interpreter module from Host's dependency list. Reviewers: zturner, jingham, davide Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D45480 llvm-svn: 330200
* Re-land "Don't assume backing thread shares protocol ID."Jonas Devlieghere2018-04-131-4/+3
| | | | | | | | | | | | | | | | | | When we're dealing with virtual (memory) threads created by the OS plugins, there's no guarantee that the real thread and the backing thread share a protocol ID. Instead, we should iterate over the memory threads to find the virtual thread that is backed by the current real thread. Differential revision: https://reviews.llvm.org/D45497 rdar://36485830 The original revision (r329891) was reverted because the associated tests ran into a deadlock on the Linux bots. That problem was resolved by r330002. llvm-svn: 330005
* Revert "Don't assume backing thread shares protocol ID."Jonas Devlieghere2018-04-121-3/+4
| | | | | | | This reverts r329891 because the test case is timing out on linux: http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/21834 llvm-svn: 329897
* Don't assume backing thread shares protocol ID.Jonas Devlieghere2018-04-121-4/+3
| | | | | | | | | | | | | | When we're dealing with virtual (memory) threads created by the OS plugins, there's no guarantee that the real thread and the backing thread share a protocol ID. Instead, we should iterate over the memory threads to find the virtual thread that is backed by the current real thread. Differential revision: https://reviews.llvm.org/D45497 rdar://36485830 llvm-svn: 329891
* llgs: Send "rich" errors in response to vAttach packetsPavel Labath2018-04-112-4/+4
| | | | | | | | | | | | | | | | | There are plenty of ways attaching can go wrong. Having the server report the exact error means we can give better feedback to the user. (This patch does not do the second part, it only makes sure the information is sent from the server.) Triggering all possible error conditions in a test would prove challenging, but there is one error that is very easy to reproduce (attempting to attach while debugging), so I write a test based on that. The test immediately exposed a bug where the m_send_error_strings field was being used uninitialized (so it was sometimes true from the get-go), so I fix that as well. llvm-svn: 329803
* Move Args::StringTo*** functions to a new OptionArgParser classPavel Labath2018-04-102-4/+5
| | | | | | | | | | | | | | | | Summary: The idea behind this is to move the functionality which depend on other lldb classes into a separate class. This way, the Args class can be turned into a lightweight arc+argv wrapper and moved into the lower lldb layers. Reviewers: jingham, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D44306 llvm-svn: 329677
* Fix windows build after r329296Pavel Labath2018-04-052-0/+2
| | | | | | Add a couple of #include <csignal>s. llvm-svn: 329309
* gdb-remote: Fix checksum verification for messages with escape charsPavel Labath2018-03-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 328693
* Move StringExtractorGDBRemote.h to the include folderPavel Labath2018-03-209-9/+9
| | | | | | | | While trying to use this header I noticed that it is not in the include folder. Move it to there and update all #includes to reference that file correctly. llvm-svn: 327996
* Re-land: [lldb] Use vFlash commands when writing to target's flash memory ↵Pavel Labath2018-03-204-9/+339
| | | | | | | | | | | | | | | | | | | | | | | | | | | | regions The difference between this and the previous patch is that now we use ELF physical addresses only for loading objects into the target (and the rest of the module load address logic still uses virtual addresses). Summary: When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region. A bare metal target may have this kind of setup. - Update ObjectFileELF to set load addresses using physical addresses. A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address. - Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications - Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html Reviewers: clayborg, labath Reviewed By: labath Subscribers: llvm-commits, arichardson, emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D42145 Patch by Owen Shaw <llvm@owenpshaw.net>. llvm-svn: 327970
* Revert "[lldb] Use vFlash commands when writing to target's flash memory ↵Pavel Labath2018-02-284-335/+9
| | | | | | | | | | | | regions" This reverts commit r326261 as it introduces inconsistencies in the handling of load addresses for ObjectFileELF -- some parts of the class use physical addresses, and some use virtual. This has manifested itself as us not being able to set the load address of the vdso "module" on android. llvm-svn: 326367
* [lldb] Use vFlash commands when writing to target's flash memory regionsPavel Labath2018-02-274-9/+335
| | | | | | | | | | | | | | | | | | | | | | Summary: When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region. A bare metal target may have this kind of setup. - Update ObjectFileELF to set load addresses using physical addresses. A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address. - Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications - Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html Reviewers: clayborg, labath Reviewed By: labath Subscribers: arichardson, emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D42145 Patch by Owen Shaw <llvm@owenpshaw.net> llvm-svn: 326261
* [Utility] Simplify and generalize the CleanUp helper, NFCVedant Kumar2018-02-231-18/+13
| | | | | | | | | | | | | | | | | | Removing the template arguments and most of the mutating methods from CleanUp makes it easier to understand and reuse. In its present state, CleanUp would be too cumbersome to adapt to cases where multiple objects need to be released. Take for example this change in swift-lldb: https://github.com/apple/swift-lldb/pull/334/files#diff-6f474df750f75c8ba675f2a8408a5629R219 This change is simple to express with the new CleanUp, but not so simple with the old version. Differential Revision: https://reviews.llvm.org/D43662 llvm-svn: 325964
* Fix the cputype comparison in ↵Jason Molenda2018-02-051-1/+5
| | | | | | | | | GDBRemoteCommunicationServerCommon::Handle_qHostInfo to use Mach-O cpu types instead of the ArchSpec enum value, and handle the case of bridgeos. llvm-svn: 324287
* When parsing the target.xml register file, if no architecture hasJason Molenda2018-01-121-0/+13
| | | | | | | | | | | | | | | | | been specified yet (either by the user, or by one of the lldb extensions like qHostInfo or qProcessInfo), and the target.xml includes a <architecture> tag specifying x86_64, set the architecture appropriately. I'm not sure what we can expect to see in the <architecture> tag, so I'm only doing this for x86_64 right now where I've seen "i386:x86_64" used. I've seen a target.xml from a jtag board that sends just "arm" because it doesn't know more specifically what type of board it is connected to... <rdar://problem/29908970> llvm-svn: 322339
* Handle O reply packets during qRcmdPavel Labath2018-01-105-3/+55
| | | | | | | | | | | | | | | | | | | | 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> llvm-svn: 322190
* Add Utility/Environment class for handling... environmentsPavel Labath2018-01-105-18/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 322174
* Fix a couple of warnings (NFC)Adrian Prantl2017-12-191-0/+1
| | | | llvm-svn: 321120
* Fix regression in jModulesInfo packet handlingPavel Labath2017-12-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | The recent UUID cleanups exposed a bug in the parsing code for the jModulesInfo response, which was passing wrong value for the second argument to UUID::SetFromStringRef (it passed the length of the string, whereas the correct value should be the number of decoded bytes we expect to receive). This was not picked up by tests, because they test with 16-byte uuids, for which the function happens to do the right thing even if the length does not match (if the length does not match, the function does not update m_num_uuid_bytes member, but that member is already 16 to begin with). I fix that and add a test with 20-byte uuid to catch if this regresses. I have also added more safeguards into the parsing code to fail if we cannot parse the entire uuid field we recieve. While testing the latter part, I noticed that the "negative" jModulesInfo tests were succeeding because we were sending malformed json (and not because the json contents was invalid), so I make those tests a bit more robuts as well. llvm-svn: 320985
* llgs: Propagate the environment when launching the inferior from command linePavel Labath2017-12-182-41/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: We were failing to propagate the environment when lldb-server was started with a pre-loaded process (e.g.: lldb-server gdbserver -- inferior --inferior_args) This patch makes sure the environment is propagated. Instead of adding a new GDBRemoteCommunicationServerLLGS::SetLaunchEnvironment function to complement SetLaunchArgs and SetLaunchFlags, I replace these with a more generic SetLaunchInfo, which can be used to set any launch-related property. The accompanying test also verifies that the server correctly terminates the connection after sending the exit packet (specifically, that it does not send the exit packet twice). Reviewers: clayborg, eugene Subscribers: lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D41070 llvm-svn: 320984
* NPL: Clean up handling of inferior exitPavel Labath2017-12-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: lldb-server was sending the "exit" packet (W??) twice. This happened because it was handling both the pre-exit (PTRACE_EVENT_EXIT) and post-exit (WIFEXITED) as exit events. We had some code which was trying to detect when we've already sent the exit packet, but this stopped working quite a while ago. This never really caused any problems in practice because the client automatically closes the connection after receiving the first packet, so the only effect of this was some warning messages about extra packets from the lldb-server test suite, which were ignored because they didn't fail the test. The new test suite will be stricter about this, so I fix this issue ignoring the first event. I think this is the correct behavior, as the inferior is not really dead at that point, so it's premature to send the exit packet. There isn't an actual test yet which would verify the exit behavior, but in my next patch I will add a test which will also test this functionality. Reviewers: eugene Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D41069 llvm-svn: 320961
* Remove stderr message from GDBRemoteCommunicationServerLLGSPavel Labath2017-12-141-7/+2
| | | | | | | | A similar error message is printed again in lldb-gdbserver.cpp, so the user will see the message twice. Also, this is generic library code, we shouldn't really be using stderr here. llvm-svn: 320704
* Move PseudoTerminal to the lldb_private namespacePavel Labath2017-12-111-3/+2
| | | | | | | lldb_utility doesn't make sense, as it is no longer even living in the "utility" module. llvm-svn: 320346
* Remove no-op function pointer null checks, NFCVedant Kumar2017-12-062-20/+7
| | | | | | | | | | | | | | 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 llvm-svn: 319936
* Remove unused variable.Tatyana Krasnukha2017-11-221-1/+1
| | | | llvm-svn: 318833
* Move ArchSpec to the Utility modulePavel Labath2017-11-134-8/+2
| | | | | | | | | | | | | The rationale here is that ArchSpec is used throughout the codebase, including in places which should not depend on the rest of the code in the Core module. This commit touches many files, but most of it is just renaming of #include lines. In a couple of cases, I removed the #include ArchSpec line altogether, as the file was not using it. In one or two places, this necessitated adding other #includes like lldb-private-defines.h. llvm-svn: 318048
* Clean up NativeRegisterContextPavel Labath2017-11-101-111/+70
| | | | | | | | | | | | | | | | | | | | | Summary: This commit removes the concrete_frame_idx member from NativeRegisterContext and related functions, which was always set to zero and never used. I also change the native thread class to store a NativeRegisterContext as a unique_ptr (documenting the ownership) and make sure it is always initialized (most of the code was already blindly dereferencing the register context pointer, assuming it would always be present -- this makes its treatment consistent). Reviewers: eugene, clayborg, krytarowski Subscribers: aemerson, sdardis, nemanjai, javed.absar, arichardson, kristof.beyls, kbarton, uweigand, alexandreyy, lldb-commits Differential Revision: https://reviews.llvm.org/D39837 llvm-svn: 317881
OpenPOWER on IntegriCloud