This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [llgs] Convert m_debugged_processes into a map of structs
ClosedPublic

Authored by mgorny on Jul 13 2022, 8:38 AM.

Details

Summary

Convert the m_debugged_processes map from NativeProcessProtocol pointers
to structs, and combine the additional set(s) holding the additional
process properties into a flag field inside this struct. This is
desirable since there are more properties to come and having a single
structure with all information should be cleaner and more efficient than
using multiple sets for that.

Suggested by Pavel Labath in D128893.

Diff Detail

Event Timeline

mgorny created this revision.Jul 13 2022, 8:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 8:38 AM
mgorny requested review of this revision.Jul 13 2022, 8:38 AM
labath accepted this revision.Jul 14 2022, 5:39 AM
labath added inline comments.
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
1058–1060

Btw, is this actually correct. E.g. I don't think we ought to terminate the connection if a process dies "naturally", and there are still other processes around...

Isn't it more like the opposite, that if k is used, *then* we close the connection (after all processes exit)? And maybe also when the process exits, and multiprocess extensions are disabled?

This revision is now accepted and ready to land.Jul 14 2022, 5:39 AM
mgorny added inline comments.Jul 14 2022, 6:31 AM
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
1058–1060

Well, the comment describes some of the cases when we don't terminate it, i.e. it skips the kinda-obvious case when there are additional processes running, i.e. we stop it only if all of the following apply: a. all processes have exited, b. we are not in non-stop mode (in non-stop mode we wait for vStopped) and c. the last process wasn't killed by vKill (to match the behavior of GDB).

Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2022, 6:42 AM
labath added inline comments.Jul 15 2022, 1:48 AM
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
1058–1060

Ah, yes, that makes sense. I should have looked at the code as well. Thanks for explaining.