diff options
author | Pavel Labath <labath@google.com> | 2018-01-10 14:39:08 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-01-10 14:39:08 +0000 |
commit | 7da84753a347bb9b335b0a7106b1930c68953726 (patch) | |
tree | 4764d4c28aa7e35146bc53a1318ec2d3d9154ae4 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | |
parent | 3afbd825a394dab05b2376fbc33e535f3a1b444a (diff) | |
download | bcm5719-llvm-7da84753a347bb9b335b0a7106b1930c68953726.tar.gz bcm5719-llvm-7da84753a347bb9b335b0a7106b1930c68953726.zip |
Handle O reply packets during qRcmd
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
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 44efcbe20ae..78399b733a7 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -5145,10 +5145,11 @@ public: bool send_async = true; StringExtractorGDBRemote response; - process->GetGDBRemote().SendPacketAndWaitForResponse( - packet.GetString(), response, send_async); - result.SetStatus(eReturnStatusSuccessFinishResult); Stream &output_strm = result.GetOutputStream(); + process->GetGDBRemote().SendPacketAndReceiveResponseWithOutputSupport( + packet.GetString(), response, send_async, + [&output_strm](llvm::StringRef output) { output_strm << output; }); + result.SetStatus(eReturnStatusSuccessFinishResult); output_strm.Printf(" packet: %s\n", packet.GetData()); const std::string &response_str = response.GetStringRef(); |