teemperor requested changes to this revision.
teemperor added a comment.
This revision now requires changes to proceed.

I think we should instead implement the `Terminate` function that the plugin 
system provides to tear down our state. I made a patch in D104093 
<https://reviews.llvm.org/D104093> that
moves the `once_flags` to the internal state struct, so with a proper 
`Terminate` implementation + my patch this should all work properly.

  HostInfoLinux::Terminate() {
    assert(g_fields && "Missing call to Initialize?");
    delete g_fields;
    g_fields = nullptr;
    HostInfoBase::Terminate();
  }



================
Comment at: lldb/source/Host/linux/HostInfoLinux.cpp:38
   HostInfoPosix::Initialize(helper);
-
-  g_fields = new HostInfoLinuxFields();
+  if (!g_fields)
+    g_fields = new HostInfoLinuxFields();
----------------
Please instead add a `HostInfoLinux::Terminate()` function that deletes and 
zeroes `g_fields` (see `HostInfoBase::Terminate`). Initialize -> Terminate 
should set up and tear down the data structures if possible (not saying that 
LLDB is doing this consistently at the moment, but that's the idea at least).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104091

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] D1... Raphael Isemann via Phabricator via lldb-commits

Reply via email to