[Lldb-commits] [PATCH] D68181: SBDebugger::SetInputFile, SetOutputFile, etc.

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 30 00:45:55 PDT 2019


labath added a comment.

Looks mostly fine to me. Just a couple of questions inline...



================
Comment at: lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py:243-244
+                status = debugger.SetOutputFile(outsbf)
+                if status.Fail():
+                    raise Exception(status)
+
----------------
`self.assertTrue(status.Success())`


================
Comment at: lldb/source/API/SBDebugger.cpp:296-313
   if (!m_opaque_sp)
     return;
 
   repro::DataRecorder *recorder = nullptr;
   if (repro::Generator *g = repro::Reproducer::Instance().GetGenerator())
     recorder = g->GetOrCreate<repro::CommandProvider>().GetNewDataRecorder();
 
----------------
Any chance we could make this method simply delegate to the SBFile version ?


================
Comment at: lldb/source/Core/Debugger.cpp:828-833
+  if (!file_sp || !file_sp->IsValid()) {
     m_input_file_sp = std::make_shared<File>(stdin, false);
+    error.SetErrorString("invalid file");
+  } else {
+    m_input_file_sp = file_sp;
+  }
----------------
Could we make it so that the validity of the file_sp argument is checked at the SB level? That way you wouldn't need the Status result here. Same goes for stdout and stderr methods.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68181/new/

https://reviews.llvm.org/D68181





More information about the lldb-commits mailing list