[Lldb-commits] [PATCH] D120972: [lldb] Show progress events in the command line driver

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 3 21:20:58 PST 2022


JDevlieghere created this revision.
JDevlieghere added reviewers: labath, clayborg, mib, aprantl, kastiglione.
Herald added a project: All.
JDevlieghere requested review of this revision.

This patch adds support for showing progress events when using lldb on the command line. It spawns a separate thread that listens for progress events and prints them to the debugger's output stream.

It's nothing fancy (yet), for now it just prints the progress message. If we know the total number of items being processed, we prefix the message with something like  [1/100], similar to ninja's output. It doesn't use any fancy terminal manipulation: it uses a simple carriage return (`\r`) to bring the cursor to the front of the line. If we support ANSI escape codes, we use a vt100 escape code to clear the current line when a progress event is complete. Otherwise we just overwrite it with as many spaces as the current terminal is wide.

Here's a recording of what this looks like in practice: https://asciinema.org/a/HBMDelpb9XDKccXZ09mgfuJ8R


https://reviews.llvm.org/D120972

Files:
  lldb/include/lldb/API/SBCommandInterpreterRunOptions.h
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/source/API/SBCommandInterpreterRunOptions.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Symbol/LocateSymbolFile.cpp
  lldb/tools/driver/Driver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120972.412922.patch
Type: text/x-patch
Size: 10438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220304/7b9cd783/attachment-0001.bin>


More information about the lldb-commits mailing list