[all-commits] [llvm/llvm-project] f3b7cc: [lldb/test] Add ability to terminate connection fr...

Pavel Labath via All-commits all-commits at lists.llvm.org
Fri Nov 19 09:00:33 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f3b7cc8bb2ea599e0c344e8ae16639667d9f0eff
      https://github.com/llvm/llvm-project/commit/f3b7cc8bb2ea599e0c344e8ae16639667d9f0eff
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2021-11-19 (Fri, 19 Nov 2021)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/gdbclientutils.py
    M lldb/test/API/functionalities/gdb_remote_client/TestPty.py

  Log Message:
  -----------
  [lldb/test] Add ability to terminate connection from a gdb-client handler

We were using the client socket close as a way to terminate the handler
thread. But this kind of concurrent access to the same socket is not
safe. It also complicates running the handler without a dedicated thread
(next patch).

Instead, here I add an explicit way for a packet handler to request
termination. Waiting for lldb to terminate the connection would almost
be sufficient, but in the pty test we want to keep the pty open so we
can examine its state. Ability to disconnect at an arbitrary point may
be useful for testing other aspects of lldb functionality as well.

The way this works is that now each packet handler can optionally return
a list of responses (instead of just one). One of those responses (it
only makes sense for it to be the last one) can be a special
RESPONSE_DISCONNECT object, which triggers a disconnection (via a new
TerminateConnectionException).

As the mock server now cleans up the connection whenever it disconnects,
the pty test needs to explicitly dup(2) the descriptors in order to
inspect the post-disconnect state.

Differential Revision: https://reviews.llvm.org/D114156




More information about the All-commits mailing list