[Lldb-commits] [lldb] [lldb] Add repeat commands documentation (PR #194923)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 30 01:53:35 PDT 2026
================
@@ -0,0 +1,147 @@
+Repeat Commands
+===============
+
+In LLDB's command line interface, pressing Enter (an empty command) repeats the
+previous command. By default, the exact same command is re-executed. However,
+several commands customize this behavior to implement paging or progressive
+expansion, making it easy to explore data incrementally by pressing Enter
+repeatedly.
+
+This page documents the commands with custom repeat behavior.
+
+``thread backtrace`` (``bt``)
+-----------------------------
+
+When ``thread backtrace`` is invoked with the ``--count`` (``-c``) option, the
+repeat command pages through the backtrace by advancing the ``--start`` (``-s``)
+option by the count each time.
+
+For example:
+
+::
+
+ (lldb) bt 5
+ * thread #1, stop reason = breakpoint 1.1
+ * frame #0: handle_request at server.cpp:50
+ frame #1: parse_headers at http.cpp:12
+ frame #2: read_socket at socket.cpp:30
+ frame #3: accept_connection at listener.cpp:8
+ frame #4: event_loop at reactor.cpp:100
+ (lldb)
+ # repeats as: thread backtrace -c 5 -s 5
+ * thread #1, stop reason = breakpoint 1.1
+ frame #5: start_server at main.cpp:42
+ frame #6: load_config at config.cpp:7
+ ...
+ (lldb)
+ # repeats as: thread backtrace -c 5 -s 10
+
+Each press of Enter shows the next 5 frames. If ``--count`` is not specified,
+the full backtrace is displayed and there is no repeat command.
+
+``source list`` (``list``)
+--------------------------
+
+When ``source list`` is repeated, it shows the next block of source lines,
+continuing from where the previous listing ended. This mimics paging behavior.
+
+If the ``--reverse`` (``-r``) option was given, the repeat command continues
+listing in reverse (showing earlier source lines).
+
+::
+
+ (lldb) list # shows source around the current location
+ (lldb) # shows the next block of source lines
+ (lldb) # shows the next block after that
+
+ (lldb) list -r # shows source in reverse
+ (lldb) # continues listing in reverse
+
+``memory read``
+---------------
+
+When ``memory read`` is repeated, it continues reading from where the previous
+read ended. The repeat command drops the address arguments and re-uses the same
+format, size, and count options from the previous invocation.
----------------
DavidSpickett wrote:
FYI some of this is not working at the moment - https://github.com/llvm/llvm-project/issues/192057.
Your example here does work and we will fix that bug eventually, so no need to change anything but if you got weird results trying to make an example, that's why.
https://github.com/llvm/llvm-project/pull/194923
More information about the lldb-commits
mailing list