[Lldb-commits] [PATCH] D67793: new api class: SBFile
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 30 00:27:36 PDT 2019
labath added a comment.
Thanks. This looks good to me, but given that this is going to become a stable api that well need to maintain for a looong time, I'd like to get signoff from someone else as well. @jingham maybe ?
================
Comment at: lldb/include/lldb/API/SBDefines.h:95
class LLDB_API SBUnixSignals;
+class LLDB_API SBFile;
----------------
Sort this list ?
================
Comment at: lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py:27
+
+def handle_command(debugger, cmd, raise_on_fail=True, collect_result=True):
+
----------------
Please add a comment to explain why is this needed (I guess that has something to do with needing more control over the command output stream), because superficially it looks like you're reimplementing `TestBase.runCmd` here.
================
Comment at: lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py:37-38
+
+ if collect_result and raise_on_fail and not ret.Succeeded():
+ raise Exception
+
----------------
Maybe instead of `raise_on_fail` this should be called `check` (in analogy to runCmd function), and instead of raising an exception you could assert that ret.Succeeded() is true?
================
Comment at: lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py:52
+ try:
+ with open('output', 'w') as f:
+ debugger.SetOutputFileHandle(f, False)
----------------
I believe all of these will end up writing to the source tree. Could you try replacing that with `self.getBuildArtifact("output")` ?
================
Comment at: lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py:127-132
+
+
+
+
+
+
----------------
delete
================
Comment at: lldb/scripts/interface/SBFile.i:36
+
+ bool IsValid() const;
+
----------------
add operator bool here. I'm not sure if swig handles operator!, but if it does, then we should add that too.
================
Comment at: lldb/source/API/SBFile.cpp:1
+//===-- SBFile.cpp ------------------------------------------*- C++ -*-===//
+//
----------------
I think you'll need to add the reproducer boilerplate to this file. I think it should be possible to do that automatically via lldb-instr, but I've never done that. @JDevlieghere should be able to help here.
================
Comment at: lldb/source/Host/common/File.cpp:72-74
+ if (mode.empty())
+ return 0;
+ return llvm::StringSwitch<uint32_t>(mode.str())
----------------
I know you're just copying, but could you remove the `.str()` call the `.empty() check, as neither of them are really needed here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67793/new/
https://reviews.llvm.org/D67793
More information about the lldb-commits
mailing list