[Lldb-commits] [PATCH] D82155: [WIP][lldb/interpreter] Add ability to save lldb session to a file

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 19 01:02:23 PDT 2020


mib created this revision.
mib added reviewers: labath, JDevlieghere.
mib added a project: LLDB.
Herald added a subscriber: mgorny.
mib retitled this revision from "[lldb/interpreter] Add ability to save lldb session to a file" to "[WIP][lldb/interpreter] Add ability to save lldb session to a file".
mib added a comment.

Hey folks, this is a first implementation of the patch and surely there will be several other revisions before landing it.

Some functionalities are not supported yet, like:

- Multi-line expression
- Python/Lua? Interactive script interpreter
- Outputs that aren't in the `CommandReturnObject`

I didn't provide tests because it's still WIP (obviously, it will come it the next revisions) , but at the moment, I'm not sure what would be a good test plan for this feature (suggestions are welcomed).

Thanks in advance for the feedback.


This patch introduce a new feature that allows the users to save their
debugging session's transcript (commands + outputs) to a file.

It differs from the reproducers since it doesn't require to capture a
session preemptively and replay the reproducer file in lldb.
The user can choose the save its session manually using the `session save`
command or automatically by setting the `interpreter.save-session-on-quit`
on their init file.

To do so, the patch adds a `Stream` object to the CommandInterpreter that
will hold the input command from the IOHandler and the CommandReturnObject
output and error. This way, that stream object accumulates passively all
the interactions throughout the session and will save them to disk on demand.

The user can specify a file path where the session's transcript will be
saved. However, it is optional, and when it is not provided, lldb will
create a temporary file name according to the session date and time.

rdar://63347792

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82155

Files:
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/source/Commands/CMakeLists.txt
  lldb/source/Commands/CommandObjectQuit.cpp
  lldb/source/Commands/CommandObjectSession.cpp
  lldb/source/Commands/CommandObjectSession.h
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Interpreter/InterpreterProperties.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82155.271939.patch
Type: text/x-patch
Size: 12361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200619/9e025000/attachment-0001.bin>


More information about the lldb-commits mailing list