[all-commits] [llvm/llvm-project] 0c208d: [lldb] Fix flakyness in TestGdbRemote_vContThreads

Pavel Labath via All-commits all-commits at lists.llvm.org
Thu Mar 18 12:42:27 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0c208d1f42be3fcbca37729cafcab5e97ce0a8e2
      https://github.com/llvm/llvm-project/commit/0c208d1f42be3fcbca37729cafcab5e97ce0a8e2
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2021-03-18 (Thu, 18 Mar 2021)

  Changed paths:
    M lldb/test/API/tools/lldb-server/main.cpp

  Log Message:
  -----------
  [lldb] Fix flakyness in TestGdbRemote_vContThreads

The cause is the non-async-signal-safety printf function (et al.). If
the test managed to interrupt the process and inject a signal before the
printf("@started") call returned (but after it has actually written the
output), that string could end up being printed twice (presumably,
because the function did not manage the clear the userspace buffer, and
so the print call in the signal handler would print it once again).

This patch fixes the issue by replacing the printf call in the signal
handler with a sprintf+write combo, which should not suffer from that
problem (though I wouldn't go as far as to call it async signal safe).




More information about the All-commits mailing list