This is an archive of the discontinued LLVM Phabricator instance.

[lldb/platform-gdb] Clear cached protocol state upon disconnection
ClosedPublic

Authored by labath on Jan 3 2022, 7:59 AM.

Details

Summary

Previously we would persist the flags indicating whether the remote side
supports a particular feature across reconnects, which is obviously not
a good idea.

I implement the clearing by nuking (its the only way to be sure :) the
entire GDBRemoteCommunication object in the disconnect operation and
creating a new one upon connection. This allows us to maintain a nice
invariant that the GDBRemoteCommunication object (which is now a
pointer) exists only if it is connected. The downside to that is that a
lot of functions now needs to check the validity of the pointer instead
of blindly accessing the object.

The process communication does not suffer from the same issue because we
always destroy the entire Process object for a relaunch.

Diff Detail

Event Timeline

labath requested review of this revision.Jan 3 2022, 7:59 AM
labath created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2022, 7:59 AM
JDevlieghere accepted this revision.Jan 7 2022, 11:34 AM

LGTM

lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
84–85

Should this have assert(IsConnected()); like PlatformRemoteGDBServer::LaunchGDBServer does?

104

Same here.

This revision is now accepted and ready to land.Jan 7 2022, 11:34 AM
labath added inline comments.Jan 10 2022, 7:15 AM
lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp
84–85

Yeah, I guess it should.