[all-commits] [llvm/llvm-project] 09dea5: [lldb] Support a buffered logging mode

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Thu Jun 23 09:12:18 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 09dea546692f4e9f32bf16f1a9d5d0de52a64691
      https://github.com/llvm/llvm-project/commit/09dea546692f4e9f32bf16f1a9d5d0de52a64691
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2022-06-23 (Thu, 23 Jun 2022)

  Changed paths:
    M lldb/include/lldb/Core/Debugger.h
    M lldb/include/lldb/Utility/Log.h
    M lldb/source/API/SBDebugger.cpp
    M lldb/source/Commands/CommandObjectLog.cpp
    M lldb/source/Commands/Options.td
    M lldb/source/Core/Debugger.cpp
    M lldb/source/Utility/Log.cpp
    M lldb/tools/lldb-test/lldb-test.cpp

  Log Message:
  -----------
  [lldb] Support a buffered logging mode

This patch adds a buffered logging mode to lldb. A buffer size can be
passed to `log enable` with the -b flag. If no buffer size is specified,
logging is unbuffered.

Differential revision: https://reviews.llvm.org/D127986


  Commit: 70841b97eb2e5c68d46b70579877e378511a47b4
      https://github.com/llvm/llvm-project/commit/70841b97eb2e5c68d46b70579877e378511a47b4
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2022-06-23 (Thu, 23 Jun 2022)

  Changed paths:
    M lldb/include/lldb/Utility/Log.h
    M lldb/source/Commands/CommandObjectLog.cpp
    M lldb/source/Commands/Options.td
    M lldb/source/Core/Debugger.cpp
    M lldb/source/Utility/Log.cpp
    M lldb/test/API/commands/log/basic/TestLogging.py
    M lldb/unittests/Utility/LogTest.cpp

  Log Message:
  -----------
  [lldb] Make thread safety the responsibility of the log handlers

Drop the thread-safe flag and make the locking strategy the
responsibility of the individual log handler.

Previously we got away with a non-thread safe mode because we were using
unbuffered streams that rely on the underlying syscalls/OS for
synchronization. With the introduction of log handlers, we can have
arbitrary logic involved in writing out the logs. With this patch the
log handlers can pick the most appropriate locking strategy for their
particular implementation.

Differential revision: https://reviews.llvm.org/D127922


Compare: https://github.com/llvm/llvm-project/compare/734ad031f166...70841b97eb2e


More information about the All-commits mailing list