[Lldb-commits] [lldb] Add warning message to `session save` when transcript isn't saved. (PR #109020)

Tom Yang via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 20 17:48:19 PDT 2024


================
@@ -3306,6 +3306,8 @@ bool CommandInterpreter::SaveTranscript(
   result.SetStatus(eReturnStatusSuccessFinishNoResult);
   result.AppendMessageWithFormat("Session's transcripts saved to %s\n",
                                  output_file->c_str());
+  if (!GetSaveTranscript())
+    result.AppendError("Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded.");
----------------
zhyty wrote:

Here's an example:
```
(lldb) settings set interpreter.save-transcript true
(lldb) p 1
(int) 1
(lldb) hello
error: 'hello' is not a valid command.
(lldb) settings set interpreter.save-transcript false
(lldb) p 2
(int) 2
(lldb) session save
Session's transcripts saved to /var/folders/dh/nv6c_38j4tq3crp6r6f69sdc0000gn/T/lldb/lldb_session_2024-09-20_17-46-03.936239000.log
error: Note: the setting interpreter.save-transcript is set to false, so the transcript might not have been recorded.
```

In this case, the text in between the two `interpreter.save-transcript` settings will be saved, including the actual command to disable it. So here's what's saved:
```
(lldb) settings set interpreter.save-transcript true
(lldb) p 1
(int) 1
(lldb) hello
error: 'hello' is not a valid command.
(lldb) settings set interpreter.save-transcript false
```

This is why I worded it like this. `session save` *will* save whatever's found in the transcript buffer, but what was actually saved in the transcript buffer depends if users did something like this.

https://github.com/llvm/llvm-project/pull/109020


More information about the lldb-commits mailing list