[Lldb-commits] [PATCH] D89335: [lldb] Generic support for caching register set reads/writes [WIP]

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 14 05:09:20 PDT 2020


labath added a comment.

I'm wondering if this could be implemented as some kind of a separate class which you "mix" into your register context when you want to do caching. Possibly something like this:

  class NRCLinux_MyArch: public NRCLinux, private RCCache::Backend {
    RCCache m_cache;
  
    NRCLinux_MyArch(...) : m_cache(this) {}
  
    // NRC interface
    ReadRegister(...) override { return m_cache.ReadRegister(...); }
    ...
  
    // Backend interface
    ReadReally(...) override { action happens here }
  };

That would enable individual register contexts to explicitly opt into caching, which might be cleaner in the long term, as I anticipate it will take a very long time to convert all registers contexts to the new way of doing things.



================
Comment at: lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h:25
+
+#define LLDB_INVALID_REGSET UINT32_MAX
+
----------------
I think using `Optional<integral>` would be better. Although, I'm not sure what are the cases where a register does not belong to any register set.


================
Comment at: lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h:64-83
+  virtual Status ReadRegisterSet(uint32_t set) {
+    return Status("not implemented");
+  }
+
+  virtual Status WriteRegisterSet(uint32_t set) {
+    return Status("not implemented");
+  }
----------------
I think new interfaces should use llvm::Error/Expected


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

https://reviews.llvm.org/D89335



More information about the lldb-commits mailing list