[Lldb-commits] [lldb] [lldb] Make use of Scripted{Python, }Interface for ScriptedThreadPlan (PR #70392)
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 27 13:33:05 PDT 2023
================
@@ -104,6 +104,19 @@ ScriptInterpreter::GetStatusFromSBError(const lldb::SBError &error) const {
return Status();
}
+Event *
+ScriptInterpreter::GetOpaqueTypeFromSBEvent(const lldb::SBEvent &event) const {
+ return event.m_opaque_ptr;
+}
+
+Stream *ScriptInterpreter::GetOpaqueTypeFromSBStream(
+ const lldb::SBStream &stream) const {
+ if (stream.m_opaque_up)
+ return const_cast<lldb::SBStream &>(stream).m_opaque_up.release();
----------------
bulbazord wrote:
I'm having a hard time wrapping my head around the SBStream portion of your patch (everything else makes sense). So we pass in a `const SBStream &` to `GetOpaqueTypeFromSBStream` which that takes ownership of the underlying `Stream *` and returns it. What happens to the original SBStream argument? Can we guarantee that nothing ever tries to use it again afterwards?
It looks like the intent in `ReverseTransform` is to take ownership of the original user-provided stream and write its contents to some other stream `original_arg` after performing some kind of copy on it. Instead of taking ownership of the underlying stream (and invalidating its argument), why not just use `.get()` instead of `.release()`? The `SBStream` passed in here won't be invalidated and `original_arg` in `ReverseTransform` can still get the data out of the Python `SBStream` object.
What am I missing?
https://github.com/llvm/llvm-project/pull/70392
More information about the lldb-commits
mailing list